# 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
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 ||
return 0
}
-rm -f "$LOG"
$STRACE -p $tracee_pid 2> "$LOG" &
while ! grep -F "Process $tracee_pid attached" "$LOG" > /dev/null; do
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'
}