summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2015-12-15 00:30:47 +0000
committerPádraig Brady <P@draigBrady.com>2015-12-15 17:07:39 +0000
commitd3ddf7bce45ac73c9d5180bed5ad2f10192b28f3 (patch)
treee0844efb93bf87f57b5488ee9dd88fc88ce06d16 /tests
parent872c0df857d322f8119c64853d042f17c1913c3a (diff)
downloadcoreutils-d3ddf7bce45ac73c9d5180bed5ad2f10192b28f3.tar.xz
tests: improve kill tests
* tests/misc/kill.sh: - verify kill -[lt] support multiple parameters. - verify kill -[lt] fail with (some) invalid parameters. - Use returns_1 ... || fail=1, rather than ... && fail=1.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/misc/kill.sh28
1 files changed, 17 insertions, 11 deletions
diff --git a/tests/misc/kill.sh b/tests/misc/kill.sh
index 05035684b..68998ce8a 100755
--- a/tests/misc/kill.sh
+++ b/tests/misc/kill.sh
@@ -20,33 +20,39 @@
print_ver_ kill
# params required
-env kill && fail=1
-env kill -TERM && fail=1
+returns_ 1 env kill || fail=1
+returns_ 1 env kill -TERM || fail=1
# Invalid combinations
-env kill -l -l && fail=1
-env kill -l -t && fail=1
-env kill -l -s 1 && fail=1
-env kill -t -s 1 && fail=1
+returns_ 1 env kill -l -l || fail=1
+returns_ 1 env kill -l -t || fail=1
+returns_ 1 env kill -l -s 1 || fail=1
+returns_ 1 env kill -t -s 1 || fail=1
# signal sending
-env kill -0 no_pid && fail=1
+returns_ 1 env kill -0 no_pid || fail=1
env kill -0 $$ || fail=1
env kill -s0 $$ || fail=1
env kill -n0 $$ || fail=1 # bash compat
env kill -CONT $$ || fail=1
env kill -Cont $$ || fail=1
-env kill -cont $$ && fail=1
+returns_ 1 env kill -cont $$ || fail=1
env kill -0 -1 || fail=1 # to group
# table listing
env kill -l || fail=1
env kill -t || fail=1
env kill -L || fail=1 # bash compat
-env kill -t TERM || fail=1
+env kill -t TERM HUP || fail=1
-# Verify name to signal number and vice versa
-SIGTERM=$(env kill -l TERM) || fail=1
+# Verify (multi) name to signal number and vice versa
+SIGTERM=$(env kill -l HUP TERM | tail -n1) || fail=1
test $(env kill -l "$SIGTERM") = 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 INVALID TERM || fail=1
+
Exit $fail