]> granicus.if.org Git - strace/commitdiff
tests: fix shell errors in detach tests
authorMike Frysinger <vapier@gentoo.org>
Mon, 11 Aug 2014 05:31:23 +0000 (01:31 -0400)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 11 Aug 2014 17:22:38 +0000 (17:22 +0000)
The current detach test code does:
set -e
...
cleanup() {
set +e
kill ...
wait ...
}
...
cleanup
exit 0

The problem is that while `set -e` is disabled for the body of the
cleanup function, it isn't necessarily disabled in the caller scope.
So if the return value of the cleanup function (`wait` in this case)
is non-zero, the script ends up failing overall.

Add an explicit return 0 to the cleanup function so that we don't kill
the overall test pipeline.

* tests/detach-running.test (cleanup): Add return 0.
* tests/detach-sleeping.test (cleanup): Likewise.
* tests/detach-stopped.test (cleanup): Likewise.

tests/detach-running.test
tests/detach-sleeping.test
tests/detach-stopped.test

index 16f552b589c3df236cf54611fb043ab5cd2e2a91..e3b33f9c1dffee9312e407eeaeaef756e930abda 100755 (executable)
@@ -24,6 +24,7 @@ cleanup()
        set +e
        kill $tracee_pid
        wait $tracee_pid 2> /dev/null
+       return 0
 }
 
 rm -f $LOG
index 92138b53b50e795cf9e5cc08108b05c37bac2841..241d51576e206b13c950dc3cee5d2cc250c77370 100755 (executable)
@@ -25,6 +25,7 @@ cleanup()
        set +e
        kill $tracee_pid
        wait $tracee_pid 2> /dev/null
+       return 0
 }
 
 rm -f $LOG
index 81fd30314daf41f27d2a16ff72529841e9ea0b12..88499bfcfef59e501168ab994e26819643cb4bdb 100755 (executable)
@@ -27,6 +27,7 @@ cleanup()
        kill $tracee_pid
        kill -CONT $tracee_pid
        wait $tracee_pid 2> /dev/null
+       return 0
 }
 
 rm -f $LOG