]> git.ipfire.org Git - thirdparty/systemd.git/blob - test/TEST-52-HONORFIRSTSHUTDOWN/test.sh
tests: add spdx headers to scripts and Makefiles
[thirdparty/systemd.git] / test / TEST-52-HONORFIRSTSHUTDOWN / test.sh
1 #!/bin/bash
2 # SPDX-License-Identifier: LGPL-2.1-or-later
3 set -e
4
5 TEST_REQUIRE_INSTALL_TESTS=0
6 TEST_DESCRIPTION="testing honor first shutdown"
7 TEST_NO_QEMU=1
8
9 # shellcheck source=test/test-functions
10 . "${TEST_BASE_DIR:?}/test-functions"
11
12 # Using timeout because if the test fails it can loop.
13 # The reason is because the poweroff executed by end.service
14 # could turn into a reboot if the test fails.
15 NSPAWN_TIMEOUT=60
16
17 # Remove this file if it exists. This is used along with
18 # the make target "finish". Since concrete confirmation is
19 # only found from the console during the poweroff.
20 rm -f /tmp/honorfirstshutdown.log >/dev/null
21
22 check_result_nspawn_hook() {
23 grep -q "Shutdown is already active. Skipping emergency action request" /tmp/honorfirstshutdown.log
24 }
25
26 # Note: don't use a pipe in the following expression, as it breaks the trap
27 # handlers we have defined in test/test-functions.
28 do_test "$@" > >(tee /tmp/honorfirstshutdown.log)