diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2021-04-25 20:57:27 +0200 |
---|---|---|
committer | Frantisek Sumsal <frantisek@sumsal.cz> | 2021-04-26 19:24:47 +0200 |
commit | 9abef4b1b4a57bf8f440770efe7c13dcf9032367 (patch) | |
tree | 5ef5d2d7671554c8c0608330429792d365eb0687 /test/TEST-52-HONORFIRSTSHUTDOWN | |
parent | test: add a couple of hooks for the check_result_*() functions (diff) | |
download | systemd-9abef4b1b4a57bf8f440770efe7c13dcf9032367.tar.xz systemd-9abef4b1b4a57bf8f440770efe7c13dcf9032367.zip |
test: reorganize the TEST-52 a bit
Diffstat (limited to 'test/TEST-52-HONORFIRSTSHUTDOWN')
l---------[-rw-r--r--] | test/TEST-52-HONORFIRSTSHUTDOWN/Makefile | 15 | ||||
-rwxr-xr-x | test/TEST-52-HONORFIRSTSHUTDOWN/fini.sh | 10 | ||||
-rwxr-xr-x | test/TEST-52-HONORFIRSTSHUTDOWN/test.sh | 8 |
3 files changed, 8 insertions, 25 deletions
diff --git a/test/TEST-52-HONORFIRSTSHUTDOWN/Makefile b/test/TEST-52-HONORFIRSTSHUTDOWN/Makefile index 71487d7076..e9f93b1104 100644..120000 --- a/test/TEST-52-HONORFIRSTSHUTDOWN/Makefile +++ b/test/TEST-52-HONORFIRSTSHUTDOWN/Makefile @@ -1,14 +1 @@ -all setup run clean clean-again: - @TEST_BASE_DIR=../ ./test.sh --$@ - -# finish option is used to run checks that can only be run outside of -# the test execution. Example case, honor first shutdown, proof is obtained -# from the console output as the image shuts down. This does not show up in -# the journal so the output from the do_test is captured in a file in /tmp. -# Without the use of finish the test will still pass because if it fails -# the test will loop and will be terminated via a command timeout. -# This just provides concrete confirmation. -finish: - @TEST_BASE_DIR=../ ./fini.sh --$@ - -.PHONY: all setup run clean clean-again finish +../TEST-01-BASIC/Makefile
\ No newline at end of file diff --git a/test/TEST-52-HONORFIRSTSHUTDOWN/fini.sh b/test/TEST-52-HONORFIRSTSHUTDOWN/fini.sh deleted file mode 100755 index 993ada020e..0000000000 --- a/test/TEST-52-HONORFIRSTSHUTDOWN/fini.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -TEST_DESCRIPTION="test honor first shutdown" - -if grep -q "Shutdown is already active. Skipping emergency action request" /tmp/honorfirstshutdown.log; then - echo "$TEST_DESCRIPTION [pass]" - exit 0 -else - echo "$TEST_DESCRIPTION [fail]" - exit 1 -fi diff --git a/test/TEST-52-HONORFIRSTSHUTDOWN/test.sh b/test/TEST-52-HONORFIRSTSHUTDOWN/test.sh index 3bcf1b8c9e..41c7e91917 100755 --- a/test/TEST-52-HONORFIRSTSHUTDOWN/test.sh +++ b/test/TEST-52-HONORFIRSTSHUTDOWN/test.sh @@ -18,4 +18,10 @@ NSPAWN_TIMEOUT=20 # only found from the console during the poweroff. rm -f /tmp/honorfirstshutdown.log >/dev/null -do_test "$@" 52 >/tmp/honorfirstshutdown.log +check_result_nspawn_hook() { + grep -q "Shutdown is already active. Skipping emergency action request" /tmp/honorfirstshutdown.log +} + +# Note: don't use a pipe in the following expression, as it breaks the trap +# handlers we have defined in test/test-functions. +do_test "$@" > >(tee /tmp/honorfirstshutdown.log) |