tests: disable /proc based checks when /proc is not mounted

* tests/detach-running: Disable /proc based checks when
/proc/self/status is not available.
* tests/detach-sleeping: Likewise.
* tests/detach-stopped: Likewise.
This commit is contained in:
Дмитрий Левин 2013-06-19 14:57:05 +00:00
parent a815185d55
commit 0d7c3653c5
3 changed files with 30 additions and 24 deletions

View File

@ -41,15 +41,17 @@ wait $!
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

View File

@ -42,15 +42,17 @@ wait $!
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

View File

@ -50,15 +50,17 @@ wait $!
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