From d3ddf7bce45ac73c9d5180bed5ad2f10192b28f3 Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Tue, 15 Dec 2015 00:30:47 +0000 Subject: 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. --- tests/misc/kill.sh | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'tests') 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 -- cgit v1.2.3-70-g09d2