]>
Commit | Line | Data |
---|---|---|
a10f5d05 MB |
1 | #!/bin/bash |
2 | set -e | |
8b3d4ff0 | 3 | |
a10f5d05 MB |
4 | TEST_REQUIRE_INSTALL_TESTS=0 |
5 | TEST_DESCRIPTION="testing honor first shutdown" | |
a10f5d05 MB |
6 | TEST_NO_QEMU=1 |
7 | ||
8b3d4ff0 MB |
8 | # shellcheck source=test/test-functions |
9 | . "${TEST_BASE_DIR:?}/test-functions" | |
10 | ||
11 | # Using timeout because if the test fails it can loop. | |
a10f5d05 MB |
12 | # The reason is because the poweroff executed by end.service |
13 | # could turn into a reboot if the test fails. | |
14 | NSPAWN_TIMEOUT=20 | |
15 | ||
8b3d4ff0 MB |
16 | # Remove this file if it exists. This is used along with |
17 | # the make target "finish". Since concrete confirmation is | |
a10f5d05 MB |
18 | # only found from the console during the poweroff. |
19 | rm -f /tmp/honorfirstshutdown.log >/dev/null | |
20 | ||
8b3d4ff0 MB |
21 | check_result_nspawn_hook() { |
22 | grep -q "Shutdown is already active. Skipping emergency action request" /tmp/honorfirstshutdown.log | |
23 | } | |
24 | ||
25 | # Note: don't use a pipe in the following expression, as it breaks the trap | |
26 | # handlers we have defined in test/test-functions. | |
27 | do_test "$@" > >(tee /tmp/honorfirstshutdown.log) |