diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2018-12-22 22:16:03 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2018-12-22 22:16:03 +0000 |
commit | f6869581d44bd6e4bc8cad169451a9ad46169a4d (patch) | |
tree | 3bc2415ab97081a68d16de4a245f3725b05774b1 /tests/detach-sleeping.test | |
parent | fa35f3e87de2854475d176ccdcce7a19191a0d34 (diff) | |
download | strace-f6869581d44bd6e4bc8cad169451a9ad46169a4d.tar.gz |
strace: terminate itself if interrupted by a signal
* strace.c (terminate): Terminate itself if interrupted by a signal.
* NEWS: Mention this change.
* tests/detach-running.test: Check it.
* tests/detach-sleeping.test: Likewise.
* tests/detach-stopped.test: Likewise.
Diffstat (limited to 'tests/detach-sleeping.test')
-rwxr-xr-x | tests/detach-sleeping.test | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/detach-sleeping.test b/tests/detach-sleeping.test index 6b09d0220..ff2eed72a 100755 --- a/tests/detach-sleeping.test +++ b/tests/detach-sleeping.test @@ -15,6 +15,12 @@ run_prog_skip_if_failed \ check_prog sleep +trap - TERM +sleep $TIMEOUT_DURATION & +kill -TERM $! +wait $! +expected_rc=$? + set -e ../set_ptracer_any sleep $((2*$TIMEOUT_DURATION)) > "$LOG" & @@ -45,14 +51,19 @@ while ! grep -F "Process $tracee_pid attached" "$LOG" > /dev/null; do $SLEEP_A_BIT done -kill -INT $! -wait $! +kill -TERM $! +wait $! && rc=0 || rc=$? grep -F "Process $tracee_pid detached" "$LOG" > /dev/null || { cleanup dump_log_and_fail_with "$STRACE -p failed to detach" } +[ "$rc" = "$expected_rc" ] || { + cleanup + dump_log_and_fail_with "$STRACE -p failed to terminate itself" +} + if [ -f /proc/self/status ]; then $SLEEP_A_BIT test -d /proc/$tracee_pid || { |