runtests: ensure message shown at end

The second `trap ... EXIT` registration meant that the first one, the
one repsonsible for providing a clear PASS / FAIL at the end, was not
being shown.
This commit is contained in:
Dan Bungert 2022-09-28 10:02:04 -06:00
parent a434bdd311
commit 2928ab88ce
1 changed files with 8 additions and 2 deletions

View File

@ -7,6 +7,7 @@ export PYTHONTRACEMALLOC=3
RELEASE=$(lsb_release -rs) RELEASE=$(lsb_release -rs)
tmpdir=$(mktemp -d) tmpdir=$(mktemp -d)
subiquity_pid=""
validate () { validate () {
mode="install" mode="install"
@ -127,13 +128,18 @@ clean () {
on_exit () { on_exit () {
ec=$? ec=$?
set +x # show PASS/FAIL in the last lines of output set +xe # show PASS/FAIL in the last lines of output
if [[ $ec = 0 ]] ; then if [[ $ec = 0 ]] ; then
echo 'Runtests all PASSED' echo 'Runtests all PASSED'
else else
echo 'Runtests FAILURE' echo 'Runtests FAILURE'
echo "Output from the last run is at $tmpdir" echo "Output from the last run is at $tmpdir"
fi fi
if [ -n "$subiquity_pid" ] ; then
kill "$subiquity_pid"
fi
exit $ec exit $ec
} }
@ -141,6 +147,7 @@ trap on_exit EXIT
tty=$(tty) || tty=/dev/console tty=$(tty) || tty=/dev/console
export SUBIQUITY_REPLAY_TIMESCALE=100 export SUBIQUITY_REPLAY_TIMESCALE=100
for answers in examples/answers*.yaml; do for answers in examples/answers*.yaml; do
if echo $answers|grep -vq system-setup; then if echo $answers|grep -vq system-setup; then
config=$(sed -n 's/^#machine-config: \(.*\)/\1/p' $answers || true) config=$(sed -n 's/^#machine-config: \(.*\)/\1/p' $answers || true)
@ -239,7 +246,6 @@ 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-- ))