comparison tests/test-transaction-rollback-on-revlog-split.t @ 51997:3f70ea5bcaeb

tests: use the cross platform `SIGKILL` function This partially fixes `test-transaction-rollback-on-revlog-split.t` (there are still problems related to waiting on the lock files), and completely fixes `test-fncache.t`.
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 12 Oct 2024 16:35:03 -0400
parents 3ccef7902070
children 629ecced55a6
comparison
equal deleted inserted replaced
51996:625cf9621551 51997:3f70ea5bcaeb
6 6
7 Helper extension to intercept renames and kill process 7 Helper extension to intercept renames and kill process
8 8
9 $ cat > $TESTTMP/intercept_before_rename.py << EOF 9 $ cat > $TESTTMP/intercept_before_rename.py << EOF
10 > import os 10 > import os
11 > import signal
12 > from mercurial import extensions, util 11 > from mercurial import extensions, util
12 > from mercurial.testing import ps_util
13 > 13 >
14 > def extsetup(ui): 14 > def extsetup(ui):
15 > def rename(orig, src, dest, *args, **kwargs): 15 > def rename(orig, src, dest, *args, **kwargs):
16 > path = util.normpath(dest) 16 > path = util.normpath(dest)
17 > if path.endswith(b'data/file.i'): 17 > if path.endswith(b'data/file.i'):
18 > os.kill(os.getpid(), signal.SIGKILL) 18 > ps_util.kill(os.getpid())
19 > return orig(src, dest, *args, **kwargs) 19 > return orig(src, dest, *args, **kwargs)
20 > extensions.wrapfunction(util, 'rename', rename) 20 > extensions.wrapfunction(util, 'rename', rename)
21 > EOF 21 > EOF
22 22
23 $ cat > $TESTTMP/intercept_after_rename.py << EOF 23 $ cat > $TESTTMP/intercept_after_rename.py << EOF
24 > import os 24 > import os
25 > import signal
26 > from mercurial import extensions, util 25 > from mercurial import extensions, util
26 > from mercurial.testing import ps_util
27 > 27 >
28 > def extsetup(ui): 28 > def extsetup(ui):
29 > def close(orig, *args, **kwargs): 29 > def close(orig, *args, **kwargs):
30 > path = util.normpath(args[0]._atomictempfile__name) 30 > path = util.normpath(args[0]._atomictempfile__name)
31 > r = orig(*args, **kwargs) 31 > r = orig(*args, **kwargs)
32 > if path.endswith(b'/.hg/store/data/file.i'): 32 > if path.endswith(b'/.hg/store/data/file.i'):
33 > os.kill(os.getpid(), signal.SIGKILL) 33 > ps_util.kill(os.getpid())
34 > return r 34 > return r
35 > extensions.wrapfunction(util.atomictempfile, 'close', close) 35 > extensions.wrapfunction(util.atomictempfile, 'close', close)
36 > def extsetup(ui): 36 > def extsetup(ui):
37 > def rename(orig, src, dest, *args, **kwargs): 37 > def rename(orig, src, dest, *args, **kwargs):
38 > path = util.normpath(dest) 38 > path = util.normpath(dest)
39 > r = orig(src, dest, *args, **kwargs) 39 > r = orig(src, dest, *args, **kwargs)
40 > if path.endswith(b'data/file.i'): 40 > if path.endswith(b'data/file.i'):
41 > os.kill(os.getpid(), signal.SIGKILL) 41 > ps_util.kill(os.getpid())
42 > return r 42 > return r
43 > extensions.wrapfunction(util, 'rename', rename) 43 > extensions.wrapfunction(util, 'rename', rename)
44 > EOF 44 > EOF
45 45
46 $ cat > $TESTTMP/killme.py << EOF 46 $ cat > $TESTTMP/killme.py << EOF
47 > import os 47 > import os
48 > import signal 48 > from mercurial.testing import ps_util
49 > 49 >
50 > def killme(ui, repo, hooktype, **kwargs): 50 > def killme(ui, repo, hooktype, **kwargs):
51 > os.kill(os.getpid(), signal.SIGKILL) 51 > ps_util.kill(os.getpid())
52 > EOF 52 > EOF
53 53
54 $ cat > $TESTTMP/reader_wait_split.py << EOF 54 $ cat > $TESTTMP/reader_wait_split.py << EOF
55 > import os 55 > import os
56 > import signal 56 > import signal