From 324bfc4032a0e6c580d07324c40b5acda8f28392 Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Sat, 14 Mar 2020 16:12:17 +0000 Subject: [PATCH] Exit status 256+signum is actually baked in to ksh While #10121 did fix the signal numbers for FreeBSD/Darwin, it incorrectly changed the expected encoding of exit status for commands that exited on a signal. The encoding 256+signum is a feature of the shell. Only the signal numbers themselves are platform-dependent. Always use the encoding 256+signum when checking exit status for signal exits. Signed-off-by: Ryan Moeller --- tests/test-runner/include/logapi.shlib | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/tests/test-runner/include/logapi.shlib b/tests/test-runner/include/logapi.shlib index 86a345b7a38b..334a04532cb9 100644 --- a/tests/test-runner/include/logapi.shlib +++ b/tests/test-runner/include/logapi.shlib @@ -165,26 +165,20 @@ function log_mustnot_expect (( $? != 0 )) && log_fail } -# Exit status encoding is platform-dependent +# Signal numbers are platform-dependent case $(uname) in Darwin|FreeBSD) - EXIT_SIGNAL=128 SIGBUS=10 SIGSEGV=11 ;; -illumos) - EXIT_SIGNAL=256 - SIGBUS=7 - SIGSEGV=11 - ;; -Linux|*) - EXIT_SIGNAL=128 +illumos|Linux|*) SIGBUS=7 SIGSEGV=11 ;; esac EXIT_SUCCESS=0 EXIT_NOTFOUND=127 +EXIT_SIGNAL=256 EXIT_SIGBUS=$((EXIT_SIGNAL + SIGBUS)) EXIT_SIGSEGV=$((EXIT_SIGNAL + SIGSEGV))