]> granicus.if.org Git - strace/commitdiff
tests: disable /proc based checks when /proc is not mounted
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 19 Jun 2013 14:57:05 +0000 (14:57 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 19 Jun 2013 14:57:05 +0000 (14:57 +0000)
* tests/detach-running: Disable /proc based checks when
/proc/self/status is not available.
* tests/detach-sleeping: Likewise.
* tests/detach-stopped: Likewise.

tests/detach-running
tests/detach-sleeping
tests/detach-stopped

index 8c084d05a33f8b5ef46226063e17ca9fba9db9cd..16f552b589c3df236cf54611fb043ab5cd2e2a91 100755 (executable)
@@ -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
index 8127541fe88cdb2d514455289ea85b3eac2a2b86..92138b53b50e795cf9e5cc08108b05c37bac2841 100755 (executable)
@@ -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
index ba0d82b37bf9d154a4a50188ed797f5a07491d11..81fd30314daf41f27d2a16ff72529841e9ea0b12 100755 (executable)
@@ -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