From: Brett Smith Date: Mon, 6 May 2024 22:19:48 +0000 (-0400) Subject: 21207: Abort test runs with pytest.exit X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/dcdaf7450fb66da2bc904a21f29660ac75e5864a?hp=6e3b86c8e0c90d71a7920d595e1087ffe465130e 21207: Abort test runs with pytest.exit This lets pytest better report the problem versus an un-handle-able SIGKILL. Arvados-DCO-1.1-Signed-off-by: Brett Smith --- diff --git a/build/run-tests.sh b/build/run-tests.sh index eb3e906459..42c7d1240c 100755 --- a/build/run-tests.sh +++ b/build/run-tests.sh @@ -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 diff --git a/services/fuse/tests/integration_test.py b/services/fuse/tests/integration_test.py index ae1b58ad47..fa7bed7472 100644 --- a/services/fuse/tests/integration_test.py +++ b/services/fuse/tests/integration_test.py @@ -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 diff --git a/services/fuse/tests/mount_test_base.py b/services/fuse/tests/mount_test_base.py index 6e49390524..c7ba4d4fda 100644 --- a/services/fuse/tests/mount_test_base.py +++ b/services/fuse/tests/mount_test_base.py @@ -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)