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 disabled in the caller scope.  So if the
return value of the cleanup func (`wait` in this case) is non-zero,
the script ends up failing overall.

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

* tests/detach-running.test (cleanup): Add return 0.
(tests/detach-sleeping.test): Likewise.
(tests/detach-stopped.test): 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 16f552b..e3b33f9 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 92138b5..241d515 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 81fd303..88499bf 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.0.0


------------------------------------------------------------------------------
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to