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'
+if [ -f /proc/self/status ]; then
+ $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'
}
+fi
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'
+if [ -f /proc/self/status ]; then
+ $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'
}
+fi
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'
+if [ -f /proc/self/status ]; then
+ $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'
}
+fi
cleanup
exit 0