summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2016-01-14 14:21:53 +0000
committerPádraig Brady <P@draigBrady.com>2016-01-15 14:14:06 +0000
commit4c7d82f1f11a3e122befccde505a1dc4519a22e7 (patch)
tree5f3b7ef35f3d86b5c291c2a2ee05f9f3456b4137 /tests
parentb955a4fb6d503aa49242ea7d3addf528ae4bbe73 (diff)
downloadcoreutils-4c7d82f1f11a3e122befccde505a1dc4519a22e7.tar.xz
tests: simplify invalid signal determination for kill -l
* src/operand2sig.c (operand2sig): Add a detailed comment explaining why we validate even very large shell exit status values. * tests/misc/kill.sh: Add a test case for the ksh scheme. Simplify the INVALID signal number determination which also avoids a false failure on systems like FreeBSD 10 with incomplete signal list (caused by inaccurate NSIG).
Diffstat (limited to 'tests')
-rwxr-xr-xtests/misc/kill.sh11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/misc/kill.sh b/tests/misc/kill.sh
index 27d550ec8..779ce3e8f 100755
--- a/tests/misc/kill.sh
+++ b/tests/misc/kill.sh
@@ -49,10 +49,15 @@ env kill -t TERM HUP || fail=1
SIGTERM=$(env kill -l HUP TERM | tail -n1) || fail=1
test $(env kill -l "$SIGTERM") = TERM || fail=1
+# Verify we only consider the lower "signal" bits,
+# to support ksh which just adds 256 to the signal value
+STD_TERM_STATUS=$(expr "$SIGTERM" + 128)
+KSH_TERM_STATUS=$(expr "$SIGTERM" + 256)
+test $(env kill -l $STD_TERM_STATUS $KSH_TERM_STATUS | uniq) = TERM || fail=1
+
# Verify invalid signal spec is diagnosed
-SIGINVAL=$(env kill -t | tail -n1 | cut -f1 -d' ')
-SIGINVAL=$(expr "$SIGINVAL" + 1)
-returns_ 1 env kill -l "$SIGINVAL" 0 || fail=1
+returns_ 1 env kill -l -1 || fail=1
+returns_ 1 env kill -l -1 0 || fail=1
returns_ 1 env kill -l INVALID TERM || fail=1
Exit $fail