From 2b5bfeb2a84b325e706c6b77f6fb012c2a7e69e8 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 11 Aug 2014 01:31:23 -0400 Subject: [PATCH] tests: fix shell errors in detach tests 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 | 1 + tests/detach-sleeping.test | 1 + tests/detach-stopped.test | 1 + 3 files changed, 3 insertions(+) diff --git a/tests/detach-running.test b/tests/detach-running.test index 16f552b5..e3b33f9c 100755 --- a/tests/detach-running.test +++ b/tests/detach-running.test @@ -24,6 +24,7 @@ cleanup() set +e kill $tracee_pid wait $tracee_pid 2> /dev/null + return 0 } rm -f $LOG diff --git a/tests/detach-sleeping.test b/tests/detach-sleeping.test index 92138b53..241d5157 100755 --- a/tests/detach-sleeping.test +++ b/tests/detach-sleeping.test @@ -25,6 +25,7 @@ cleanup() set +e kill $tracee_pid wait $tracee_pid 2> /dev/null + return 0 } rm -f $LOG diff --git a/tests/detach-stopped.test b/tests/detach-stopped.test index 81fd3031..88499bfc 100755 --- a/tests/detach-stopped.test +++ b/tests/detach-stopped.test @@ -27,6 +27,7 @@ cleanup() kill $tracee_pid kill -CONT $tracee_pid wait $tracee_pid 2> /dev/null + return 0 } rm -f $LOG -- 2.40.0