]> granicus.if.org Git - strace/blobdiff - tests/detach-running.test
tests: extend TEST_NETLINK_OBJECT macro
[strace] / tests / detach-running.test
index b77dc51cee8f87914b2b1547ccf05ec3dc7d3395..ba5ffbf4c79ed520c5f84440d1e1865a66ec6e33 100755 (executable)
@@ -3,6 +3,7 @@
 # Ensure that strace can detach from running processes.
 #
 # Copyright (c) 2013-2015 Dmitry V. Levin <ldv@altlinux.org>
+# Copyright (c) 2014-2017 The strace developers.
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -36,7 +37,7 @@ check_prog sleep
 
 set -e
 
-./set_ptracer_any sh -c "echo > $LOG; while :; do :; done" > /dev/null &
+../set_ptracer_any sh -c "echo > $LOG; while :; do :; done" > /dev/null &
 
 while ! [ -s "$LOG" ]; do
        kill -0 $! 2> /dev/null ||
@@ -54,7 +55,6 @@ cleanup()
        return 0
 }
 
-rm -f "$LOG"
 $STRACE -p $tracee_pid 2> "$LOG" &
 
 while ! grep -F "Process $tracee_pid attached" "$LOG" > /dev/null; do
@@ -79,8 +79,8 @@ if [ -f /proc/self/status ]; then
                cleanup
                dump_log_and_fail_with 'tracee died after detach'
        }
-       grep '^State:.*R (running)' < /proc/$tracee_pid/status > /dev/null || {
-               grep '^State:' < /proc/$tracee_pid/status
+       grep_pid_status "$tracee_pid" '^State:.*R (running)' > /dev/null || {
+               grep_pid_status "$tracee_pid" '^State:'
                cleanup
                dump_log_and_fail_with 'tracee is not running after detach'
        }