From 58ab8c5e12a37bf7ccb97351244eea51dd781f19 Mon Sep 17 00:00:00 2001 From: Dan Bungert Date: Fri, 26 Aug 2022 10:52:05 -0600 Subject: [PATCH] runtests: use trap to ensure backgroun proc killed --- scripts/runtests.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/runtests.sh b/scripts/runtests.sh index cb53a39c..2541ff6c 100755 --- a/scripts/runtests.sh +++ b/scripts/runtests.sh @@ -239,20 +239,18 @@ if [ "${RELEASE%.*}" -ge 20 ]; then port=50321 LANG=C.UTF-8 python3 -m system_setup.cmd.server --dry-run --tcp-port=$port & subiquity_pid=$! + trap "kill $subiquity_pid" EXIT next_time=3 until [ $next_time -eq 0 ] || [ ! -z "$(ss -Hlt sport = $port)" ]; do sleep $(( next_time-- )) done if [ $next_time -eq 0 ]; then echo "Timeout reached before Subiquity TCP socket started listening" - kill $subiquity_pid || true exit 1 fi scripts/test-system-setup-loopback-only.py --port "$port" --debug - kill -- "$subiquity_pid" || true - # Test system_setup autoinstall. for mode in "" "-full" "-no-shutdown"; do clean