tests: use the cross platform `SIGKILL` function
authorMatt Harbison <matt_harbison@yahoo.com>
Sat, 12 Oct 2024 16:35:03 -0400
changeset 51997 3f70ea5bcaeb
parent 51996 625cf9621551
child 51998 629ecced55a6
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`.
tests/test-fncache.t
tests/test-transaction-rollback-on-revlog-split.t
--- 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