21207: Abort test runs with pytest.exit
authorBrett Smith <brett.smith@curii.com>
Mon, 6 May 2024 22:19:48 +0000 (18:19 -0400)
committerBrett Smith <brett.smith@curii.com>
Mon, 6 May 2024 22:19:48 +0000 (18:19 -0400)
This lets pytest better report the problem versus an un-handle-able
SIGKILL.

Arvados-DCO-1.1-Signed-off-by: Brett Smith <brett.smith@curii.com>

build/run-tests.sh
services/fuse/tests/integration_test.py
services/fuse/tests/mount_test_base.py

index eb3e906459f086adc618f14106fdb5592df6366c..42c7d1240c3592fb722c8e12d10bbf88817d8ae1 100755 (executable)
@@ -712,9 +712,9 @@ do_test_once() {
             fi
             python3 -m pytest ${testargs[$1]}
             result=$?
-            if [[ ${tries} < 3 && ${result} == 137 ]]
+            if [[ ${tries} < 3 && ${result} == 75 ]]
             then
-                printf '\n*****\n%s tests killed -- retrying\n*****\n\n' "$1"
+                printf '\n*****\n%s tests exited TEMPFAIL -- retrying\n*****\n\n' "$1"
                 continue
             else
                 break
index ae1b58ad4755178f7653dbc9e31650e0d352e3c3..fa7bed7472d603ed46e27e5af149e1bccf8cd288 100644 (file)
@@ -16,6 +16,8 @@ import sys
 import tempfile
 import unittest
 
+import pytest
+
 from . import run_test_server
 
 @atexit.register
@@ -93,7 +95,7 @@ class IntegrationTest(unittest.TestCase):
                     if self.mount and self.mount.llfuse_thread.is_alive():
                         logging.warning("IntegrationTest.mount:"
                                             " llfuse thread still alive after umount"
-                                            " -- killing test suite to avoid deadlock")
-                        os.kill(os.getpid(), signal.SIGKILL)
+                                            " -- ending test suite to avoid deadlock")
+                        pytest.exit("llfuse thread outlived test", os.EX_TEMPFAIL)
             return wrapper
         return decorator
index 6e493905244cd89ce3bdbdd8aeaba3308dc69672..c7ba4d4fdadc94bbc7394029bce7dd4db30cc9a5 100644 (file)
@@ -19,6 +19,8 @@ import threading
 import time
 import unittest
 
+import pytest
+
 from . import run_test_server
 from .integration_test import workerPool
 
@@ -105,8 +107,8 @@ class MountTestBase(unittest.TestCase):
             if self.llfuse_thread.is_alive():
                 logger.warning("MountTestBase.tearDown():"
                                " llfuse thread still alive 60s after umount"
-                               " -- exiting with SIGKILL")
-                os.kill(os.getpid(), signal.SIGKILL)
+                               " -- ending test suite to avoid deadlock")
+                pytest.exit("llfuse thread outlived test", os.EX_TEMPFAIL)
             waited = time.time() - t0
             if waited > 0.1:
                 logger.warning("MountTestBase.tearDown(): waited %f s for llfuse thread to end", waited)