Check that traced process still exists and is in a right state
after strace detached from it.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
grep -F "Process $tracee_pid detached" $LOG > /dev/null ||
{ cat $LOG; cleanup; fail_ 'strace -p failed to detach'; }
+$SLEEP_A_BIT
+test -d /proc/$tracee_pid ||
+ { cat $LOG; cleanup; fail_ 'tracee died after detach'; }
+grep '^State:.*R (running)' </proc/$tracee_pid/status > /dev/null ||
+ { cat $LOG
+ grep '^State:' </proc/$tracee_pid/status
+ cleanup
+ fail_ 'tracee is not running after detach'
+ }
+
cleanup
exit 0
grep -F "Process $tracee_pid detached" $LOG > /dev/null ||
{ cat $LOG; cleanup; fail_ 'strace -p failed to detach'; }
+$SLEEP_A_BIT
+test -d /proc/$tracee_pid ||
+ { cat $LOG; cleanup; fail_ 'tracee died after detach'; }
+grep '^State:.*S (sleeping)' </proc/$tracee_pid/status > /dev/null ||
+ { cat $LOG
+ grep '^State:' </proc/$tracee_pid/status
+ cleanup
+ fail_ 'tracee is not sleeping after detach'
+ }
+
cleanup
exit 0
grep -F "Process $tracee_pid detached" $LOG > /dev/null ||
{ cat $LOG; cleanup; fail_ 'strace -p failed to detach'; }
+$SLEEP_A_BIT
+test -d /proc/$tracee_pid ||
+ { cat $LOG; cleanup; fail_ 'tracee died after detach'; }
+grep '^State:.*T (stopped)' </proc/$tracee_pid/status > /dev/null ||
+ { cat $LOG
+ grep '^State:' </proc/$tracee_pid/status
+ cleanup
+ fail_ 'tracee is not group-stopped after detach'
+ }
+
cleanup
exit 0