From: Frantisek Sumsal Date: Sun, 25 Apr 2021 18:57:27 +0000 (+0200) Subject: test: reorganize the TEST-52 a bit X-Git-Tag: v249-rc1~341^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F19416%2Fhead;p=thirdparty%2Fsystemd.git test: reorganize the TEST-52 a bit --- diff --git a/test/TEST-52-HONORFIRSTSHUTDOWN/Makefile b/test/TEST-52-HONORFIRSTSHUTDOWN/Makefile deleted file mode 100644 index 71487d70760..00000000000 --- a/test/TEST-52-HONORFIRSTSHUTDOWN/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -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 diff --git a/test/TEST-52-HONORFIRSTSHUTDOWN/Makefile b/test/TEST-52-HONORFIRSTSHUTDOWN/Makefile new file mode 120000 index 00000000000..e9f93b1104c --- /dev/null +++ b/test/TEST-52-HONORFIRSTSHUTDOWN/Makefile @@ -0,0 +1 @@ +../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 993ada020eb..00000000000 --- 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 3bcf1b8c9ea..41c7e91917c 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) diff --git a/test/units/test-honor-first-shutdown.service b/test/testsuite-52.units/test-honor-first-shutdown.service similarity index 72% rename from test/units/test-honor-first-shutdown.service rename to test/testsuite-52.units/test-honor-first-shutdown.service index 3170f979e25..3b6927c0d13 100644 --- a/test/units/test-honor-first-shutdown.service +++ b/test/testsuite-52.units/test-honor-first-shutdown.service @@ -3,7 +3,7 @@ Description=Honor First Shutdown feature After=multi-user.target [Service] -ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh +ExecStart=/usr/lib/systemd/tests/testdata/testsuite-52.units/%N.sh ExecStop=sh -c 'kill -KILL $MAINPID' FailureAction=reboot diff --git a/test/units/test-honor-first-shutdown.sh b/test/testsuite-52.units/test-honor-first-shutdown.sh similarity index 100% rename from test/units/test-honor-first-shutdown.sh rename to test/testsuite-52.units/test-honor-first-shutdown.sh diff --git a/test/testsuite-52.units/testsuite-52.service b/test/units/testsuite-52.service similarity index 51% rename from test/testsuite-52.units/testsuite-52.service rename to test/units/testsuite-52.service index 93f847f0445..bab540773a5 100644 --- a/test/testsuite-52.units/testsuite-52.service +++ b/test/units/testsuite-52.service @@ -2,5 +2,5 @@ Description=Testsuite service [Service] -ExecStart=/usr/lib/systemd/tests/testdata/%N.units/%N.sh +ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh Type=oneshot diff --git a/test/testsuite-52.units/testsuite-52.sh b/test/units/testsuite-52.sh similarity index 57% rename from test/testsuite-52.units/testsuite-52.sh rename to test/units/testsuite-52.sh index e10bf561105..ea133dbaadf 100755 --- a/test/testsuite-52.units/testsuite-52.sh +++ b/test/units/testsuite-52.sh @@ -2,11 +2,6 @@ set -ex set -o pipefail -if ! test -x /usr/lib/systemd/tests/testdata/units/test-honor-first-shutdown.sh ; then - echo "honor-first-shutdown script not found - FAIL" >/testok - exit 0 -fi - systemd-analyze log-level debug systemd-analyze log-target console