From a7502f2707421cb350b6b6ff8a39460ae5c5b477 Mon Sep 17 00:00:00 2001 From: Ilya Leoshkevich Date: Tue, 6 Apr 2021 22:13:46 +0200 Subject: [PATCH] vmtest: fix error reporting S50-run-tests uses -e, which means that it immediately exits on test failures without writing /exitcode. Fix by temporarily turning -e off. Another issue is that $? in S50-run-tests is not quoted, which causes the random value from the host to be taken (in practice always 0), so fix that as well. Finally, this fix has a positive side effect - QEMU no longer hangs when tests fail. This is because rcS (generated by mkrootfs.sh) also uses -e and immediately exits, if one of the scripts that it calls fails, without calling S99-poweroff. Example output after the fix: Summary: 53/184 PASSED, 5 SKIPPED, 1 FAILED + exitstatus=1 + set -e + echo 1 + chmod 644 /exitstatus + for path in /etc/rcS.d/S* + '[' -x /etc/rcS.d/S99-poweroff ']' + /etc/rcS.d/S99-poweroff travis_fold:start:shutdown Shutdown starting pid 232, tty '': '/sbin/swapoff -a' starting pid 233, tty '': '/bin/umount -a -r' [ 45.909033] EXT4-fs (vda): re-mounted. Opts: (null) The system is going down NOW! Sent SIGTERM to all processes Sent SIGKILL to all processes Requesting system poweroff [ 48.932007] ACPI: Preparing to enter system sleep state S5 [ 48.932785] reboot: Power down Tests exit status: 1 travis_fold:end:shutdown Signed-off-by: Ilya Leoshkevich --- travis-ci/vmtest/run.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/travis-ci/vmtest/run.sh b/travis-ci/vmtest/run.sh index 5c5a803..ec22d3e 100755 --- a/travis-ci/vmtest/run.sh +++ b/travis-ci/vmtest/run.sh @@ -415,8 +415,8 @@ set -eux echo 'Running setup commands' %s -%s -echo $? > /exitstatus +set +e; %s; exitstatus=\$?; set -e +echo \$exitstatus > /exitstatus chmod 644 /exitstatus" "${setup_envvars}" "${setup_cmd}") fi