sapling/eden/scm/tests/test-fsmonitor-detectrace.t
Durham Goode d02d5cdbfe py3: fix test-fsmonitor*
Summary: These now pass

Reviewed By: quark-zju

Differential Revision: D22127383

fbshipit-source-id: bcaad400d9f849251e396b68ad1b4d04c8831314
2020-06-19 13:40:18 -07:00

68 lines
1.6 KiB
Perl

#require fsmonitor
$ setconfig fsmonitor.detectrace=1
$ newrepo
No races for common operations
$ touch x
$ hg status
? x
$ rm x
$ touch y
$ hg status
? y
Create a race by write files by writing files if context._dirstatestatus is called
$ echo 'f' > .gitignore
$ mkdir c
$ touch e f g
$ cat > $TESTTMP/racy.py << EOF
> from edenscm.hgext import fsmonitor
> from edenscm.mercurial import extensions
> def _race(orig, *args, **kwargs):
> open('a', 'w').close()
> open('f', 'w').close()
> open('c/d.txt', 'w').close()
> return orig(*args, **kwargs)
> def uisetup(ui):
> extensions.wrapfunction(fsmonitor, "_walk", _race)
> EOF
$ hg status --config extensions.racy=$TESTTMP/racy.py
abort: [race-detector] files changed when scanning changes in working copy:
a
c/d.txt
(this is an error because HGDETECTRACE or fsmonitor.detectrace is set to true)
[75]
The race detector does not check files outside specified patterns:
$ hg status --config extensions.racy=$TESTTMP/racy.py y
? y
$ hg status --config extensions.racy=$TESTTMP/racy.py y a
abort: [race-detector] files changed when scanning changes in working copy:
a
(this is an error because HGDETECTRACE or fsmonitor.detectrace is set to true)
[75]
Ignored files do not use fsmonitor. So race detector does not detect it:
$ hg status -i --config extensions.racy=$TESTTMP/racy.py
I f
Race detector can be turned off:
$ hg status --config extensions.racy=$TESTTMP/racy.py --config fsmonitor.detectrace=0
? .gitignore
? a
? c/d.txt
? e
? g
? y