From: Petr Špaček Date: Tue, 13 Oct 2020 10:53:07 +0000 (+0200) Subject: tests: improve process cleanup after config tests X-Git-Tag: v5.2.0~6^2~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=677aa078d7a97c4b83bb95feeecd0d073b333552;p=thirdparty%2Fknot-resolver.git tests: improve process cleanup after config tests Previously exit trap executed command "kill -9" even if there were no leftover processes and this lead to clutter in logs because kill complained about missing arguments. As a bonus the cleanup routine now prints information about leftover processes. --- diff --git a/scripts/test-config.sh b/scripts/test-config.sh index 3ae6c3aae..695e5182a 100755 --- a/scripts/test-config.sh +++ b/scripts/test-config.sh @@ -13,8 +13,13 @@ TEST_DIR="$(dirname ${TEST_FILE})" TMP_RUNDIR="$(mktemp -d)" function finish { - kill -s 9 $(jobs -p) || : - rm -rf "${TMP_RUNDIR}" + if [[ "$(jobs -p)" != "" ]] + then + echo "SIGKILLing leftover processes:" + jobs -l + kill -s SIGKILL $(jobs -p) + fi + rm -rf "${TMP_RUNDIR}" } trap finish EXIT