From: Frantisek Sumsal Date: Fri, 29 Sep 2023 20:07:12 +0000 (+0200) Subject: test: shutdown the machine on fail after soft-reboot X-Git-Tag: v255-rc1~378^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=47f6baccfe9e375e8d96d3368b44fa13b317c08f;p=thirdparty%2Fsystemd.git test: shutdown the machine on fail after soft-reboot Since the soft-reboot drops the enqueued end.service, we won't shutdown the test VM if the test fails and have to wait for the watchdog to kill us (which may take quite a long time). Let's just forcibly kill the machine instead to save CI resources. --- diff --git a/test/units/testsuite-82.sh b/test/units/testsuite-82.sh index b6b6615997a..71ea7d5b5ea 100755 --- a/test/units/testsuite-82.sh +++ b/test/units/testsuite-82.sh @@ -3,6 +3,19 @@ set -ex set -o pipefail +at_exit() { + # Since the soft-reboot drops the enqueued end.service, we won't shutdown + # the test VM if the test fails and have to wait for the watchdog to kill + # us (which may take quite a long time). Let's just forcibly kill the machine + # instead to save CI resources. + if [[ $? -ne 0 ]]; then + echo >&2 "Test failed, shutting down the machine..." + systemctl poweroff -ff + fi +} + +trap at_exit EXIT + systemd-analyze log-level debug export SYSTEMD_LOG_LEVEL=debug