summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Moeller <[email protected]>2020-03-17 12:49:58 -0400
committerGitHub <[email protected]>2020-03-17 09:49:58 -0700
commite0d3284bc95d3d6b6660e8881454caf367ce460b (patch)
tree205a77044de3604b817dcda70419ee5045970c11
parent4d32abaa874db06ec84aeefafa1354548f91d650 (diff)
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. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: John Kennedy <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Closes #10137
-rw-r--r--tests/test-runner/include/logapi.shlib12
1 files changed, 3 insertions, 9 deletions
diff --git a/tests/test-runner/include/logapi.shlib b/tests/test-runner/include/logapi.shlib
index 86a345b7a..334a04532 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))