]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: reorganize the TEST-52 a bit 19416/head
authorFrantisek Sumsal <frantisek@sumsal.cz>
Sun, 25 Apr 2021 18:57:27 +0000 (20:57 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 26 Apr 2021 17:24:47 +0000 (19:24 +0200)
test/TEST-52-HONORFIRSTSHUTDOWN/Makefile [changed from file to symlink]
test/TEST-52-HONORFIRSTSHUTDOWN/fini.sh [deleted file]
test/TEST-52-HONORFIRSTSHUTDOWN/test.sh
test/testsuite-52.units/test-honor-first-shutdown.service [moved from test/units/test-honor-first-shutdown.service with 72% similarity]
test/testsuite-52.units/test-honor-first-shutdown.sh [moved from test/units/test-honor-first-shutdown.sh with 100% similarity]
test/units/testsuite-52.service [moved from test/testsuite-52.units/testsuite-52.service with 51% similarity]
test/units/testsuite-52.sh [moved from test/testsuite-52.units/testsuite-52.sh with 57% similarity]

deleted file mode 100644 (file)
index 71487d707608f24b6fa8d7d6c0cd1fe6371ff543..0000000000000000000000000000000000000000
+++ /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
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..e9f93b1104cd21161bfe11fb1b3b534ce2ae82b5
--- /dev/null
@@ -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 (executable)
index 993ada0..0000000
+++ /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
index 3bcf1b8c9ea3a4aa3e62ecef824d4f82907c2a22..41c7e91917c560d25c13dc388190809007e3750e 100755 (executable)
@@ -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)
similarity index 72%
rename from test/units/test-honor-first-shutdown.service
rename to test/testsuite-52.units/test-honor-first-shutdown.service
index 3170f979e258ecb4fc3c5c0a07a04efab6487c1b..3b6927c0d13ddd31587c265c4de602de8cbc8d16 100644 (file)
@@ -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
 
similarity index 51%
rename from test/testsuite-52.units/testsuite-52.service
rename to test/units/testsuite-52.service
index 93f847f0445beaf71db3bd29f2f518324758131d..bab540773a5a24cacff42c9371e35fee51ea8988 100644 (file)
@@ -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
similarity index 57%
rename from test/testsuite-52.units/testsuite-52.sh
rename to test/units/testsuite-52.sh
index e10bf561105d400d52dd90426c631048c9920aa4..ea133dbaadf6a0fefb677882e1bea92b0225744a 100755 (executable)
@@ -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