summaryrefslogtreecommitdiff
path: root/tests/misc/timeout.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/misc/timeout.sh')
-rwxr-xr-xtests/misc/timeout.sh12
1 files changed, 4 insertions, 8 deletions
diff --git a/tests/misc/timeout.sh b/tests/misc/timeout.sh
index dcee6d7ce..208c954c5 100755
--- a/tests/misc/timeout.sh
+++ b/tests/misc/timeout.sh
@@ -30,23 +30,19 @@ timeout 1d true || fail=1
timeout 0 true || fail=1
# exit status propagation
-timeout 10 sh -c 'exit 2'
-test $? = 2 || fail=1
+returns_ 2 timeout 10 sh -c 'exit 2' || fail=1
# timeout
-timeout .1 sleep 10
-test $? = 124 || fail=1
+returns_ 124 timeout .1 sleep 10 || fail=1
# exit status propagation even on timeout
-timeout --preserve-status .1 sleep 10
# exit status should be 128+TERM
-test $? = 124 && fail=1
+returns_ 124 timeout --preserve-status .1 sleep 10 && fail=1
# kill delay. Note once the initial timeout triggers,
# the exit status will be 124 even if the command
# exits on its own accord.
-timeout -s0 -k1 .1 sleep 10
-test $? = 124 && fail=1
+returns_ 124 timeout -s0 -k1 .1 sleep 10 && fail=1
# Ensure 'timeout' is immune to parent's SIGCHLD handler
# Use a subshell and an exec to work around a bug in FreeBSD 5.0 /bin/sh.