[LTP] [PATCH v3 3/4] tst_test.sh: Fix _tst_cleanup_timer() on set -e
Petr Vorel
pvorel@suse.cz
Mon Aug 8 12:10:18 CEST 2022
If test exits on time (i.e. no timeout) kill in _tst_cleanup_timer()
have nothing to kill therefore following wait exits 143.
set -e (or #!/bin/sh -e or set -o errexit) quits on any non-zero exit code,
harden _tst_cleanup_timer() to be able to be used on scripts with it.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
testcases/lib/tst_test.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index 356af0106..1d2bf06cc 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -518,7 +518,7 @@ _tst_cleanup_timer()
{
if [ -n "$_tst_setup_timer_pid" ]; then
kill -TERM $_tst_setup_timer_pid 2>/dev/null
- wait $_tst_setup_timer_pid 2>/dev/null
+ wait $_tst_setup_timer_pid 2>/dev/null || true
fi
}
--
2.37.1
More information about the ltp
mailing list