test: make sure to reset state before starting integration tests

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-12-13 12:34:41 +01:00
parent 8a59e79c09
commit 4962ed9f33
45 changed files with 49 additions and 0 deletions

View File

@ -1899,6 +1899,9 @@ test_setup() {
}
test_run() {
mount_initdir
rm -f "$initdir"/{testok,failed,skipped}
if [ -z "$TEST_NO_QEMU" ]; then
if run_qemu "$1"; then
check_result_qemu || return 1

View File

@ -3,5 +3,6 @@ Description=TEST-01-BASIC
After=multi-user.target
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=sh -e -x -c 'systemctl --state=failed --no-legend --no-pager >/failed ; systemctl daemon-reload ; echo OK >/testok'
Type=oneshot

View File

@ -3,5 +3,6 @@ Description=TEST-02-CRYPTSETUP
After=multi-user.target
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=sh -x -c 'systemctl --state=failed --no-legend --no-pager >/failed ; echo OK > /testok'
Type=oneshot

View File

@ -3,5 +3,6 @@ Description=TEST-03-JOBS
After=multi-user.target
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -2,5 +2,6 @@
Description=TEST-04-JOURNAL
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -2,5 +2,6 @@
Description=TEST-05-RLIMITS
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -5,5 +5,6 @@ Requires=load-systemd-test-module.service
After=load-systemd-test-module.service
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -2,5 +2,6 @@
Description=TEST-07-ISSUE-1981
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -2,5 +2,6 @@
Description=TEST-08-ISSUE-2730
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=sh -x -c 'mount -o remount,rw /dev/sda1 && echo OK >/testok; systemctl poweroff'
Type=oneshot

View File

@ -2,6 +2,7 @@
Description=TEST-09-ISSUE-2691
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=sh -c '>/testok'
ExecStop=sh -c 'kill -SEGV $$$$'
Type=oneshot

View File

@ -2,5 +2,6 @@
Description=TEST-10-ISSUE-2467
[Service]
ExecStartPre=rm -f /failed /testok
Type=oneshot
ExecStart=sh -e -x -c 'rm -f /tmp/nonexistent; systemctl start test10.socket; printf x >test.file; socat -t20 OPEN:test.file UNIX-CONNECT:/run/test.ctl; >/testok'

View File

@ -2,5 +2,6 @@
Description=TEST-11-ISSUE-3166
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -3,5 +3,6 @@ Description=TEST-12-ISSUE-3171
After=multi-user.target
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -2,5 +2,6 @@
Description=TEST-13-NSPAWN-SMOKE
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -2,6 +2,7 @@
Description=TEST-14-MACHINE-ID
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
ExecStart=/bin/sh -e -x -c 'systemctl --state=failed --no-legend --no-pager >/failed ; echo OK >/testok'
Type=oneshot

View File

@ -2,5 +2,6 @@
Description=TEST-15-DROPIN
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -12,6 +12,7 @@ Wants=fail-runtime.service
StopWhenUnneeded=yes
[Service]
ExecStartPre=rm -f /failed /testok
Type=simple
TimeoutStartSec=infinity
ExecStartPre=/usr/lib/systemd/tests/testdata/units/%N.sh

View File

@ -2,5 +2,6 @@
Description=TEST-17-UDEV-WANTS
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -2,5 +2,6 @@
Description=TEST-18-FAILUREACTION
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -2,5 +2,6 @@
Description=TEST-19-DELEGATE
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -4,6 +4,7 @@ Before=getty-pre.target
Wants=getty-pre.target
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot
NotifyAccess=all

View File

@ -5,6 +5,7 @@ Before=getty-pre.target
Wants=getty-pre.target
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot
StandardOutput=tty

View File

@ -2,5 +2,6 @@
Description=TEST-23-TYPE-EXEC
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -2,5 +2,6 @@
Description=TEST-24-UNIT-TESTS
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -6,6 +6,9 @@ NPROC=$(nproc)
MAX_QUEUE_SIZE=${NPROC:-2}
IFS=$'\n' TEST_LIST=($(ls /usr/lib/systemd/tests/test-*))
# reset state
rm /failed-tests /skipped-tests /skipped
# Check & report test results
# Arguments:
# $1: test path

View File

@ -2,5 +2,6 @@
Description=TEST-25-IMPORT
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -2,5 +2,6 @@
Description=TEST-26-SETENV
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -2,5 +2,6 @@
Description=TEST-27-STDOUTFILE
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -5,5 +5,6 @@ Wants=specifier-j-wants.service
After=specifier-j-wants.service
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=true
Type=oneshot

View File

@ -2,5 +2,6 @@
Description=TEST-29-UDEV-ID_RENAMING
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -2,5 +2,6 @@
Description=TEST-30-ONCLOCKCHANGE
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -2,5 +2,6 @@
Description=TEST-31-DEVICE-ENUMERATION
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -2,6 +2,7 @@
Description=TEST-32-OOMPOLICY
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot
MemoryAccounting=yes

View File

@ -2,5 +2,6 @@
Description=TEST-33-CLEAN-UNIT
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -2,5 +2,6 @@
Description=TEST-34-DYNAMICUSERMIGRATE
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -2,5 +2,6 @@
Description=TEST-36-NUMAPOLICY
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -2,5 +2,6 @@
Description=TEST-37-RUNTIMEDIRECTORYPRESERVE
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -2,5 +2,6 @@
Description=TEST-39-EXECRELOAD
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -2,5 +2,6 @@
Description=TEST-40-EXEC-COMMAND-EX
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -2,5 +2,6 @@
Description=TEST-41-ONESHOT-RESTART
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -4,5 +4,6 @@ Before=getty-pre.target
Wants=getty-pre.target
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -4,5 +4,6 @@ After=systemd-logind.service user@4711.service
Wants=user@4711.service
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -6,6 +6,7 @@ Wants=systemd-journald@foobar.socket systemd-journald-varlink@foobar.socket
After=systemd-journald@foobar.socket systemd-journald-varlink@foobar.socket
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot
LogTarget=foobar

View File

@ -4,6 +4,7 @@ Before=getty-pre.target
Wants=getty-pre.target
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot
NotifyAccess=all

View File

@ -2,5 +2,6 @@
Description=TEST-47-ISSUE-14566
[Service]
ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot