Enhance regrtest get_signal_name(): support shell exit code (#117647)

This commit is contained in:
Victor Stinner 2024-04-08 19:16:43 +02:00 committed by GitHub
parent 775912a51d
commit ed785c0899
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View 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:

View 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"),
):