changeset 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 625cf9621551
children 629ecced55a6
files tests/test-fncache.t tests/test-transaction-rollback-on-revlog-split.t
diffstat 2 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-fncache.t	Sat Oct 12 16:06:37 2024 -0400
+++ b/tests/test-fncache.t	Sat Oct 12 16:35:03 2024 -0400
@@ -304,7 +304,7 @@
 
   $ cat > ../exceptionext.py <<EOF
   > import os
-  > import signal
+  > from mercurial.testing import ps_util
   > from mercurial import (
   >   commands,
   >   error,
@@ -316,7 +316,7 @@
   > def trwrapper(orig, self, *args, **kwargs):
   >     tr = orig(self, *args, **kwargs)
   >     def fail(tr):
-  >         os.kill(os.getpid(), signal.SIGKILL)
+  >         ps_util.kill(os.getpid())
   >     # zzz prefix to ensure it sorted after store.write
   >     tr.addfinalize(b'zzz-forcefails', fail)
   >     return tr
--- a/tests/test-transaction-rollback-on-revlog-split.t	Sat Oct 12 16:06:37 2024 -0400
+++ b/tests/test-transaction-rollback-on-revlog-split.t	Sat Oct 12 16:35:03 2024 -0400
@@ -8,29 +8,29 @@
 
   $ cat > $TESTTMP/intercept_before_rename.py << EOF
   > import os
-  > import signal
   > from mercurial import extensions, util
+  > from mercurial.testing import ps_util
   > 
   > def extsetup(ui):
   >     def rename(orig, src, dest, *args, **kwargs):
   >         path = util.normpath(dest)
   >         if path.endswith(b'data/file.i'):
-  >             os.kill(os.getpid(), signal.SIGKILL)
+  >             ps_util.kill(os.getpid())
   >         return orig(src, dest, *args, **kwargs)
   >     extensions.wrapfunction(util, 'rename', rename)
   > EOF
 
   $ cat > $TESTTMP/intercept_after_rename.py << EOF
   > import os
-  > import signal
   > from mercurial import extensions, util
+  > from mercurial.testing import ps_util
   > 
   > def extsetup(ui):
   >     def close(orig, *args, **kwargs):
   >         path = util.normpath(args[0]._atomictempfile__name)
   >         r = orig(*args, **kwargs)
   >         if path.endswith(b'/.hg/store/data/file.i'):
-  >             os.kill(os.getpid(), signal.SIGKILL)
+  >             ps_util.kill(os.getpid())
   >         return r
   >     extensions.wrapfunction(util.atomictempfile, 'close', close)
   > def extsetup(ui):
@@ -38,17 +38,17 @@
   >         path = util.normpath(dest)
   >         r = orig(src, dest, *args, **kwargs)
   >         if path.endswith(b'data/file.i'):
-  >             os.kill(os.getpid(), signal.SIGKILL)
+  >             ps_util.kill(os.getpid())
   >         return r
   >     extensions.wrapfunction(util, 'rename', rename)
   > EOF
 
   $ cat > $TESTTMP/killme.py << EOF
   > import os
-  > import signal
+  > from mercurial.testing import ps_util
   > 
   > def killme(ui, repo, hooktype, **kwargs):
-  >     os.kill(os.getpid(), signal.SIGKILL)
+  >     ps_util.kill(os.getpid())
   > EOF
 
   $ cat > $TESTTMP/reader_wait_split.py << EOF