# HG changeset patch # User Pierre-Yves David # Date 1677395843 -3600 # Node ID 5bf6b80150356a1461813f7b7c4aba25f3eabc10 # Parent 0f483a2c29e7e632507d820e8ad8dacfc1d957fc dirstate: check dirstate race condition around status More problems to solve. diff -r 0f483a2c29e7 -r 5bf6b8015035 tests/test-dirstate-read-race.t --- a/tests/test-dirstate-read-race.t Sun Feb 26 07:08:16 2023 +0100 +++ b/tests/test-dirstate-read-race.t Sun Feb 26 08:17:23 2023 +0100 @@ -251,3 +251,45 @@ $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting $ cd .. + +Race with a cache updating `hg status` +-------------------------------------- + +It is interesting to race with "read-only" operation (that still update its cache) + + $ cp -a reference-repo race-with-status + $ cd race-with-status + +spin a `hg status` with some caches to update + + $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \ + > --config rhg.on-unsupported=abort \ + > --config devel.sync.dirstate.pre-read-file=$TESTTMP/status-race-lock \ + > & + $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting +do an update + + $ touch -t 200001020006 f + $ hg status + A dir/o + R dir/nested/m + ? dir/n + ? p + ? q + $ touch $TESTTMP/status-race-lock + $ wait + +The status process should return a consistent result and not crash. + + $ cat $TESTTMP/status-race-lock.out + A dir/o + R dir/nested/m + ? dir/n + ? p + ? q + $ cat $TESTTMP/status-race-lock.log + +final cleanup + + $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting + $ cd ..