Mercurial > hg
diff tests/test-dirstate-read-race.t @ 50232:5bf6b8015035 stable
dirstate: check dirstate race condition around status
More problems to solve.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 26 Feb 2023 08:17:23 +0100 |
parents | 0f483a2c29e7 |
children | cf0d7cd6a6fa |
line wrap: on
line diff
--- 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 ..