runtests: use trap to ensure backgroun proc killed
This commit is contained in:
parent
8bd0ea11ad
commit
58ab8c5e12
|
@ -239,20 +239,18 @@ if [ "${RELEASE%.*}" -ge 20 ]; then
|
||||||
port=50321
|
port=50321
|
||||||
LANG=C.UTF-8 python3 -m system_setup.cmd.server --dry-run --tcp-port=$port &
|
LANG=C.UTF-8 python3 -m system_setup.cmd.server --dry-run --tcp-port=$port &
|
||||||
subiquity_pid=$!
|
subiquity_pid=$!
|
||||||
|
trap "kill $subiquity_pid" EXIT
|
||||||
next_time=3
|
next_time=3
|
||||||
until [ $next_time -eq 0 ] || [ ! -z "$(ss -Hlt sport = $port)" ]; do
|
until [ $next_time -eq 0 ] || [ ! -z "$(ss -Hlt sport = $port)" ]; do
|
||||||
sleep $(( next_time-- ))
|
sleep $(( next_time-- ))
|
||||||
done
|
done
|
||||||
if [ $next_time -eq 0 ]; then
|
if [ $next_time -eq 0 ]; then
|
||||||
echo "Timeout reached before Subiquity TCP socket started listening"
|
echo "Timeout reached before Subiquity TCP socket started listening"
|
||||||
kill $subiquity_pid || true
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
scripts/test-system-setup-loopback-only.py --port "$port" --debug
|
scripts/test-system-setup-loopback-only.py --port "$port" --debug
|
||||||
|
|
||||||
kill -- "$subiquity_pid" || true
|
|
||||||
|
|
||||||
# Test system_setup autoinstall.
|
# Test system_setup autoinstall.
|
||||||
for mode in "" "-full" "-no-shutdown"; do
|
for mode in "" "-full" "-no-shutdown"; do
|
||||||
clean
|
clean
|
||||||
|
|
Loading…
Reference in New Issue