]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Enhance regrtest get_signal_name(): support shell exit code (#117647)
authorVictor Stinner <vstinner@python.org>
Mon, 8 Apr 2024 17:16:43 +0000 (19:16 +0200)
committerGitHub <noreply@github.com>
Mon, 8 Apr 2024 17:16:43 +0000 (17:16 +0000)
Lib/test/libregrtest/utils.py
Lib/test/test_regrtest.py

index 837f73b28b40184c42c9fde62beb6d0ba9c14749..791f996127ea58aa8b1e3c31a8c8f52672b2ae3c 100644 (file)
@@ -698,6 +698,14 @@ def get_signal_name(exitcode):
         except ValueError:
             pass
 
+    # Shell exit code (ex: WASI build)
+    if 128 < exitcode < 256:
+        signum = exitcode - 128
+        try:
+            return signal.Signals(signum).name
+        except ValueError:
+            pass
+
     try:
         return WINDOWS_STATUS[exitcode]
     except KeyError:
index d222b3803fdba75d44e50d5dfcc27b3000617975..809abd7e92d65fd58ba5fa8eee9ce3f82bbe0f70 100644 (file)
@@ -2291,6 +2291,7 @@ class TestUtils(unittest.TestCase):
         for exitcode, expected in (
             (-int(signal.SIGINT), 'SIGINT'),
             (-int(signal.SIGSEGV), 'SIGSEGV'),
+            (128 + int(signal.SIGABRT), 'SIGABRT'),
             (3221225477, "STATUS_ACCESS_VIOLATION"),
             (0xC00000FD, "STATUS_STACK_OVERFLOW"),
         ):