Mercurial > hg-stable
diff tests/test-dirstate-race.t @ 32835:1b25c648d5b7
fsmonitor: don't write out state if identity has changed (issue5581)
Inspired by the dirstate fix in dc7efa2826e4, this should fix any race
conditions with the fsmonitor state changing from underneath.
Since we now grab the wlock for any non-invalidate writes, the only situation
this appears to happen in is with a concurrent invalidation. Test that.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Mon, 12 Jun 2017 15:34:31 -0700 |
parents | 15e85dded933 |
children | 29558247b00e |
line wrap: on
line diff
--- a/tests/test-dirstate-race.t Mon Jun 12 15:34:31 2017 -0700 +++ b/tests/test-dirstate-race.t Mon Jun 12 15:34:31 2017 -0700 @@ -160,6 +160,34 @@ $ rm b +#if fsmonitor + +Create fsmonitor state. + + $ hg status + $ f --type .hg/fsmonitor.state + .hg/fsmonitor.state: file + +Test that invalidating fsmonitor state in the middle (which doesn't require the +wlock) causes the fsmonitor update to be skipped. +hg debugrebuilddirstate ensures that the dirstaterace hook will be called, but +it also invalidates the fsmonitor state. So back it up and restore it. + + $ mv .hg/fsmonitor.state .hg/fsmonitor.state.tmp + $ hg debugrebuilddirstate + $ mv .hg/fsmonitor.state.tmp .hg/fsmonitor.state + + $ cat > $TESTTMP/dirstaterace.sh <<EOF + > rm .hg/fsmonitor.state + > EOF + + $ hg status --config extensions.dirstaterace=$TESTTMP/dirstaterace.py --debug + skip updating fsmonitor.state: identity mismatch + $ f .hg/fsmonitor.state + .hg/fsmonitor.state: file not found + +#endif + Set up a rebase situation for issue5581. $ echo c2 > a