diff options
author | Victor Stinner <vstinner@python.org> | 2024-04-08 17:16:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-08 17:16:43 (GMT) |
commit | ed785c08993467461711c56eb5e6f88331062cca (patch) | |
tree | 4015e4cc644228de919c41b5f6abb4855e130896 | |
parent | 775912a51d6847b0e4fe415fa91f2e0b06a3c43c (diff) | |
download | cpython-ed785c08993467461711c56eb5e6f88331062cca.zip cpython-ed785c08993467461711c56eb5e6f88331062cca.tar.gz cpython-ed785c08993467461711c56eb5e6f88331062cca.tar.bz2 |
Enhance regrtest get_signal_name(): support shell exit code (#117647)
-rw-r--r-- | Lib/test/libregrtest/utils.py | 8 | ||||
-rw-r--r-- | Lib/test/test_regrtest.py | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/libregrtest/utils.py b/Lib/test/libregrtest/utils.py index 837f73b..791f996 100644 --- a/Lib/test/libregrtest/utils.py +++ b/Lib/test/libregrtest/utils.py @@ -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: diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py index d222b38..809abd7 100644 --- a/Lib/test/test_regrtest.py +++ b/Lib/test/test_regrtest.py @@ -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"), ): |