diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/timeout.test | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/timeout.test b/tests/timeout.test index 189b592a..18f93790 100644 --- a/tests/timeout.test +++ b/tests/timeout.test @@ -18,3 +18,18 @@ testcmd "exit 1" '.1 false ; echo $?' '1\n' '' '' testcmd "--preserve-status" '--preserve-status .1 sleep 100 ; echo $?' '143\n' '' '' testcmd "--preserve-status killed" '--preserve-status -s 9 .1 sleep 100 ; echo $?' '137\n' '' '' + +# There's another special case where if the subprocess catches our timeout +# signal and exits, we need to report that as a timeout (unless overridden). +cat > loop.sh <<EOF +#!/bin/sh +trap "exit 3" SIGTERM +while true; do + : +done +EOF +chmod a+x loop.sh +testcmd "trap-and-exit" '1 ./loop.sh ; echo $?' '124\n' '' '' +testcmd "trap-and-exit --preserve-status" \ + '--preserve-status 1 ./loop.sh ; echo $?' '3\n' '' '' +rm loop.sh |