diff options
| author | Mark Wielaard <[email protected]> | 2021-09-09 18:50:54 +0200 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2021-09-09 18:50:54 +0200 |
| commit | fdbf472a7b0120ec66b546a3067d67bbf8e17f8a (patch) | |
| tree | 8318c7d0de6995289c02385f0bb299ea54d66abe /tests/debuginfod-subr.sh | |
| parent | c1a67b39611f3e396121cf5333b0e77b537e9741 (diff) | |
tests: Cleanup error handling and don't share cache between servers/client
There were still three tests that shared a cache between the servers
and client that queried those servers. Give them all separate caches.
Also the error handler for debuginfod tests wasn't called when a
command inside a function failed. Since testrun is a function, there
would be no metrics or error log files listed if the testrun command
failed. Making it hard to see what went wrong. Fix this by using
set -o errtrace
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'tests/debuginfod-subr.sh')
| -rwxr-xr-x | tests/debuginfod-subr.sh | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/debuginfod-subr.sh b/tests/debuginfod-subr.sh index 7d238436..c21b7b8a 100755 --- a/tests/debuginfod-subr.sh +++ b/tests/debuginfod-subr.sh @@ -16,6 +16,9 @@ # sourced from run-debuginfod-*.sh tests (must be bash scripts) +# We trap ERR and like commands that fail in function to also trap +set -o errtrace + . $srcdir/test-subr.sh # includes set -e type curl 2>/dev/null || (echo "need curl"; exit 77) @@ -27,14 +30,14 @@ echo "zstd=$zstd bsdtar=`bsdtar --version`" cleanup() { - if [ $PID1 -ne 0 ]; then kill $PID1; wait $PID1; fi - if [ $PID2 -ne 0 ]; then kill $PID2; wait $PID2; fi + if [ $PID1 -ne 0 ]; then kill $PID1 || : ; wait $PID1 || :; fi + if [ $PID2 -ne 0 ]; then kill $PID2 || : ; wait $PID2 || :; fi rm -rf F R D L Z ${PWD}/foobar ${PWD}/mocktree ${PWD}/.client_cache* ${PWD}/tmp* exit_cleanup } -# clean up trash if we were aborted early -trap cleanup 0 1 2 3 5 9 15 +# clean up trash if we exit +trap cleanup 0 errfiles_list= err() { @@ -42,7 +45,7 @@ err() { for port in $PORT1 $PORT2 do echo ERROR REPORT $port metrics - curl -s http://127.0.0.1:$port/metrics + curl -s http://127.0.0.1:$port/metrics || : echo done for x in $errfiles_list @@ -51,6 +54,7 @@ err() { cat $x echo done + cleanup false # trigger set -e } trap err ERR |
