]> granicus.if.org Git - strace/commitdiff
tests/detach-{running,sleeping,stopped}: check post-detach state
authorDenys Vlasenko <dvlasenk@redhat.com>
Wed, 19 Jun 2013 14:37:24 +0000 (16:37 +0200)
committerDenys Vlasenko <dvlasenk@redhat.com>
Wed, 19 Jun 2013 14:37:24 +0000 (16:37 +0200)
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>
tests/detach-running
tests/detach-sleeping
tests/detach-stopped

index 1132e0f59344fbd213637f19834e9aada6f961e0..8c084d05a33f8b5ef46226063e17ca9fba9db9cd 100755 (executable)
@@ -41,5 +41,15 @@ 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'
+       }
+
 cleanup
 exit 0
index 28ad663eaf2fc435bab0244f8a59c7d5804755ff..8127541fe88cdb2d514455289ea85b3eac2a2b86 100755 (executable)
@@ -42,5 +42,15 @@ 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'
+       }
+
 cleanup
 exit 0
index d2b8a31d11fb77fb1f6ebbdbc8d0d1bfe9c93715..ba0d82b37bf9d154a4a50188ed797f5a07491d11 100755 (executable)
@@ -50,5 +50,15 @@ 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'
+       }
+
 cleanup
 exit 0