1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-27 01:55:22 +03:00

test: reorganize the TEST-52 a bit

This commit is contained in:
Frantisek Sumsal 2021-04-25 20:57:27 +02:00
parent 6695c41c31
commit 9abef4b1b4
7 changed files with 10 additions and 32 deletions

View File

@ -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

View File

@ -0,0 +1 @@
../TEST-01-BASIC/Makefile

View File

@ -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

View File

@ -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)

View 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

View 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

View File

@ -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