summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2020-03-30 16:25:12 +0200
committerGitHub <noreply@github.com>2020-03-30 16:25:12 +0200
commit15529f5cea0ea60d1202994e5950a31e2b4916e7 (patch)
tree3e3122e3d851337fd3d9903a2547a1b4798864a3
parentci: turn off FuzzBuzz (diff)
parenttest: print test of name in output (diff)
downloadsystemd-15529f5cea0ea60d1202994e5950a31e2b4916e7.tar.xz
systemd-15529f5cea0ea60d1202994e5950a31e2b4916e7.zip
Merge pull request #14338 from keszybz/functional-test-rework
Functional test rework
-rw-r--r--meson.build27
-rwxr-xr-xsemaphoreci/semaphore-runner.sh2
-rw-r--r--src/partition/meson.build2
-rwxr-xr-xsrc/partition/test-repart.sh111
-rw-r--r--src/resolve/test-dns-packet.c4
-rw-r--r--src/shared/tests.c24
-rw-r--r--src/shared/tests.h2
-rw-r--r--src/test/test-bpf-firewall.c4
-rw-r--r--src/test/test-cgroup-mask.c4
-rw-r--r--src/test/test-cgroup-unit-default.c4
-rw-r--r--src/test/test-engine.c5
-rw-r--r--src/test/test-execute.c6
-rw-r--r--src/test/test-fileio.c16
-rw-r--r--src/test/test-journal-importer.c4
-rw-r--r--src/test/test-path.c2
-rw-r--r--src/test/test-sched-prio.c5
-rw-r--r--src/test/test-umount.c12
-rw-r--r--src/test/test-watch-pid.c5
-rw-r--r--test/README.testsuite6
-rw-r--r--test/TEST-01-BASIC/Makefile5
-rwxr-xr-xtest/TEST-01-BASIC/test.sh23
-rwxr-xr-xtest/TEST-02-CRYPTSETUP/test.sh33
-rwxr-xr-xtest/TEST-03-JOBS/test.sh34
-rwxr-xr-xtest/TEST-04-JOURNAL/test.sh39
-rwxr-xr-xtest/TEST-05-RLIMITS/test-rlimits.sh15
-rwxr-xr-xtest/TEST-05-RLIMITS/test.sh35
-rwxr-xr-xtest/TEST-06-SELINUX/test.sh50
-rwxr-xr-xtest/TEST-07-ISSUE-1981/test.sh30
-rwxr-xr-xtest/TEST-08-ISSUE-2730/test.sh54
-rwxr-xr-xtest/TEST-09-ISSUE-2691/test.sh30
-rwxr-xr-xtest/TEST-10-ISSUE-2467/test.sh43
-rwxr-xr-xtest/TEST-11-ISSUE-3166/test.sh56
-rwxr-xr-xtest/TEST-12-ISSUE-3171/test.sh83
l---------[-rw-r--r--]test/TEST-13-NSPAWN-SMOKE/Makefile11
-rwxr-xr-xtest/TEST-13-NSPAWN-SMOKE/test.sh178
-rwxr-xr-xtest/TEST-14-MACHINE-ID/test.sh63
-rwxr-xr-xtest/TEST-15-DROPIN/test.sh16
-rw-r--r--test/TEST-15-DROPIN/testsuite.service6
-rwxr-xr-xtest/TEST-16-EXTEND-TIMEOUT/test.sh28
-rw-r--r--test/TEST-16-EXTEND-TIMEOUT/testsuite.service18
-rwxr-xr-xtest/TEST-17-UDEV-WANTS/test.sh27
-rwxr-xr-xtest/TEST-18-FAILUREACTION/test.sh29
-rwxr-xr-xtest/TEST-19-DELEGATE/test.sh27
-rwxr-xr-xtest/TEST-20-MAINPIDGAMES/test.sh32
-rwxr-xr-xtest/TEST-21-SYSUSERS/test.sh2
-rwxr-xr-xtest/TEST-22-TMPFILES/test.sh26
-rwxr-xr-xtest/TEST-23-TYPE-EXEC/test.sh29
-rwxr-xr-xtest/TEST-24-UNIT-TESTS/test.sh80
-rwxr-xr-xtest/TEST-25-IMPORT/test.sh28
-rwxr-xr-xtest/TEST-26-SETENV/test.sh27
-rwxr-xr-xtest/TEST-27-STDOUTFILE/test.sh29
-rwxr-xr-xtest/TEST-28-PERCENTJ-WANTEDBY/test.sh50
-rwxr-xr-xtest/TEST-29-UDEV-ID_RENAMING/test.sh27
-rwxr-xr-xtest/TEST-30-ONCLOCKCHANGE/test.sh38
-rwxr-xr-xtest/TEST-31-DEVICE-ENUMERATION/test.sh27
-rwxr-xr-xtest/TEST-32-OOMPOLICY/test.sh29
-rwxr-xr-xtest/TEST-33-CLEAN-UNIT/test.sh29
-rwxr-xr-xtest/TEST-34-DYNAMICUSERMIGRATE/test.sh29
l---------test/TEST-35-NETWORK-GENERATOR/Makefile1
-rwxr-xr-xtest/TEST-35-NETWORK-GENERATOR/test.sh36
-rwxr-xr-xtest/TEST-36-NUMAPOLICY/test.sh30
-rwxr-xr-xtest/TEST-37-RUNTIMEDIRECTORYPRESERVE/test.sh29
-rwxr-xr-xtest/TEST-39-EXECRELOAD/test.sh31
-rwxr-xr-xtest/TEST-40-EXEC-COMMAND-EX/test.sh29
-rwxr-xr-xtest/TEST-41-ONESHOT-RESTART/test.sh28
-rwxr-xr-xtest/TEST-42-EXECSTOPPOST/test.sh44
-rwxr-xr-xtest/TEST-43-PRIVATEUSER-UNPRIV/test.sh43
-rwxr-xr-xtest/TEST-44-LOG-NAMESPACE/test.sh34
l---------test/TEST-45-REPART/Makefile1
-rwxr-xr-xtest/TEST-45-REPART/test.sh37
-rwxr-xr-xtest/TEST-45-REPART/testsuite.sh120
-rwxr-xr-xtest/TEST-46-HOMED/test.sh36
-rwxr-xr-xtest/TEST-47-ISSUE-14566/test.sh41
l---------test/basic.target1
-rwxr-xr-xtest/create-busybox-container (renamed from test/TEST-13-NSPAWN-SMOKE/create-busybox-container)0
l---------test/loopy2.service1
l---------test/loopy4.service1
-rw-r--r--test/meson.build275
-rwxr-xr-xtest/run-integration-tests.sh17
l---------test/shutdown.target1
l---------test/sockets.target1
l---------test/sysinit.target1
-rw-r--r--test/test-functions461
-rwxr-xr-xtest/test-network-generator-conversion.sh30
-rw-r--r--test/test-network-generator-conversion/test-01-dhcp.expected/91-default.network (renamed from test/TEST-35-NETWORK-GENERATOR/test-01-dhcp.expected/91-default.network)0
-rw-r--r--test/test-network-generator-conversion/test-01-dhcp.input (renamed from test/TEST-35-NETWORK-GENERATOR/test-01-dhcp.input)0
-rw-r--r--test/test-network-generator-conversion/test-02-bridge.expected/90-bridge99.netdev (renamed from test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/90-bridge99.netdev)0
-rw-r--r--test/test-network-generator-conversion/test-02-bridge.expected/90-bridge99.network (renamed from test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/90-bridge99.network)0
-rw-r--r--test/test-network-generator-conversion/test-02-bridge.expected/90-eth0.network (renamed from test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/90-eth0.network)0
-rw-r--r--test/test-network-generator-conversion/test-02-bridge.expected/90-eth1.network (renamed from test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/90-eth1.network)0
-rw-r--r--test/test-network-generator-conversion/test-02-bridge.input (renamed from test/TEST-35-NETWORK-GENERATOR/test-02-bridge.input)0
-rw-r--r--test/test-network-generator-conversion/test-03-issue-14319.expected/90-enp3s0.network (renamed from test/TEST-35-NETWORK-GENERATOR/test-03-issue-14319.expected/90-enp3s0.network)0
-rw-r--r--test/test-network-generator-conversion/test-03-issue-14319.input (renamed from test/TEST-35-NETWORK-GENERATOR/test-03-issue-14319.input)0
-rw-r--r--[l---------]test/test-path/basic.target23
-rw-r--r--[l---------]test/test-path/path-changed.service7
-rw-r--r--[l---------]test/test-path/path-directorynotempty.service7
-rw-r--r--[l---------]test/test-path/path-exists.service7
-rw-r--r--[l---------]test/test-path/path-existsglob.service7
-rw-r--r--[l---------]test/test-path/path-makedirectory.service7
-rw-r--r--[l---------]test/test-path/path-modified.service7
-rw-r--r--[l---------]test/test-path/paths.target13
-rw-r--r--[l---------]test/test-path/sysinit.target16
l---------test/testdata1
-rw-r--r--test/testsuite-04.units/forever-print-hola.service6
-rw-r--r--test/testsuite-06.units/hola.service6
-rw-r--r--test/testsuite-06.units/load-systemd-test-module.service14
-rw-r--r--test/testsuite-08.units/-.mount12
l---------test/testsuite-08.units/local-fs.target.wants/-.mount1
l---------test/testsuite-08.units/root.mount1
-rw-r--r--test/testsuite-08.units/systemd-remount-fs.service11
-rw-r--r--test/testsuite-10.units/test10.service6
-rw-r--r--test/testsuite-10.units/test10.socket2
-rw-r--r--test/testsuite-11.units/fail-on-restart.service9
-rwxr-xr-xtest/testsuite-16.units/extend-timeout.sh (renamed from test/TEST-16-EXTEND-TIMEOUT/extend_timeout_test_service.sh)18
-rw-r--r--test/testsuite-16.units/fail-runtime.service (renamed from test/TEST-16-EXTEND-TIMEOUT/testsuite-fail-runtime.service)5
-rw-r--r--test/testsuite-16.units/fail-start.service (renamed from test/TEST-16-EXTEND-TIMEOUT/testsuite-fail-start.service)4
-rw-r--r--test/testsuite-16.units/fail-stop.service (renamed from test/TEST-16-EXTEND-TIMEOUT/testsuite-fail-stop.service)5
-rw-r--r--test/testsuite-16.units/success-all.service (renamed from test/TEST-16-EXTEND-TIMEOUT/testsuite-success-all.service)4
-rw-r--r--test/testsuite-16.units/success-runtime.service (renamed from test/TEST-16-EXTEND-TIMEOUT/testsuite-success-runtime.service)4
-rw-r--r--test/testsuite-16.units/success-start.service (renamed from test/TEST-16-EXTEND-TIMEOUT/testsuite-success-start.service)5
-rw-r--r--test/testsuite-16.units/success-stop.service (renamed from test/TEST-16-EXTEND-TIMEOUT/testsuite-success-stop.service)5
-rw-r--r--test/testsuite-28.units/specifier-j-depends-wants.service7
-rw-r--r--test/testsuite-28.units/specifier-j-wants.service10
-rw-r--r--test/testsuite-28.units/testsuite-28-pre.service3
-rw-r--r--test/testsuite-30.units/systemd-timedated.service.d/watchdog.conf2
l---------test/timers.target1
-rw-r--r--test/units/a-conj.service (renamed from test/a-conj.service)0
-rw-r--r--test/units/a.service (renamed from test/a.service)0
-rw-r--r--test/units/autorelabel.service18
-rw-r--r--test/units/b.service (renamed from test/b.service)0
-rw-r--r--test/units/basic.target22
-rw-r--r--test/units/c.service (renamed from test/c.service)0
-rw-r--r--test/units/d.service (renamed from test/d.service)0
-rw-r--r--test/units/daughter.service (renamed from test/daughter.service)0
-rw-r--r--test/units/dml-discard-empty.service (renamed from test/dml-discard-empty.service)0
-rw-r--r--test/units/dml-discard-set-ml.service (renamed from test/dml-discard-set-ml.service)0
-rw-r--r--test/units/dml-discard.slice (renamed from test/dml-discard.slice)0
-rw-r--r--test/units/dml-override-empty.service (renamed from test/dml-override-empty.service)0
-rw-r--r--test/units/dml-override.slice (renamed from test/dml-override.slice)0
-rw-r--r--test/units/dml-passthrough-empty.service (renamed from test/dml-passthrough-empty.service)0
-rw-r--r--test/units/dml-passthrough-set-dml.service (renamed from test/dml-passthrough-set-dml.service)0
-rw-r--r--test/units/dml-passthrough-set-ml.service (renamed from test/dml-passthrough-set-ml.service)0
-rw-r--r--test/units/dml-passthrough.slice (renamed from test/dml-passthrough.slice)0
-rw-r--r--test/units/dml.slice (renamed from test/dml.slice)0
-rw-r--r--test/units/e.service (renamed from test/e.service)0
-rw-r--r--test/units/end.service (renamed from test/end.service)2
-rw-r--r--test/units/f.service (renamed from test/f.service)0
-rw-r--r--test/units/g.service (renamed from test/g.service)0
-rw-r--r--test/units/grandchild.service (renamed from test/grandchild.service)0
-rw-r--r--test/units/h.service (renamed from test/h.service)0
-rw-r--r--test/units/hello-after-sleep.target (renamed from test/hello-after-sleep.target)0
-rw-r--r--test/units/hello.service (renamed from test/hello.service)0
-rw-r--r--test/units/i.service (renamed from test/i.service)0
-rw-r--r--test/units/loopy.service (renamed from test/loopy.service)0
-rw-r--r--test/units/loopy.service.d/compat.conf (renamed from test/loopy.service.d/compat.conf)0
-rw-r--r--test/units/loopy2.service2
-rw-r--r--test/units/loopy3.service (renamed from test/loopy3.service)0
-rw-r--r--test/units/loopy4.service5
-rw-r--r--test/units/nomem.slice (renamed from test/nomem.slice)0
-rw-r--r--test/units/nomemleaf.service (renamed from test/nomemleaf.service)0
-rw-r--r--test/units/parent-deep.slice (renamed from test/parent-deep.slice)0
-rw-r--r--test/units/parent.slice (renamed from test/parent.slice)0
-rw-r--r--test/units/sched_idle_bad.service (renamed from test/sched_idle_bad.service)0
-rw-r--r--test/units/sched_idle_ok.service (renamed from test/sched_idle_ok.service)0
-rw-r--r--test/units/sched_rr_bad.service (renamed from test/sched_rr_bad.service)0
-rw-r--r--test/units/sched_rr_change.service (renamed from test/sched_rr_change.service)0
-rw-r--r--test/units/sched_rr_ok.service (renamed from test/sched_rr_ok.service)0
-rw-r--r--test/units/shutdown.target14
-rw-r--r--test/units/sleep.service (renamed from test/sleep.service)0
-rw-r--r--test/units/sockets.target12
-rw-r--r--test/units/son.service (renamed from test/son.service)0
-rw-r--r--test/units/sysinit.target15
-rw-r--r--test/units/testsuite-01.service8
-rw-r--r--test/units/testsuite-02.service8
-rw-r--r--test/units/testsuite-03.service8
-rwxr-xr-xtest/units/testsuite-03.sh (renamed from test/TEST-03-JOBS/test-jobs.sh)0
-rw-r--r--test/units/testsuite-04.service7
-rwxr-xr-xtest/units/testsuite-04.sh (renamed from test/TEST-04-JOURNAL/test-journal.sh)0
-rw-r--r--test/units/testsuite-05.service7
-rwxr-xr-xtest/units/testsuite-05.sh25
-rw-r--r--test/units/testsuite-06.service10
-rwxr-xr-xtest/units/testsuite-06.sh (renamed from test/TEST-06-SELINUX/test-selinux-checks.sh)7
-rw-r--r--test/units/testsuite-07.service7
-rwxr-xr-xtest/units/testsuite-07.sh (renamed from test/TEST-07-ISSUE-1981/test-segfault.sh)0
-rw-r--r--test/units/testsuite-08.service7
-rw-r--r--test/units/testsuite-09.service10
-rw-r--r--test/units/testsuite-10.service7
-rw-r--r--test/units/testsuite-11.service7
-rwxr-xr-xtest/units/testsuite-11.sh11
-rw-r--r--test/units/testsuite-12.service8
-rwxr-xr-xtest/units/testsuite-12.sh47
-rw-r--r--test/units/testsuite-13.service7
-rwxr-xr-xtest/units/testsuite-13.sh150
-rw-r--r--test/units/testsuite-14.service8
-rwxr-xr-xtest/units/testsuite-14.sh38
-rw-r--r--test/units/testsuite-15.service7
-rwxr-xr-xtest/units/testsuite-15.sh (renamed from test/TEST-15-DROPIN/test-dropin.sh)274
-rw-r--r--test/units/testsuite-16.service19
-rwxr-xr-xtest/units/testsuite-16.sh (renamed from test/TEST-16-EXTEND-TIMEOUT/assess.sh)2
-rw-r--r--test/units/testsuite-17.service7
-rwxr-xr-xtest/units/testsuite-17.sh (renamed from test/TEST-17-UDEV-WANTS/testsuite.sh)2
-rw-r--r--test/units/testsuite-18.service7
-rwxr-xr-xtest/units/testsuite-18.sh (renamed from test/TEST-18-FAILUREACTION/testsuite.sh)0
-rw-r--r--test/units/testsuite-19.service7
-rwxr-xr-xtest/units/testsuite-19.sh (renamed from test/TEST-19-DELEGATE/testsuite.sh)0
-rw-r--r--test/units/testsuite-20.service10
-rwxr-xr-xtest/units/testsuite-20.sh (renamed from test/TEST-20-MAINPIDGAMES/testsuite.sh)48
-rwxr-xr-xtest/units/testsuite-22.01.sh (renamed from test/TEST-22-TMPFILES/test-01.sh)0
-rwxr-xr-xtest/units/testsuite-22.02.sh (renamed from test/TEST-22-TMPFILES/test-02.sh)0
-rwxr-xr-xtest/units/testsuite-22.03.sh (renamed from test/TEST-22-TMPFILES/test-03.sh)0
-rwxr-xr-xtest/units/testsuite-22.04.sh (renamed from test/TEST-22-TMPFILES/test-04.sh)0
-rwxr-xr-xtest/units/testsuite-22.05.sh (renamed from test/TEST-22-TMPFILES/test-05.sh)0
-rwxr-xr-xtest/units/testsuite-22.06.sh (renamed from test/TEST-22-TMPFILES/test-06.sh)0
-rwxr-xr-xtest/units/testsuite-22.07.sh (renamed from test/TEST-22-TMPFILES/test-07.sh)0
-rwxr-xr-xtest/units/testsuite-22.08.sh (renamed from test/TEST-22-TMPFILES/test-08.sh)0
-rwxr-xr-xtest/units/testsuite-22.09.sh (renamed from test/TEST-22-TMPFILES/test-09.sh)0
-rw-r--r--test/units/testsuite-22.service (renamed from test/TEST-22-TMPFILES/testsuite.service)6
-rwxr-xr-xtest/units/testsuite-22.sh (renamed from test/TEST-22-TMPFILES/run-tmpfiles-tests.sh)4
-rw-r--r--test/units/testsuite-23.service7
-rwxr-xr-xtest/units/testsuite-23.sh (renamed from test/TEST-23-TYPE-EXEC/testsuite.sh)0
-rw-r--r--test/units/testsuite-24.service7
-rwxr-xr-xtest/units/testsuite-24.sh (renamed from test/TEST-24-UNIT-TESTS/testsuite.sh)15
-rw-r--r--test/units/testsuite-25.service7
-rwxr-xr-xtest/units/testsuite-25.sh (renamed from test/TEST-25-IMPORT/testsuite.sh)5
-rw-r--r--test/units/testsuite-26.service7
-rwxr-xr-xtest/units/testsuite-26.sh (renamed from test/TEST-26-SETENV/testsuite.sh)0
-rw-r--r--test/units/testsuite-27.service7
-rwxr-xr-xtest/units/testsuite-27.sh (renamed from test/TEST-27-STDOUTFILE/testsuite.sh)8
-rw-r--r--test/units/testsuite-28.service11
-rw-r--r--test/units/testsuite-29.service7
-rwxr-xr-xtest/units/testsuite-29.sh (renamed from test/TEST-29-UDEV-ID_RENAMING/testsuite.sh)0
-rw-r--r--test/units/testsuite-30.service7
-rwxr-xr-xtest/units/testsuite-30.sh (renamed from test/TEST-30-ONCLOCKCHANGE/testsuite.sh)0
-rw-r--r--test/units/testsuite-31.service7
-rwxr-xr-xtest/units/testsuite-31.sh (renamed from test/TEST-31-DEVICE-ENUMERATION/testsuite.sh)0
-rw-r--r--test/units/testsuite-32.service8
-rwxr-xr-xtest/units/testsuite-32.sh (renamed from test/TEST-32-OOMPOLICY/testsuite.sh)12
-rw-r--r--test/units/testsuite-33.service7
-rwxr-xr-xtest/units/testsuite-33.sh (renamed from test/TEST-33-CLEAN-UNIT/testsuite.sh)0
-rw-r--r--test/units/testsuite-34.service7
-rwxr-xr-xtest/units/testsuite-34.sh (renamed from test/TEST-34-DYNAMICUSERMIGRATE/testsuite.sh)0
-rw-r--r--test/units/testsuite-36.service7
-rwxr-xr-xtest/units/testsuite-36.sh (renamed from test/TEST-36-NUMAPOLICY/testsuite.sh)6
-rw-r--r--test/units/testsuite-37.service7
-rwxr-xr-xtest/units/testsuite-37.sh (renamed from test/TEST-37-RUNTIMEDIRECTORYPRESERVE/testsuite.sh)0
-rw-r--r--test/units/testsuite-39.service7
-rwxr-xr-x[-rw-r--r--]test/units/testsuite-39.sh (renamed from test/TEST-39-EXECRELOAD/testsuite.sh)0
-rw-r--r--test/units/testsuite-40.service7
-rwxr-xr-xtest/units/testsuite-40.sh (renamed from test/TEST-40-EXEC-COMMAND-EX/testsuite.sh)0
-rw-r--r--test/units/testsuite-41.service7
-rwxr-xr-xtest/units/testsuite-41.sh (renamed from test/TEST-41-ONESHOT-RESTART/testsuite.sh)4
-rw-r--r--test/units/testsuite-42.service9
-rwxr-xr-xtest/units/testsuite-42.sh (renamed from test/TEST-42-EXECSTOPPOST/testsuite.sh)0
-rw-r--r--test/units/testsuite-43.service9
-rwxr-xr-xtest/units/testsuite-43.sh (renamed from test/TEST-43-PRIVATEUSER-UNPRIV/testsuite.sh)0
-rw-r--r--test/units/testsuite-44.service12
-rwxr-xr-xtest/units/testsuite-44.sh (renamed from test/TEST-44-LOG-NAMESPACE/testsuite.sh)0
-rw-r--r--test/units/testsuite-46.service10
-rwxr-xr-xtest/units/testsuite-46.sh (renamed from test/TEST-46-HOMED/testsuite.sh)0
-rw-r--r--test/units/testsuite-47-repro.service7
-rwxr-xr-xtest/units/testsuite-47-repro.sh (renamed from test/TEST-47-ISSUE-14566/repro.sh)2
-rw-r--r--test/units/testsuite-47.service7
-rwxr-xr-xtest/units/testsuite-47.sh (renamed from test/TEST-47-ISSUE-14566/testsuite.sh)8
-rw-r--r--test/units/testsuite.target (renamed from test/testsuite.target)0
-rw-r--r--test/units/timers.target15
-rw-r--r--test/units/unit-.service.d/10-override.conf (renamed from test/unit-.service.d/10-override.conf)0
-rw-r--r--test/units/unit-with-.service.d/20-override.conf (renamed from test/unit-with-.service.d/20-override.conf)0
-rw-r--r--test/units/unit-with-multiple-.service.d/20-override.conf (renamed from test/unit-with-multiple-.service.d/20-override.conf)0
-rw-r--r--test/units/unit-with-multiple-.service.d/30-override.conf (renamed from test/unit-with-multiple-.service.d/30-override.conf)0
-rw-r--r--test/units/unit-with-multiple-dashes.service (renamed from test/unit-with-multiple-dashes.service)0
-rw-r--r--test/units/unit-with-multiple-dashes.service.d/10-override.conf (renamed from test/unit-with-multiple-dashes.service.d/10-override.conf)0
-rw-r--r--test/units/unstoppable.service (renamed from test/unstoppable.service)0
-rwxr-xr-xtools/meson-make-symlink.sh6
273 files changed, 1852 insertions, 2502 deletions
diff --git a/meson.build b/meson.build
index 5af7c112f1..fb90077563 100644
--- a/meson.build
+++ b/meson.build
@@ -49,9 +49,12 @@ fuzzer_build = want_ossfuzz or want_libfuzzer
#####################################################################
# Try to install the git pre-commit hook
-git_hook = run_command(join_paths(project_source_root, 'tools/add-git-hook.sh'))
-if git_hook.returncode() == 0
- message(git_hook.stdout().strip())
+add_git_hook_sh = find_program('tools/add-git-hook.sh', required : false)
+if add_git_hook_sh.found()
+ git_hook = run_command(add_git_hook_sh)
+ if git_hook.returncode() == 0
+ message(git_hook.stdout().strip())
+ endif
endif
#####################################################################
@@ -2503,7 +2506,7 @@ if conf.get('ENABLE_BINFMT') == 1
endif
if conf.get('ENABLE_REPART') == 1
- executable('systemd-repart',
+ exe = executable('systemd-repart',
systemd_repart_sources,
include_directories : includes,
link_with : [libshared],
@@ -2515,6 +2518,12 @@ if conf.get('ENABLE_REPART') == 1
install_rpath : rootlibexecdir,
install : true,
install_dir : rootbindir)
+
+ if want_tests != 'false'
+ test('test-repart',
+ test_repart_sh,
+ args : exe.full_path())
+ endif
endif
if conf.get('ENABLE_VCONSOLE') == 1
@@ -2959,13 +2968,20 @@ if conf.get('ENABLE_NETWORKD') == 1
install_dir : rootbindir)
public_programs += exe
- executable('systemd-network-generator',
+ exe = executable('systemd-network-generator',
network_generator_sources,
include_directories : includes,
link_with : [networkd_link_with],
install_rpath : rootlibexecdir,
install : true,
install_dir : rootlibexecdir)
+
+ if want_tests != 'false'
+ test('test-network-generator-conversion',
+ test_network_generator_conversion_sh,
+ # https://github.com/mesonbuild/meson/issues/2681
+ args : exe.full_path())
+ endif
endif
executable('systemd-sulogin-shell',
@@ -3467,6 +3483,7 @@ foreach tuple : [
['debug siphash'],
['valgrind', conf.get('VALGRIND') == 1],
['trace logging', conf.get('LOG_TRACE') == 1],
+ ['install tests', install_tests],
['link-udev-shared', get_option('link-udev-shared')],
['link-systemctl-shared', get_option('link-systemctl-shared')],
['link-networkd-shared', get_option('link-networkd-shared')],
diff --git a/semaphoreci/semaphore-runner.sh b/semaphoreci/semaphore-runner.sh
index 2bf8ce0d52..177fe77cda 100755
--- a/semaphoreci/semaphore-runner.sh
+++ b/semaphoreci/semaphore-runner.sh
@@ -17,7 +17,7 @@ PHASES=(${@:-SETUP RUN})
create_container() {
# create autopkgtest LXC image; this sometimes fails with "Unable to fetch
# GPG key from keyserver", so retry a few times
- for retry in $(seq 5); do
+ for retry in {1..5}; do
sudo lxc-create -n $CONTAINER -t download -- -d $DISTRO -r $RELEASE -a $ARCH --keyserver hkp://keyserver.ubuntu.com:80 && break
sleep $((retry*retry))
done
diff --git a/src/partition/meson.build b/src/partition/meson.build
index d0c111a473..3a75d5712d 100644
--- a/src/partition/meson.build
+++ b/src/partition/meson.build
@@ -3,3 +3,5 @@
systemd_repart_sources = files('''
repart.c
'''.split())
+
+test_repart_sh = find_program('test-repart.sh')
diff --git a/src/partition/test-repart.sh b/src/partition/test-repart.sh
new file mode 100755
index 0000000000..7da6b1b027
--- /dev/null
+++ b/src/partition/test-repart.sh
@@ -0,0 +1,111 @@
+#!/usr/bin/env bash
+set -ex
+
+repart=$1
+test -x $repart
+
+D=$(mktemp --directory)
+trap "rm -rf '$D'" EXIT INT QUIT PIPE
+mkdir -p $D/definitions
+
+truncate -s 1G $D/zzz
+
+SEED=e2a40bf9-73f1-4278-9160-49c031e7aef8
+
+$repart $D/zzz --empty=force --dry-run=no --seed=$SEED
+
+sfdisk -d $D/zzz | grep -v -e 'sector-size' -e '^$' > $D/empty
+
+cmp $D/empty - <<EOF
+label: gpt
+label-id: EF7F7EE2-47B3-4251-B1A1-09EA8BF12D5D
+device: $D/zzz
+unit: sectors
+first-lba: 2048
+last-lba: 2097118
+EOF
+
+cat >$D/definitions/root.conf <<EOF
+[Partition]
+Type=root
+EOF
+
+ln -s root.conf $D/definitions/root2.conf
+
+cat >$D/definitions/home.conf <<EOF
+[Partition]
+Type=home
+EOF
+
+cat > $D/definitions/swap.conf <<EOF
+[Partition]
+Type=swap
+SizeMaxBytes=64M
+PaddingMinBytes=92M
+EOF
+
+$repart $D/zzz --dry-run=no --seed=$SEED --definitions=$D/definitions
+
+sfdisk -d $D/zzz | grep -v -e 'sector-size' -e '^$' >$D/populated
+
+cmp $D/populated - <<EOF
+label: gpt
+label-id: EF7F7EE2-47B3-4251-B1A1-09EA8BF12D5D
+device: $D/zzz
+unit: sectors
+first-lba: 2048
+last-lba: 2097118
+$D/zzz1 : start= 2048, size= 591856, type=933AC7E1-2EB4-4F13-B844-0E14E2AEF915, uuid=A6005774-F558-4330-A8E5-D6D2C01C01D6, name="home"
+$D/zzz2 : start= 593904, size= 591856, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=CE9C76EB-A8F1-40FF-813C-11DCA6C0A55B, name="root-x86-64"
+$D/zzz3 : start= 1185760, size= 591864, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=AC60A837-550C-43BD-B5C4-9CB73B884E79, name="root-x86-64-2"
+$D/zzz4 : start= 1777624, size= 131072, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F, uuid=2AA78CDB-59C7-4173-AF11-C7453737A5D1, name="swap"
+EOF
+
+cat >$D/definitions/swap.conf <<EOF
+[Partition]
+Type=swap
+SizeMaxBytes=64M
+EOF
+
+cat >$D/definitions/extra.conf <<EOF
+[Partition]
+Type=linux-generic
+EOF
+
+$repart $D/zzz --dry-run=no --seed=$SEED --definitions=$D/definitions
+
+sfdisk -d $D/zzz | grep -v -e 'sector-size' -e '^$' >$D/populated2
+
+cmp $D/populated2 - <<EOF
+label: gpt
+label-id: EF7F7EE2-47B3-4251-B1A1-09EA8BF12D5D
+device: $D/zzz
+unit: sectors
+first-lba: 2048
+last-lba: 2097118
+$D/zzz1 : start= 2048, size= 591856, type=933AC7E1-2EB4-4F13-B844-0E14E2AEF915, uuid=A6005774-F558-4330-A8E5-D6D2C01C01D6, name="home"
+$D/zzz2 : start= 593904, size= 591856, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=CE9C76EB-A8F1-40FF-813C-11DCA6C0A55B, name="root-x86-64"
+$D/zzz3 : start= 1185760, size= 591864, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=AC60A837-550C-43BD-B5C4-9CB73B884E79, name="root-x86-64-2"
+$D/zzz4 : start= 1777624, size= 131072, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F, uuid=2AA78CDB-59C7-4173-AF11-C7453737A5D1, name="swap"
+$D/zzz5 : start= 1908696, size= 188416, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=03477476-06AD-44E8-9EF4-BC2BD7771289, name="linux-generic"
+EOF
+
+truncate -s 2G $D/zzz
+
+$repart $D/zzz --dry-run=no --seed=$SEED --definitions=$D/definitions
+
+sfdisk -d $D/zzz | grep -v -e 'sector-size' -e '^$' >$D/populated3
+
+cmp $D/populated3 - <<EOF
+label: gpt
+label-id: EF7F7EE2-47B3-4251-B1A1-09EA8BF12D5D
+device: $D/zzz
+unit: sectors
+first-lba: 2048
+last-lba: 4194270
+$D/zzz1 : start= 2048, size= 591856, type=933AC7E1-2EB4-4F13-B844-0E14E2AEF915, uuid=A6005774-F558-4330-A8E5-D6D2C01C01D6, name="home"
+$D/zzz2 : start= 593904, size= 591856, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=CE9C76EB-A8F1-40FF-813C-11DCA6C0A55B, name="root-x86-64"
+$D/zzz3 : start= 1185760, size= 591864, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=AC60A837-550C-43BD-B5C4-9CB73B884E79, name="root-x86-64-2"
+$D/zzz4 : start= 1777624, size= 131072, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F, uuid=2AA78CDB-59C7-4173-AF11-C7453737A5D1, name="swap"
+$D/zzz5 : start= 1908696, size= 2285568, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=03477476-06AD-44E8-9EF4-BC2BD7771289, name="linux-generic"
+EOF
diff --git a/src/resolve/test-dns-packet.c b/src/resolve/test-dns-packet.c
index 7c6346cb66..bdd96aa9a2 100644
--- a/src/resolve/test-dns-packet.c
+++ b/src/resolve/test-dns-packet.c
@@ -92,7 +92,6 @@ static void test_packet_from_file(const char* filename, bool canonical) {
int main(int argc, char **argv) {
int i, N;
- _cleanup_free_ char *pkts_glob = NULL;
_cleanup_globfree_ glob_t g = {};
char **fnames;
@@ -102,7 +101,8 @@ int main(int argc, char **argv) {
N = argc - 1;
fnames = argv + 1;
} else {
- pkts_glob = path_join(get_testdata_dir(), "test-resolve/*.pkts");
+ _cleanup_free_ char *pkts_glob = NULL;
+ assert_se(get_testdata_dir("test-resolve/*.pkts", &pkts_glob) >= 0);
assert_se(glob(pkts_glob, GLOB_NOSORT, NULL, &g) == 0);
N = g.gl_pathc;
fnames = g.gl_pathv;
diff --git a/src/shared/tests.c b/src/shared/tests.c
index 96b5b805a9..764e4656bb 100644
--- a/src/shared/tests.c
+++ b/src/shared/tests.c
@@ -58,21 +58,25 @@ static void load_testdata_env(void) {
setenv(*k, *v, 0);
}
-const char* get_testdata_dir(void) {
- const char *env;
+int get_testdata_dir(const char *suffix, char **ret) {
+ const char *dir;
+ char *p;
load_testdata_env();
/* if the env var is set, use that */
- env = getenv("SYSTEMD_TEST_DATA");
- if (!env)
- env = SYSTEMD_TEST_DATA;
- if (access(env, F_OK) < 0) {
- fprintf(stderr, "ERROR: $SYSTEMD_TEST_DATA directory [%s] does not exist\n", env);
- exit(EXIT_FAILURE);
- }
+ dir = getenv("SYSTEMD_TEST_DATA");
+ if (!dir)
+ dir = SYSTEMD_TEST_DATA;
+ if (access(dir, F_OK) < 0)
+ return log_error_errno(errno, "ERROR: $SYSTEMD_TEST_DATA directory [%s] not accesible: %m", dir);
- return env;
+ p = path_join(dir, suffix);
+ if (!p)
+ return log_oom();
+
+ *ret = p;
+ return 0;
}
const char* get_catalog_dir(void) {
diff --git a/src/shared/tests.h b/src/shared/tests.h
index 5a6fd53f36..6817ef4860 100644
--- a/src/shared/tests.h
+++ b/src/shared/tests.h
@@ -20,7 +20,7 @@ static inline bool manager_errno_skip_test(int r) {
char* setup_fake_runtime_dir(void);
int enter_cgroup_subroot(char **ret_cgroup);
-const char* get_testdata_dir(void);
+int get_testdata_dir(const char *suffix, char **ret);
const char* get_catalog_dir(void);
bool slow_tests_enabled(void);
void test_setup_logging(int level);
diff --git a/src/test/test-bpf-firewall.c b/src/test/test-bpf-firewall.c
index fbaa349b45..71aed12558 100644
--- a/src/test/test-bpf-firewall.c
+++ b/src/test/test-bpf-firewall.c
@@ -48,7 +48,9 @@ int main(int argc, char *argv[]) {
if (r == -ENOMEDIUM)
return log_tests_skipped("cgroupfs not available");
- assert_se(set_unit_path(get_testdata_dir()) >= 0);
+ _cleanup_free_ char *unit_dir = NULL;
+ assert_se(get_testdata_dir("units", &unit_dir) >= 0);
+ assert_se(set_unit_path(unit_dir) >= 0);
assert_se(runtime_dir = setup_fake_runtime_dir());
r = bpf_program_new(BPF_PROG_TYPE_CGROUP_SKB, &p);
diff --git a/src/test/test-cgroup-mask.c b/src/test/test-cgroup-mask.c
index 02c8549b4b..daafba4ef6 100644
--- a/src/test/test-cgroup-mask.c
+++ b/src/test/test-cgroup-mask.c
@@ -38,7 +38,9 @@ static int test_cgroup_mask(void) {
return log_tests_skipped("cgroupfs not available");
/* Prepare the manager. */
- assert_se(set_unit_path(get_testdata_dir()) >= 0);
+ _cleanup_free_ char *unit_dir = NULL;
+ assert_se(get_testdata_dir("units", &unit_dir) >= 0);
+ assert_se(set_unit_path(unit_dir) >= 0);
assert_se(runtime_dir = setup_fake_runtime_dir());
r = manager_new(UNIT_FILE_USER, MANAGER_TEST_RUN_BASIC, &m);
if (IN_SET(r, -EPERM, -EACCES)) {
diff --git a/src/test/test-cgroup-unit-default.c b/src/test/test-cgroup-unit-default.c
index 1286f11e4e..372667041c 100644
--- a/src/test/test-cgroup-unit-default.c
+++ b/src/test/test-cgroup-unit-default.c
@@ -22,7 +22,9 @@ static int test_default_memory_low(void) {
if (r == -ENOMEDIUM)
return log_tests_skipped("cgroupfs not available");
- assert_se(set_unit_path(get_testdata_dir()) >= 0);
+ _cleanup_free_ char *unit_dir = NULL;
+ assert_se(get_testdata_dir("units", &unit_dir) >= 0);
+ assert_se(set_unit_path(unit_dir) >= 0);
assert_se(runtime_dir = setup_fake_runtime_dir());
r = manager_new(UNIT_FILE_USER, MANAGER_TEST_RUN_BASIC, &m);
if (IN_SET(r, -EPERM, -EACCES)) {
diff --git a/src/test/test-engine.c b/src/test/test-engine.c
index b8351141fe..6465151b27 100644
--- a/src/test/test-engine.c
+++ b/src/test/test-engine.c
@@ -26,8 +26,11 @@ int main(int argc, char *argv[]) {
return log_tests_skipped("cgroupfs not available");
/* prepare the test */
- assert_se(set_unit_path(get_testdata_dir()) >= 0);
+ _cleanup_free_ char *unit_dir = NULL;
+ assert_se(get_testdata_dir("units", &unit_dir) >= 0);
+ assert_se(set_unit_path(unit_dir) >= 0);
assert_se(runtime_dir = setup_fake_runtime_dir());
+
r = manager_new(UNIT_FILE_USER, MANAGER_TEST_RUN_BASIC, &m);
if (manager_errno_skip_test(r))
return log_tests_skipped_errno(r, "manager_new");
diff --git a/src/test/test-execute.c b/src/test/test-execute.c
index 4e0fd7d5b4..5a96b46a77 100644
--- a/src/test/test-execute.c
+++ b/src/test/test-execute.c
@@ -806,7 +806,6 @@ static int run_tests(UnitFileScope scope, const test_entry tests[], char **patte
int main(int argc, char *argv[]) {
_cleanup_(rm_rf_physical_and_freep) char *runtime_dir = NULL;
- _cleanup_free_ char *test_execute_path = NULL;
static const test_entry user_tests[] = {
entry(test_exec_basic),
@@ -878,9 +877,10 @@ int main(int argc, char *argv[]) {
if (r == -ENOMEDIUM)
return log_tests_skipped("cgroupfs not available");
+ _cleanup_free_ char *unit_dir = NULL;
+ assert_se(get_testdata_dir("test-execute/", &unit_dir) >= 0);
+ assert_se(set_unit_path(unit_dir) >= 0);
assert_se(runtime_dir = setup_fake_runtime_dir());
- test_execute_path = path_join(get_testdata_dir(), "test-execute");
- assert_se(set_unit_path(test_execute_path) >= 0);
/* Unset VAR1, VAR2 and VAR3 which are used in the PassEnvironment test
* cases, otherwise (and if they are present in the environment),
diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c
index 23c7d370d4..32a00349ac 100644
--- a/src/test/test-fileio.c
+++ b/src/test/test-fileio.c
@@ -444,20 +444,20 @@ static void test_write_string_file_verify(void) {
_cleanup_free_ char *buf = NULL, *buf2 = NULL;
int r;
- assert_se(read_one_line_file("/proc/cmdline", &buf) >= 0);
+ assert_se(read_one_line_file("/proc/version", &buf) >= 0);
assert_se(buf2 = strjoin(buf, "\n"));
- r = write_string_file("/proc/cmdline", buf, 0);
+ r = write_string_file("/proc/version", buf, 0);
assert_se(IN_SET(r, -EACCES, -EIO));
- r = write_string_file("/proc/cmdline", buf2, 0);
+ r = write_string_file("/proc/version", buf2, 0);
assert_se(IN_SET(r, -EACCES, -EIO));
- assert_se(write_string_file("/proc/cmdline", buf, WRITE_STRING_FILE_VERIFY_ON_FAILURE) == 0);
- assert_se(write_string_file("/proc/cmdline", buf2, WRITE_STRING_FILE_VERIFY_ON_FAILURE) == 0);
+ assert_se(write_string_file("/proc/version", buf, WRITE_STRING_FILE_VERIFY_ON_FAILURE) == 0);
+ assert_se(write_string_file("/proc/version", buf2, WRITE_STRING_FILE_VERIFY_ON_FAILURE) == 0);
- r = write_string_file("/proc/cmdline", buf, WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_AVOID_NEWLINE);
+ r = write_string_file("/proc/version", buf, WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_AVOID_NEWLINE);
assert_se(IN_SET(r, -EACCES, -EIO));
- assert_se(write_string_file("/proc/cmdline", buf2, WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_AVOID_NEWLINE) == 0);
+ assert_se(write_string_file("/proc/version", buf2, WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_AVOID_NEWLINE) == 0);
}
static void test_load_env_file_pairs(void) {
@@ -757,7 +757,7 @@ static void test_read_line3(void) {
_cleanup_free_ char *line = NULL;
int r;
- f = fopen("/proc/cmdline", "re");
+ f = fopen("/proc/uptime", "re");
if (!f && IN_SET(errno, ENOENT, EPERM))
return;
assert_se(f);
diff --git a/src/test/test-journal-importer.c b/src/test/test-journal-importer.c
index 7e898735c9..4883356956 100644
--- a/src/test/test-journal-importer.c
+++ b/src/test/test-journal-importer.c
@@ -25,7 +25,7 @@ static void test_basic_parsing(void) {
_cleanup_free_ char *journal_data_path = NULL;
int r;
- journal_data_path = path_join(get_testdata_dir(), "journal-data/journal-1.txt");
+ assert_se(get_testdata_dir("journal-data/journal-1.txt", &journal_data_path) >= 0);
imp.fd = open(journal_data_path, O_RDONLY|O_CLOEXEC);
assert_se(imp.fd >= 0);
@@ -56,7 +56,7 @@ static void test_bad_input(void) {
_cleanup_free_ char *journal_data_path = NULL;
int r;
- journal_data_path = path_join(get_testdata_dir(), "journal-data/journal-2.txt");
+ assert_se(get_testdata_dir("journal-data/journal-1.txt", &journal_data_path) >= 0);
imp.fd = open(journal_data_path, O_RDONLY|O_CLOEXEC);
assert_se(imp.fd >= 0);
diff --git a/src/test/test-path.c b/src/test/test-path.c
index 6ad222b5f9..830d5f261b 100644
--- a/src/test/test-path.c
+++ b/src/test/test-path.c
@@ -251,7 +251,7 @@ int main(int argc, char *argv[]) {
test_setup_logging(LOG_INFO);
- test_path = path_join(get_testdata_dir(), "test-path");
+ assert_se(get_testdata_dir("test-path", &test_path) >= 0);
assert_se(set_unit_path(test_path) >= 0);
assert_se(runtime_dir = setup_fake_runtime_dir());
diff --git a/src/test/test-sched-prio.c b/src/test/test-sched-prio.c
index cd45537847..da6d2a21e6 100644
--- a/src/test/test-sched-prio.c
+++ b/src/test/test-sched-prio.c
@@ -25,8 +25,11 @@ int main(int argc, char *argv[]) {
return log_tests_skipped("cgroupfs not available");
/* prepare the test */
- assert_se(set_unit_path(get_testdata_dir()) >= 0);
+ _cleanup_free_ char *unit_dir = NULL;
+ assert_se(get_testdata_dir("units", &unit_dir) >= 0);
+ assert_se(set_unit_path(unit_dir) >= 0);
assert_se(runtime_dir = setup_fake_runtime_dir());
+
r = manager_new(UNIT_FILE_USER, MANAGER_TEST_RUN_BASIC, &m);
if (manager_errno_skip_test(r))
return log_tests_skipped_errno(r, "manager_new");
diff --git a/src/test/test-umount.c b/src/test/test-umount.c
index 6ab5758ede..b27b75b352 100644
--- a/src/test/test-umount.c
+++ b/src/test/test-umount.c
@@ -15,8 +15,10 @@ static void test_mount_points_list(const char *fname) {
log_info("/* %s(\"%s\") */", __func__, fname ?: "/proc/self/mountinfo");
- if (fname)
- fname = testdata_fname = path_join(get_testdata_dir(), fname);
+ if (fname) {
+ assert_se(get_testdata_dir(fname, &testdata_fname) >= 0);
+ fname = testdata_fname;
+ }
LIST_HEAD_INIT(mp_list_head);
assert_se(mount_points_list_get(fname, &mp_list_head) >= 0);
@@ -37,8 +39,10 @@ static void test_swap_list(const char *fname) {
log_info("/* %s(\"%s\") */", __func__, fname ?: "/proc/swaps");
- if (fname)
- fname = testdata_fname = path_join(get_testdata_dir(), fname);
+ if (fname) {
+ assert_se(get_testdata_dir(fname, &testdata_fname) >= 0);
+ fname = testdata_fname;
+ }
LIST_HEAD_INIT(mp_list_head);
assert_se(swap_list_get(fname, &mp_list_head) >= 0);
diff --git a/src/test/test-watch-pid.c b/src/test/test-watch-pid.c
index bad289767d..28ecffb0c0 100644
--- a/src/test/test-watch-pid.c
+++ b/src/test/test-watch-pid.c
@@ -20,7 +20,10 @@ int main(int argc, char *argv[]) {
if (r == -ENOMEDIUM)
return log_tests_skipped("cgroupfs not available");
- assert_se(set_unit_path(get_testdata_dir()) >= 0);
+ _cleanup_free_ char *unit_dir = NULL;
+ assert_se(get_testdata_dir("units/", &unit_dir) >= 0);
+ assert_se(set_unit_path(unit_dir) >= 0);
+
assert_se(runtime_dir = setup_fake_runtime_dir());
assert_se(manager_new(UNIT_FILE_USER, MANAGER_TEST_RUN_BASIC, &m) >= 0);
diff --git a/test/README.testsuite b/test/README.testsuite
index 471771acd4..7204fdb00b 100644
--- a/test/README.testsuite
+++ b/test/README.testsuite
@@ -10,10 +10,10 @@ ninja: no work to do.
--x-- Running TEST-01-BASIC --x--
+ make -C TEST-01-BASIC BUILD_DIR=/home/zbyszek/src/systemd/build clean setup run
make: Entering directory '/home/zbyszek/src/systemd/test/TEST-01-BASIC'
-TEST CLEANUP: Basic systemd setup
-TEST SETUP: Basic systemd setup
+TEST-01-BASIC CLEANUP: Basic systemd setup
+TEST-01-BASIC SETUP: Basic systemd setup
...
-TEST RUN: Basic systemd setup [OK]
+TEST-01-BASIC RUN: Basic systemd setup [OK]
make: Leaving directory '/home/zbyszek/src/systemd/test/TEST-01-BASIC'
--x-- Result of TEST-01-BASIC: 0 --x--
--x-- Running TEST-02-CRYPTSETUP --x--
diff --git a/test/TEST-01-BASIC/Makefile b/test/TEST-01-BASIC/Makefile
index 45e9bfc67c..79fe9688b8 100644
--- a/test/TEST-01-BASIC/Makefile
+++ b/test/TEST-01-BASIC/Makefile
@@ -1,9 +1,6 @@
BUILD_DIR=$(shell ../../tools/find-build-dir.sh)
-all setup run:
+all setup run clean clean-again:
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
-clean clean-again:
- @basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --clean
-
.PHONY: all setup run clean clean-again
diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh
index 0eaa8f991a..58f6cd1414 100755
--- a/test/TEST-01-BASIC/test.sh
+++ b/test/TEST-01-BASIC/test.sh
@@ -1,34 +1,25 @@
#!/usr/bin/env bash
set -e
TEST_DESCRIPTION="Basic systemd setup"
+IMAGE_NAME="basic"
RUN_IN_UNPRIVILEGED_CONTAINER=${RUN_IN_UNPRIVILEGED_CONTAINER:-yes}
+TEST_REQUIRE_INSTALL_TESTS=0
. $TEST_BASE_DIR/test-functions
-test_setup() {
+test_create_image() {
create_empty_image_rootdir
# Create what will eventually be our root filesystem onto an overlay
(
LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
setup_basic_environment
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-After=multi-user.target
-
-[Service]
-ExecStart=/bin/sh -e -x -c 'systemctl --state=failed --no-legend --no-pager > /failed ; systemctl daemon-reload ; echo OK > /testok'
-Type=oneshot
-EOF
-
- setup_testsuite
+ # install tests manually so the test is functional even when -Dinstall-tests=false
+ mkdir -p $initdir/usr/lib/systemd/tests/testdata/units/
+ cp -v $(dirname $0)/../units/{testsuite-01,end}.service $initdir/usr/lib/systemd/tests/testdata/units/
)
setup_nspawn_root
}
-do_test "$@"
+do_test "$@" 01
diff --git a/test/TEST-02-CRYPTSETUP/test.sh b/test/TEST-02-CRYPTSETUP/test.sh
index a859b345d0..157a70021b 100755
--- a/test/TEST-02-CRYPTSETUP/test.sh
+++ b/test/TEST-02-CRYPTSETUP/test.sh
@@ -1,21 +1,22 @@
#!/usr/bin/env bash
set -e
TEST_DESCRIPTION="cryptsetup systemd setup"
+IMAGE_NAME="cryptsetup"
TEST_NO_NSPAWN=1
. $TEST_BASE_DIR/test-functions
check_result_qemu() {
ret=1
- mkdir -p $initdir
- mount ${LOOPDEV}p1 $initdir
+ mount_initdir
[[ -e $initdir/testok ]] && ret=0
[[ -f $initdir/failed ]] && cp -a $initdir/failed $TESTDIR
cryptsetup luksOpen ${LOOPDEV}p2 varcrypt <$TESTDIR/keyfile
mount /dev/mapper/varcrypt $initdir/var
cp -a $initdir/var/log/journal $TESTDIR
- umount $initdir/var
- umount $initdir
+ rm -r $initdir/var/log/journal/*
+ _umount_dir $initdir/var
+ _umount_dir $initdir
cryptsetup luksClose /dev/mapper/varcrypt
[[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed
ls -l $TESTDIR/journal/*/*.journal
@@ -23,8 +24,7 @@ check_result_qemu() {
return $ret
}
-
-test_setup() {
+test_create_image() {
create_empty_image_rootdir
echo -n test >$TESTDIR/keyfile
cryptsetup -q luksFormat --pbkdf pbkdf2 --pbkdf-force-iterations 1000 ${LOOPDEV}p2 $TESTDIR/keyfile
@@ -42,25 +42,12 @@ test_setup() {
setup_basic_environment
mask_supporting_services
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-After=multi-user.target
-
-[Service]
-ExecStart=/bin/sh -x -c 'systemctl --state=failed --no-legend --no-pager > /failed ; echo OK > /testok'
-Type=oneshot
-EOF
-
- setup_testsuite
-
install_dmevent
generate_module_dependencies
cat >$initdir/etc/crypttab <<EOF
$DM_NAME UUID=$ID_FS_UUID /etc/varkey
EOF
- echo -n test > $initdir/etc/varkey
+ echo -n test >$initdir/etc/varkey
cat $initdir/etc/crypttab | ddebug
cat >>$initdir/etc/fstab <<EOF
@@ -82,8 +69,8 @@ test_cleanup() {
}
test_setup_cleanup() {
- cleanup_root_var
- _test_setup_cleanup
+ cleanup_root_var || :
+ cleanup_initdir
}
-do_test "$@"
+do_test "$@" 02
diff --git a/test/TEST-03-JOBS/test.sh b/test/TEST-03-JOBS/test.sh
index 5299464b81..33a1fb6fd0 100755
--- a/test/TEST-03-JOBS/test.sh
+++ b/test/TEST-03-JOBS/test.sh
@@ -5,36 +5,4 @@ TEST_NO_QEMU=1
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- # Create what will eventually be our root filesystem onto an overlay
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-After=multi-user.target
-
-[Service]
-ExecStart=/test-jobs.sh
-Type=oneshot
-EOF
-
- # copy the units used by this test
- cp $TEST_BASE_DIR/{hello.service,sleep.service,hello-after-sleep.target,unstoppable.service} \
- $initdir/etc/systemd/system
- cp test-jobs.sh $initdir/
-
- setup_testsuite
- )
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 03
diff --git a/test/TEST-04-JOURNAL/test.sh b/test/TEST-04-JOURNAL/test.sh
index af96dfd719..f16543c2b4 100755
--- a/test/TEST-04-JOURNAL/test.sh
+++ b/test/TEST-04-JOURNAL/test.sh
@@ -4,41 +4,4 @@ TEST_DESCRIPTION="Journal-related tests"
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- # Create what will eventually be our root filesystem onto an overlay
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/test-journal.sh
-Type=oneshot
-EOF
-
- cat >$initdir/etc/systemd/system/forever-print-hola.service <<EOF
-[Unit]
-Description=ForeverPrintHola service
-
-[Service]
-Type=simple
-ExecStart=/bin/sh -x -c 'while :; do printf "Hola\n" || touch /i-lose-my-logs; sleep 1; done'
-EOF
-
- cp test-journal.sh $initdir/
-
- setup_testsuite
- )
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 04
diff --git a/test/TEST-05-RLIMITS/test-rlimits.sh b/test/TEST-05-RLIMITS/test-rlimits.sh
deleted file mode 100755
index 86b57601fe..0000000000
--- a/test/TEST-05-RLIMITS/test-rlimits.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env bash
-set -x
-set -e
-set -o pipefail
-
-[[ "$(systemctl show -p DefaultLimitNOFILESoft)" = "DefaultLimitNOFILESoft=10000" ]]
-[[ "$(systemctl show -p DefaultLimitNOFILE)" = "DefaultLimitNOFILE=16384" ]]
-
-[[ "$(systemctl show -p LimitNOFILESoft testsuite.service)" = "LimitNOFILESoft=10000" ]]
-[[ "$(systemctl show -p LimitNOFILE testsuite.service)" = "LimitNOFILE=16384" ]]
-
-[[ "$(ulimit -n -S)" = "10000" ]]
-[[ "$(ulimit -n -H)" = "16384" ]]
-
-touch /testok
diff --git a/test/TEST-05-RLIMITS/test.sh b/test/TEST-05-RLIMITS/test.sh
index bda37ef212..463fe42a7c 100755
--- a/test/TEST-05-RLIMITS/test.sh
+++ b/test/TEST-05-RLIMITS/test.sh
@@ -4,37 +4,4 @@ TEST_DESCRIPTION="Resource limits-related tests"
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- # Create what will eventually be our root filesystem onto an overlay
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
-
- cat >$initdir/etc/systemd/system.conf <<EOF
-[Manager]
-DefaultLimitNOFILE=10000:16384
-EOF
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/test-rlimits.sh
-Type=oneshot
-EOF
-
- cp test-rlimits.sh $initdir/
-
- setup_testsuite
- )
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 05
diff --git a/test/TEST-06-SELINUX/test.sh b/test/TEST-06-SELINUX/test.sh
index 46dc1cd805..7a836bbc03 100755
--- a/test/TEST-06-SELINUX/test.sh
+++ b/test/TEST-06-SELINUX/test.sh
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
set -e
TEST_DESCRIPTION="SELinux tests"
+IMAGE_NAME="selinux"
TEST_NO_NSPAWN=1
# Requirements:
@@ -15,60 +16,16 @@ test -f /usr/share/selinux/devel/include/system/systemd.if || exit 0
SETUP_SELINUX=yes
KERNEL_APPEND="$KERNEL_APPEND selinux=1 security=selinux"
-test_setup() {
+test_create_image() {
create_empty_image_rootdir
# Create what will eventually be our root filesystem onto an overlay
(
LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
setup_basic_environment
mask_supporting_services
- # setup the testsuite service
- cat <<EOF >$initdir/etc/systemd/system/testsuite.service
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/test-selinux-checks.sh
-Type=oneshot
-EOF
-
- cat <<EOF >$initdir/etc/systemd/system/hola.service
-[Service]
-Type=oneshot
-ExecStart=/bin/echo Start Hola
-ExecReload=/bin/echo Reload Hola
-ExecStop=/bin/echo Stop Hola
-RemainAfterExit=yes
-EOF
-
- setup_testsuite
-
- cat <<EOF >$initdir/etc/systemd/system/load-systemd-test-module.service
-[Unit]
-Description=Load systemd-test module
-DefaultDependencies=no
-Requires=local-fs.target
-Conflicts=shutdown.target
-After=local-fs.target
-Before=sysinit.target shutdown.target autorelabel.service
-ConditionSecurity=selinux
-ConditionPathExists=|/.load-systemd-test-module
-
-[Service]
-ExecStart=/bin/sh -x -c 'echo 0 >/sys/fs/selinux/enforce && cd /systemd-test-module && make -f /usr/share/selinux/devel/Makefile load && rm /.load-systemd-test-module'
-Type=oneshot
-TimeoutSec=0
-RemainAfterExit=yes
-EOF
-
- touch $initdir/.load-systemd-test-module
- mkdir -p $initdir/etc/systemd/system/basic.target.wants
- ln -fs load-systemd-test-module.service $initdir/etc/systemd/system/basic.target.wants/load-systemd-test-module.service
-
local _modules_dir=/var/lib/selinux
rm -rf $initdir/$_modules_dir
if ! cp -ar $_modules_dir $initdir/$_modules_dir; then
@@ -87,11 +44,10 @@ EOF
mkdir $initdir/systemd-test-module
cp systemd_test.te $initdir/systemd-test-module
cp systemd_test.if $initdir/systemd-test-module
- cp test-selinux-checks.sh $initdir
dracut_install -o sesearch
dracut_install runcon
dracut_install checkmodule semodule semodule_package m4 make /usr/libexec/selinux/hll/pp load_policy sefcontext_compile
)
}
-do_test "$@"
+do_test "$@" 06
diff --git a/test/TEST-07-ISSUE-1981/test.sh b/test/TEST-07-ISSUE-1981/test.sh
index 7927294a8a..5da24a987c 100755
--- a/test/TEST-07-ISSUE-1981/test.sh
+++ b/test/TEST-07-ISSUE-1981/test.sh
@@ -7,32 +7,4 @@ TEST_NO_QEMU=1
NSPAWN_TIMEOUT=30
-test_setup() {
- create_empty_image_rootdir
-
- # Create what will eventually be our root filesystem onto an overlay
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/test-segfault.sh
-Type=oneshot
-EOF
-
- cp test-segfault.sh $initdir/
-
- setup_testsuite
- )
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 07
diff --git a/test/TEST-08-ISSUE-2730/test.sh b/test/TEST-08-ISSUE-2730/test.sh
index 2fedef7b58..e5dedf2f0c 100755
--- a/test/TEST-08-ISSUE-2730/test.sh
+++ b/test/TEST-08-ISSUE-2730/test.sh
@@ -1,70 +1,22 @@
#!/usr/bin/env bash
set -e
TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/2730"
+IMAGE_NAME="test08"
TEST_NO_NSPAWN=1
. $TEST_BASE_DIR/test-functions
QEMU_TIMEOUT=300
FSTYPE=ext4
-test_setup() {
+test_create_image() {
create_empty_image_rootdir
# Create what will eventually be our root filesystem onto an overlay
(
LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
setup_basic_environment
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/bin/sh -x -c 'mount -o remount,rw /dev/sda1 && echo OK > /testok; systemctl poweroff'
-Type=oneshot
-EOF
-
- rm $initdir/etc/fstab
- cat >$initdir/etc/systemd/system/-.mount <<EOF
-[Unit]
-Before=local-fs.target
-
-[Mount]
-What=/dev/sda1
-Where=/
-Type=ext4
-Options=errors=remount-ro,noatime
-
-[Install]
-WantedBy=local-fs.target
-Alias=root.mount
-EOF
-
- cat >$initdir/etc/systemd/system/systemd-remount-fs.service <<EOF
-[Unit]
-DefaultDependencies=no
-Conflicts=shutdown.target
-After=systemd-fsck-root.service
-Before=local-fs-pre.target local-fs.target shutdown.target
-Wants=local-fs-pre.target
-
-[Service]
-Type=oneshot
-RemainAfterExit=yes
-ExecStart=/bin/systemctl reload /
-EOF
-
- setup_testsuite
)
-
- ln -s /etc/systemd/system/-.mount $initdir/etc/systemd/system/root.mount
- mkdir -p $initdir/etc/systemd/system/local-fs.target.wants
- ln -s /etc/systemd/system/-.mount $initdir/etc/systemd/system/local-fs.target.wants/-.mount
-
mask_supporting_services
}
-do_test "$@"
+do_test "$@" 08
diff --git a/test/TEST-09-ISSUE-2691/test.sh b/test/TEST-09-ISSUE-2691/test.sh
index efe75d140b..a4d155be1d 100755
--- a/test/TEST-09-ISSUE-2691/test.sh
+++ b/test/TEST-09-ISSUE-2691/test.sh
@@ -6,32 +6,4 @@ TEST_NO_NSPAWN=1
. $TEST_BASE_DIR/test-functions
QEMU_TIMEOUT=300
-test_setup() {
- create_empty_image_rootdir
-
- # Create what will eventually be our root filesystem onto an overlay
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<'EOF'
-[Unit]
-Description=Testsuite service
-
-[Service]
-Type=oneshot
-ExecStart=/bin/sh -c '>/testok'
-RemainAfterExit=yes
-ExecStop=/bin/sh -c 'kill -SEGV $$$$'
-TimeoutStopSec=270s
-EOF
-
- setup_testsuite
- )
-}
-
-do_test "$@"
+do_test "$@" 09
diff --git a/test/TEST-10-ISSUE-2467/test.sh b/test/TEST-10-ISSUE-2467/test.sh
index 1761ad1e43..14ded56ba1 100755
--- a/test/TEST-10-ISSUE-2467/test.sh
+++ b/test/TEST-10-ISSUE-2467/test.sh
@@ -4,45 +4,4 @@ TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/2467"
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- # Create what will eventually be our root filesystem onto an overlay
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
- dracut_install true rm socat
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<'EOF'
-[Unit]
-Description=Testsuite service
-
-[Service]
-Type=oneshot
-ExecStart=/bin/sh -e -x -c 'rm -f /tmp/nonexistent; systemctl start test.socket; printf x > test.file; socat -t20 OPEN:test.file UNIX-CONNECT:/run/test.ctl; >/testok'
-EOF
-
- cat >$initdir/etc/systemd/system/test.socket <<'EOF'
-[Socket]
-ListenStream=/run/test.ctl
-EOF
-
- cat > $initdir/etc/systemd/system/test.service <<'EOF'
-[Unit]
-Requires=test.socket
-ConditionPathExistsGlob=/tmp/nonexistent
-
-[Service]
-ExecStart=/bin/true
-EOF
-
- setup_testsuite
- )
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 10
diff --git a/test/TEST-11-ISSUE-3166/test.sh b/test/TEST-11-ISSUE-3166/test.sh
index e444414a90..da003c90d5 100755
--- a/test/TEST-11-ISSUE-3166/test.sh
+++ b/test/TEST-11-ISSUE-3166/test.sh
@@ -5,58 +5,4 @@ TEST_NO_NSPAWN=1
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- # Create what will eventually be our root filesystem onto an overlay
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
- dracut_install false touch
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/test-fail-on-restart.sh
-Type=oneshot
-EOF
-
- cat >$initdir/etc/systemd/system/fail-on-restart.service <<EOF
-[Unit]
-Description=Fail on restart
-StartLimitIntervalSec=1m
-StartLimitBurst=3
-
-[Service]
-Type=simple
-ExecStart=/bin/false
-Restart=always
-EOF
-
-
- cat >$initdir/test-fail-on-restart.sh <<'EOF'
-#!/usr/bin/env bash
-set -x
-
-systemctl start fail-on-restart.service
-active_state=$(systemctl show --property ActiveState fail-on-restart.service)
-while [[ "$active_state" == "ActiveState=activating" || "$active_state" == "ActiveState=active" ]]; do
- sleep 1
- active_state=$(systemctl show --property ActiveState fail-on-restart.service)
-done
-systemctl is-failed fail-on-restart.service || exit 1
-touch /testok
-EOF
-
- chmod 0755 $initdir/test-fail-on-restart.sh
- setup_testsuite
- )
-}
-
-do_test "$@"
+do_test "$@" 11
diff --git a/test/TEST-12-ISSUE-3171/test.sh b/test/TEST-12-ISSUE-3171/test.sh
index e30c36ed86..c8abefbd86 100755
--- a/test/TEST-12-ISSUE-3171/test.sh
+++ b/test/TEST-12-ISSUE-3171/test.sh
@@ -5,85 +5,4 @@ TEST_NO_QEMU=1
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- # Create what will eventually be our root filesystem onto an overlay
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
- dracut_install cat mv stat nc
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-After=multi-user.target
-
-[Service]
-ExecStart=/test-socket-group.sh
-Type=oneshot
-EOF
-
- cat >$initdir/test-socket-group.sh <<'EOF'
-#!/usr/bin/env bash
-set -x
-set -e
-set -o pipefail
-
-U=/run/systemd/system/test.socket
-cat <<'EOL' >$U
-[Unit]
-Description=Test socket
-[Socket]
-Accept=yes
-ListenStream=/run/test.socket
-SocketGroup=adm
-SocketMode=0660
-EOL
-
-cat <<'EOL' > /run/systemd/system/test@.service
-[Unit]
-Description=Test service
-[Service]
-StandardInput=socket
-ExecStart=/bin/sh -x -c cat
-EOL
-
-systemctl start test.socket
-systemctl is-active test.socket
-[[ "$(stat --format='%G' /run/test.socket)" == adm ]]
-echo A | nc -w1 -U /run/test.socket
-
-mv $U ${U}.disabled
-systemctl daemon-reload
-systemctl is-active test.socket
-[[ "$(stat --format='%G' /run/test.socket)" == adm ]]
-echo B | nc -w1 -U /run/test.socket && exit 1
-
-mv ${U}.disabled $U
-systemctl daemon-reload
-systemctl is-active test.socket
-echo C | nc -w1 -U /run/test.socket && exit 1
-[[ "$(stat --format='%G' /run/test.socket)" == adm ]]
-
-systemctl restart test.socket
-systemctl is-active test.socket
-echo D | nc -w1 -U /run/test.socket
-[[ "$(stat --format='%G' /run/test.socket)" == adm ]]
-
-
-touch /testok
-EOF
-
- chmod 0755 $initdir/test-socket-group.sh
- setup_testsuite
- )
-
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 12
diff --git a/test/TEST-13-NSPAWN-SMOKE/Makefile b/test/TEST-13-NSPAWN-SMOKE/Makefile
index e5e3350211..e9f93b1104 100644..120000
--- a/test/TEST-13-NSPAWN-SMOKE/Makefile
+++ b/test/TEST-13-NSPAWN-SMOKE/Makefile
@@ -1,10 +1 @@
-BUILD_DIR=$(shell ../../tools/find-build-dir.sh)
-
-all setup run:
- @basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
-
-clean clean-again:
- @basedir=../.. TEST_BASE_DIR=../ ./test.sh --clean
- @rm -f has-overflow
-
-.PHONY: all setup run clean clean-again
+../TEST-01-BASIC/Makefile \ No newline at end of file
diff --git a/test/TEST-13-NSPAWN-SMOKE/test.sh b/test/TEST-13-NSPAWN-SMOKE/test.sh
index 974b239d80..c777c166f7 100755
--- a/test/TEST-13-NSPAWN-SMOKE/test.sh
+++ b/test/TEST-13-NSPAWN-SMOKE/test.sh
@@ -1,193 +1,23 @@
#!/usr/bin/env bash
set -e
TEST_DESCRIPTION="systemd-nspawn smoke test"
+IMAGE_NAME=nspawn
TEST_NO_NSPAWN=1
. $TEST_BASE_DIR/test-functions
-test_setup() {
+test_create_image() {
create_empty_image_rootdir
# Create what will eventually be our root filesystem onto an overlay
(
LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
setup_basic_environment
mask_supporting_services
- dracut_install busybox chmod rmdir unshare ip sysctl
-
- cp create-busybox-container $initdir/
- ./create-busybox-container $initdir/nc-container
+ ../create-busybox-container $initdir/nc-container
initdir="$initdir/nc-container" dracut_install nc ip
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/test-nspawn.sh
-Type=oneshot
-EOF
-
- cat >$initdir/test-nspawn.sh <<'EOF'
-#!/usr/bin/env bash
-set -x
-set -e
-set -u
-set -o pipefail
-
-export SYSTEMD_LOG_LEVEL=debug
-
-# check cgroup-v2
-is_v2_supported=no
-mkdir -p /tmp/cgroup2
-if mount -t cgroup2 cgroup2 /tmp/cgroup2; then
- is_v2_supported=yes
- umount /tmp/cgroup2
-fi
-rmdir /tmp/cgroup2
-
-# check cgroup namespaces
-is_cgns_supported=no
-if [[ -f /proc/1/ns/cgroup ]]; then
- is_cgns_supported=yes
-fi
-
-is_user_ns_supported=no
-# On some systems (e.g. CentOS 7) the default limit for user namespaces
-# is set to 0, which causes the following unshare syscall to fail, even
-# with enabled user namespaces support. By setting this value explicitly
-# we can ensure the user namespaces support to be detected correctly.
-sysctl -w user.max_user_namespaces=10000
-if unshare -U sh -c :; then
- is_user_ns_supported=yes
-fi
-
-function check_bind_tmp_path {
- # https://github.com/systemd/systemd/issues/4789
- local _root="/var/lib/machines/bind-tmp-path"
- /create-busybox-container "$_root"
- >/tmp/bind
- systemd-nspawn --register=no -D "$_root" --bind=/tmp/bind /bin/sh -c 'test -e /tmp/bind'
-}
-
-function check_norbind {
- # https://github.com/systemd/systemd/issues/13170
- local _root="/var/lib/machines/norbind-path"
- mkdir -p /tmp/binddir/subdir
- echo -n "outer" > /tmp/binddir/subdir/file
- mount -t tmpfs tmpfs /tmp/binddir/subdir
- echo -n "inner" > /tmp/binddir/subdir/file
- /create-busybox-container "$_root"
- systemd-nspawn --register=no -D "$_root" --bind=/tmp/binddir:/mnt:norbind /bin/sh -c 'CONTENT=$(cat /mnt/subdir/file); if [[ $CONTENT != "outer" ]]; then echo "*** unexpected content: $CONTENT"; return 1; fi'
-}
-
-function check_notification_socket {
- # https://github.com/systemd/systemd/issues/4944
- local _cmd='echo a | $(busybox which nc) -U -u -w 1 /run/systemd/nspawn/notify'
- systemd-nspawn --register=no -D /nc-container /bin/sh -x -c "$_cmd"
- systemd-nspawn --register=no -D /nc-container -U /bin/sh -x -c "$_cmd"
-}
-
-function run {
- if [[ "$1" = "yes" && "$is_v2_supported" = "no" ]]; then
- printf "Unified cgroup hierarchy is not supported. Skipping.\n" >&2
- return 0
- fi
- if [[ "$2" = "yes" && "$is_cgns_supported" = "no" ]]; then
- printf "CGroup namespaces are not supported. Skipping.\n" >&2
- return 0
- fi
-
- local _root="/var/lib/machines/unified-$1-cgns-$2-api-vfs-writable-$3"
- /create-busybox-container "$_root"
- SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" -b
- SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" --private-network -b
-
- if SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" -U -b; then
- [[ "$is_user_ns_supported" = "yes" && "$3" = "network" ]] && return 1
- else
- [[ "$is_user_ns_supported" = "no" && "$3" = "network" ]] && return 1
- fi
-
- if SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" --private-network -U -b; then
- [[ "$is_user_ns_supported" = "yes" && "$3" = "yes" ]] && return 1
- else
- [[ "$is_user_ns_supported" = "no" && "$3" = "yes" ]] && return 1
- fi
-
- local _netns_opt="--network-namespace-path=/proc/self/ns/net"
-
- # --network-namespace-path and network-related options cannot be used together
- if SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" "$_netns_opt" --network-interface=lo -b; then
- return 1
- fi
-
- if SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" "$_netns_opt" --network-macvlan=lo -b; then
- return 1
- fi
-
- if SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" "$_netns_opt" --network-ipvlan=lo -b; then
- return 1
- fi
-
- if SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" "$_netns_opt" --network-veth -b; then
- return 1
- fi
-
- if SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" "$_netns_opt" --network-veth-extra=lo -b; then
- return 1
- fi
-
- if SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" "$_netns_opt" --network-bridge=lo -b; then
- return 1
- fi
-
- if SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" "$_netns_opt" --network-zone=zone -b; then
- return 1
- fi
-
- # allow combination of --network-namespace-path and --private-network
- if ! SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" "$_netns_opt" --private-network -b; then
- return 1
- fi
-
- # test --network-namespace-path works with a network namespace created by "ip netns"
- ip netns add nspawn_test
- _netns_opt="--network-namespace-path=/run/netns/nspawn_test"
- SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" "$_netns_opt" /bin/ip a | grep -v -E '^1: lo.*UP'
- local r=$?
- ip netns del nspawn_test
-
- if [ $r -ne 0 ]; then
- return 1
- fi
-
- return 0
-}
-
-check_bind_tmp_path
-
-check_norbind
-
-check_notification_socket
-
-for api_vfs_writable in yes no network; do
- run no no $api_vfs_writable
- run yes no $api_vfs_writable
- run no yes $api_vfs_writable
- run yes yes $api_vfs_writable
-done
-
-touch /testok
-EOF
-
- chmod 0755 $initdir/test-nspawn.sh
- setup_testsuite
)
}
-do_test "$@"
+do_test "$@" 13
diff --git a/test/TEST-14-MACHINE-ID/test.sh b/test/TEST-14-MACHINE-ID/test.sh
index 74cabf86aa..d1486f0aae 100755
--- a/test/TEST-14-MACHINE-ID/test.sh
+++ b/test/TEST-14-MACHINE-ID/test.sh
@@ -1,78 +1,21 @@
#!/usr/bin/env bash
set -e
TEST_DESCRIPTION="/etc/machine-id testing"
+IMAGE_NAME=badid
TEST_NO_NSPAWN=1
. $TEST_BASE_DIR/test-functions
-test_setup() {
+test_create_image() {
create_empty_image_rootdir
# Create what will eventually be our root filesystem onto an overlay
(
LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
setup_basic_environment
mask_supporting_services
printf "556f48e837bc4424a710fa2e2c9d3e3c\ne3d\n" >$initdir/etc/machine-id
- dracut_install mount cmp
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/bin/sh -e -x -c '/test-machine-id-setup.sh; systemctl --state=failed --no-legend --no-pager > /failed ; echo OK > /testok'
-Type=oneshot
-EOF
-
-cat >$initdir/test-machine-id-setup.sh <<'EOF'
-#!/usr/bin/env bash
-
-set -e
-set -x
-
-function setup_root {
- local _root="$1"
- mkdir -p "$_root"
- mount -t tmpfs tmpfs "$_root"
- mkdir -p "$_root/etc" "$_root/run"
-}
-
-function check {
- printf "Expected\n"
- cat "$1"
- printf "\nGot\n"
- cat "$2"
- cmp "$1" "$2"
-}
-
-r="$(pwd)/overwrite-broken-machine-id"
-setup_root "$r"
-systemd-machine-id-setup --print --root "$r"
-echo abc >>"$r/etc/machine-id"
-id=$(systemd-machine-id-setup --print --root "$r")
-echo $id >expected
-check expected "$r/etc/machine-id"
-
-r="$(pwd)/transient-machine-id"
-setup_root "$r"
-systemd-machine-id-setup --print --root "$r"
-echo abc >>"$r/etc/machine-id"
-mount -o remount,ro "$r"
-mount -t tmpfs tmpfs "$r/run"
-transient_id=$(systemd-machine-id-setup --print --root "$r")
-mount -o remount,rw "$r"
-commited_id=$(systemd-machine-id-setup --print --commit --root "$r")
-[[ "$transient_id" = "$commited_id" ]]
-check "$r/etc/machine-id" "$r/run/machine-id"
-EOF
-chmod +x $initdir/test-machine-id-setup.sh
-
- setup_testsuite
)
}
-do_test "$@"
+do_test "$@" 14
diff --git a/test/TEST-15-DROPIN/test.sh b/test/TEST-15-DROPIN/test.sh
index 63bbd35051..1540e2e1f1 100755
--- a/test/TEST-15-DROPIN/test.sh
+++ b/test/TEST-15-DROPIN/test.sh
@@ -5,18 +5,4 @@ TEST_NO_QEMU=1
. $TEST_BASE_DIR/test-functions
-test_setup() {
- # create the basic filesystem layout
- setup_basic_environment
- mask_supporting_services
-
- # import the test scripts in the rootfs and plug them in systemd
- cp testsuite.service $initdir/etc/systemd/system/
- cp test-dropin.sh $initdir/
- setup_testsuite
-
- # create dedicated rootfs for nspawn (located in $TESTDIR/nspawn-root)
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 15
diff --git a/test/TEST-15-DROPIN/testsuite.service b/test/TEST-15-DROPIN/testsuite.service
deleted file mode 100644
index 4c9f65e2b1..0000000000
--- a/test/TEST-15-DROPIN/testsuite.service
+++ /dev/null
@@ -1,6 +0,0 @@
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/test-dropin.sh
-Type=oneshot
diff --git a/test/TEST-16-EXTEND-TIMEOUT/test.sh b/test/TEST-16-EXTEND-TIMEOUT/test.sh
index 43d9f1278b..e1e2a68fa9 100755
--- a/test/TEST-16-EXTEND-TIMEOUT/test.sh
+++ b/test/TEST-16-EXTEND-TIMEOUT/test.sh
@@ -6,30 +6,4 @@ TEST_NO_QEMU=1
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image
-
- # Create what will eventually be our root filesystem onto an overlay
- (
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
-
- for s in success-all success-start success-stop success-runtime \
- fail-start fail-stop fail-runtime
- do
- cp testsuite-${s}.service ${initdir}/etc/systemd/system
- done
- cp testsuite.service ${initdir}/etc/systemd/system
-
- cp extend_timeout_test_service.sh ${initdir}/
- cp assess.sh ${initdir}/
-
- setup_testsuite
- )
-
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 16
diff --git a/test/TEST-16-EXTEND-TIMEOUT/testsuite.service b/test/TEST-16-EXTEND-TIMEOUT/testsuite.service
deleted file mode 100644
index 7512ba9e12..0000000000
--- a/test/TEST-16-EXTEND-TIMEOUT/testsuite.service
+++ /dev/null
@@ -1,18 +0,0 @@
-
-[Unit]
-Description=Testsuite: Assess all other testsuite-*.services worked as expected
-
-Wants=testsuite-success-all.service
-Wants=testsuite-success-start.service
-Wants=testsuite-success-runtime.service
-Wants=testsuite-success-stop.service
-Wants=testsuite-fail-start.service
-Wants=testsuite-fail-stop.service
-Wants=testsuite-fail-runtime.service
-StopWhenUnneeded=yes
-
-[Service]
-Type=simple
-TimeoutStartSec=infinity
-ExecStartPre=/assess.sh
-ExecStart=/bin/true
diff --git a/test/TEST-17-UDEV-WANTS/test.sh b/test/TEST-17-UDEV-WANTS/test.sh
index e196003e80..5b8f22cbaa 100755
--- a/test/TEST-17-UDEV-WANTS/test.sh
+++ b/test/TEST-17-UDEV-WANTS/test.sh
@@ -6,29 +6,4 @@ TEST_NO_NSPAWN=1
. $TEST_BASE_DIR/test-functions
QEMU_TIMEOUT=300
-test_setup() {
- create_empty_image_rootdir
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/bin/bash -x /testsuite.sh
-Type=oneshot
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- )
-}
-
-do_test "$@"
+do_test "$@" 17
diff --git a/test/TEST-18-FAILUREACTION/test.sh b/test/TEST-18-FAILUREACTION/test.sh
index b6231e6f5a..5c386b8ea2 100755
--- a/test/TEST-18-FAILUREACTION/test.sh
+++ b/test/TEST-18-FAILUREACTION/test.sh
@@ -5,31 +5,4 @@ TEST_DESCRIPTION="FailureAction= operation"
. $TEST_BASE_DIR/test-functions
QEMU_TIMEOUT=600
-test_setup() {
- create_empty_image_rootdir
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/bin/bash -x /testsuite.sh
-Type=oneshot
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- )
-
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 18
diff --git a/test/TEST-19-DELEGATE/test.sh b/test/TEST-19-DELEGATE/test.sh
index 2fbfef3062..03c7760bfd 100755
--- a/test/TEST-19-DELEGATE/test.sh
+++ b/test/TEST-19-DELEGATE/test.sh
@@ -7,29 +7,4 @@ TEST_NO_NSPAWN=1
QEMU_TIMEOUT=600
UNIFIED_CGROUP_HIERARCHY=yes
-test_setup() {
- create_empty_image_rootdir
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/bin/bash -x /testsuite.sh
-Type=oneshot
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- )
-}
-
-do_test "$@"
+do_test "$@" 19
diff --git a/test/TEST-20-MAINPIDGAMES/test.sh b/test/TEST-20-MAINPIDGAMES/test.sh
index 4cf1b79f9a..50724b3f3c 100755
--- a/test/TEST-20-MAINPIDGAMES/test.sh
+++ b/test/TEST-20-MAINPIDGAMES/test.sh
@@ -4,34 +4,4 @@ TEST_DESCRIPTION="test changing main PID"
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-Before=getty-pre.target
-Wants=getty-pre.target
-
-[Service]
-ExecStart=/bin/bash -x /testsuite.sh
-Type=oneshot
-NotifyAccess=all
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- )
-
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 20
diff --git a/test/TEST-21-SYSUSERS/test.sh b/test/TEST-21-SYSUSERS/test.sh
index c4b221af8a..f7dbbbf47b 100755
--- a/test/TEST-21-SYSUSERS/test.sh
+++ b/test/TEST-21-SYSUSERS/test.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -e
TEST_DESCRIPTION="Sysuser-related tests"
-
+IMAGE_NAME=sysusers
. $TEST_BASE_DIR/test-functions
test_setup() {
diff --git a/test/TEST-22-TMPFILES/test.sh b/test/TEST-22-TMPFILES/test.sh
index aa6efcfb48..317e4a88f7 100755
--- a/test/TEST-22-TMPFILES/test.sh
+++ b/test/TEST-22-TMPFILES/test.sh
@@ -2,30 +2,6 @@
set -e
TEST_DESCRIPTION="Tmpfiles related tests"
TEST_NO_QEMU=1
-
. $TEST_BASE_DIR/test-functions
-test_setup() {
- # create the basic filesystem layout
- setup_basic_environment
- mask_supporting_services
- inst_binary mv
- inst_binary stat
- inst_binary seq
- inst_binary xargs
- inst_binary mkfifo
- inst_binary readlink
-
- # setup the testsuite service
- cp testsuite.service $initdir/etc/systemd/system/
- setup_testsuite
-
- mkdir -p $initdir/testsuite
- cp run-tmpfiles-tests.sh $initdir/testsuite/
- cp test-*.sh $initdir/testsuite/
-
- # create dedicated rootfs for nspawn (located in $TESTDIR/nspawn-root)
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 22
diff --git a/test/TEST-23-TYPE-EXEC/test.sh b/test/TEST-23-TYPE-EXEC/test.sh
index ebc9fe4c85..1b0d25a721 100755
--- a/test/TEST-23-TYPE-EXEC/test.sh
+++ b/test/TEST-23-TYPE-EXEC/test.sh
@@ -1,33 +1,6 @@
#!/usr/bin/env bash
set -e
TEST_DESCRIPTION="test Type=exec"
-
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/testsuite.sh
-Type=oneshot
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- )
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 23
diff --git a/test/TEST-24-UNIT-TESTS/test.sh b/test/TEST-24-UNIT-TESTS/test.sh
index c9198fb6c7..a3a911c1b2 100755
--- a/test/TEST-24-UNIT-TESTS/test.sh
+++ b/test/TEST-24-UNIT-TESTS/test.sh
@@ -3,34 +3,43 @@ set -e
TEST_DESCRIPTION="Run unit tests under containers"
RUN_IN_UNPRIVILEGED_CONTAINER=yes
+# embed some newlines in the kernel command line to stress our test suite
+KERNEL_APPEND="
+
+frobnicate!
+
+$KERNEL_APPEND
+"
+
. $TEST_BASE_DIR/test-functions
check_result_nspawn() {
local _ret=1
- [[ -e $TESTDIR/$1/testok ]] && _ret=0
- if [[ -s $TESTDIR/$1/failed ]]; then
+ [[ -e $1/testok ]] && _ret=0
+ if [[ -s $1/failed ]]; then
_ret=$(($_ret+1))
echo "=== Failed test log ==="
- cat $TESTDIR/$1/failed
+ cat $1/failed
else
- if [[ -s $TESTDIR/$1/skipped ]]; then
+ if [[ -s $1/skipped ]]; then
echo "=== Skipped test log =="
- cat $TESTDIR/$1/skipped
+ cat $1/skipped
fi
- if [[ -s $TESTDIR/$1/testok ]]; then
+ if [[ -s $1/testok ]]; then
echo "=== Passed tests ==="
- cat $TESTDIR/$1/testok
+ cat $1/testok
fi
fi
- cp -a $TESTDIR/$1/var/log/journal $TESTDIR
+ cp -a $1/var/log/journal $TESTDIR
+ rm -r $1/var/log/journal/*
+ _umount_dir $initdir
[[ -n "$TIMED_OUT" ]] && _ret=$(($_ret+1))
return $_ret
}
check_result_qemu() {
local _ret=1
- mkdir -p $initdir
- mount ${LOOPDEV}p1 $initdir
+ mount_initdir
[[ -e $initdir/testok ]] && _ret=0
if [[ -s $initdir/failed ]]; then
_ret=$(($_ret+1))
@@ -47,55 +56,10 @@ check_result_qemu() {
fi
fi
cp -a $initdir/var/log/journal $TESTDIR
- umount $initdir
+ rm -r $initdir/var/log/journal/*
+ _umount_dir $initdir
[[ -n "$TIMED_OUT" ]] && _ret=$(($_ret+1))
return $_ret
}
-test_setup() {
- if type -P meson && [[ "$(meson configure $BUILD_DIR | grep install-tests | awk '{ print $2 }')" != "true" ]]; then
- dfatal "Needs to be built with -Dinstall-tests=true"
- exit 1
- fi
-
- create_empty_image_rootdir
-
- # Create what will eventually be our root filesystem onto an overlay
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- for i in getfacl dirname basename capsh cut rev stat mktemp rmdir ionice unshare uname tr awk getent diff xzcat lz4cat; do
- inst_binary $i
- done
-
- inst /etc/hosts
-
- setup_basic_environment
- install_keymaps yes
- install_zoneinfo
- # Install nproc to determine # of CPUs for correct parallelization
- inst_binary nproc
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/testsuite.sh
-Type=oneshot
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- )
- setup_nspawn_root
-
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service
-}
-
-do_test "$@"
+do_test "$@" 24
diff --git a/test/TEST-25-IMPORT/test.sh b/test/TEST-25-IMPORT/test.sh
index 14265cdfc5..034b94ca79 100755
--- a/test/TEST-25-IMPORT/test.sh
+++ b/test/TEST-25-IMPORT/test.sh
@@ -4,30 +4,4 @@ TEST_DESCRIPTION="test importd"
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- dracut_install dd gunzip mv tar diff
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/testsuite.sh
-Type=oneshot
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- )
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 25
diff --git a/test/TEST-26-SETENV/test.sh b/test/TEST-26-SETENV/test.sh
index ee0f562277..158fa6fdc0 100755
--- a/test/TEST-26-SETENV/test.sh
+++ b/test/TEST-26-SETENV/test.sh
@@ -4,29 +4,4 @@ TEST_DESCRIPTION="test setenv"
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/bin/bash -x /testsuite.sh
-Type=oneshot
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- )
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 26
diff --git a/test/TEST-27-STDOUTFILE/test.sh b/test/TEST-27-STDOUTFILE/test.sh
index 66c98e5675..23aadf314e 100755
--- a/test/TEST-27-STDOUTFILE/test.sh
+++ b/test/TEST-27-STDOUTFILE/test.sh
@@ -4,31 +4,4 @@ TEST_DESCRIPTION="test StandardOutput=file:"
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
- inst_binary cmp
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/testsuite.sh
-Type=oneshot
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- )
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 27
diff --git a/test/TEST-28-PERCENTJ-WANTEDBY/test.sh b/test/TEST-28-PERCENTJ-WANTEDBY/test.sh
index 934e1bc70c..09baf22776 100755
--- a/test/TEST-28-PERCENTJ-WANTEDBY/test.sh
+++ b/test/TEST-28-PERCENTJ-WANTEDBY/test.sh
@@ -5,52 +5,4 @@ RUN_IN_UNPRIVILEGED_CONTAINER=yes
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- # Create what will eventually be our root filesystem onto an overlay
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
-
- # Set up the services.
- cat >$initdir/etc/systemd/system/specifier-j-wants.service << EOF
-[Unit]
-Description=Wants with percent-j specifier
-Wants=specifier-j-depends-%j.service
-After=specifier-j-depends-%j.service
-
-[Service]
-Type=oneshot
-ExecStart=test -f /tmp/test-specifier-j-%j
-ExecStart=/bin/sh -c 'echo OK > /testok'
-EOF
- cat >$initdir/etc/systemd/system/specifier-j-depends-wants.service << EOF
-[Unit]
-Description=Dependent service for percent-j specifier
-
-[Service]
-Type=oneshot
-ExecStart=touch /tmp/test-specifier-j-wants
-EOF
- cat >$initdir/etc/systemd/system/testsuite.service << EOF
-[Unit]
-Description=Testsuite: Ensure %j Wants directives work
-Wants=specifier-j-wants.service
-After=specifier-j-wants.service
-
-[Service]
-Type=oneshot
-ExecStart=/bin/true
-EOF
-
- setup_testsuite
- )
-
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 28
diff --git a/test/TEST-29-UDEV-ID_RENAMING/test.sh b/test/TEST-29-UDEV-ID_RENAMING/test.sh
index fb570b0347..4feafc04d7 100755
--- a/test/TEST-29-UDEV-ID_RENAMING/test.sh
+++ b/test/TEST-29-UDEV-ID_RENAMING/test.sh
@@ -6,29 +6,4 @@ TEST_NO_NSPAWN=1
. $TEST_BASE_DIR/test-functions
QEMU_TIMEOUT=300
-test_setup() {
- create_empty_image_rootdir
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/bin/bash -x /testsuite.sh
-Type=oneshot
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- )
-}
-
-do_test "$@"
+do_test "$@" 29
diff --git a/test/TEST-30-ONCLOCKCHANGE/test.sh b/test/TEST-30-ONCLOCKCHANGE/test.sh
index 9e2c11238c..4723e7b0be 100755
--- a/test/TEST-30-ONCLOCKCHANGE/test.sh
+++ b/test/TEST-30-ONCLOCKCHANGE/test.sh
@@ -2,42 +2,6 @@
set -e
TEST_DESCRIPTION="test OnClockChange= + OnTimezoneChange="
TEST_NO_NSPAWN=1
-
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- inst_any /usr/share/zoneinfo/Europe/Kiev
- inst_any /usr/share/zoneinfo/Europe/Berlin
-
- setup_basic_environment
- mask_supporting_services
-
- # extend the watchdog
- mkdir -p $initdir/etc/systemd/system/systemd-timedated.service.d
- cat >$initdir/etc/systemd/system/systemd-timedated.service.d/watchdog.conf <<EOF
-[Service]
-WatchdogSec=10min
-EOF
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/testsuite.sh
-Type=oneshot
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- )
-}
-
-do_test "$@"
+do_test "$@" 30
diff --git a/test/TEST-31-DEVICE-ENUMERATION/test.sh b/test/TEST-31-DEVICE-ENUMERATION/test.sh
index 7bc9298dc1..4fbd38d2d0 100755
--- a/test/TEST-31-DEVICE-ENUMERATION/test.sh
+++ b/test/TEST-31-DEVICE-ENUMERATION/test.sh
@@ -6,29 +6,4 @@ TEST_NO_NSPAWN=1
. $TEST_BASE_DIR/test-functions
QEMU_TIMEOUT=300
-test_setup() {
- create_empty_image_rootdir
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/bin/bash -x /testsuite.sh
-Type=oneshot
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- )
-}
-
-do_test "$@"
+do_test "$@" 31
diff --git a/test/TEST-32-OOMPOLICY/test.sh b/test/TEST-32-OOMPOLICY/test.sh
index 36aad419ea..6f2955cf62 100755
--- a/test/TEST-32-OOMPOLICY/test.sh
+++ b/test/TEST-32-OOMPOLICY/test.sh
@@ -2,35 +2,8 @@
set -e
TEST_DESCRIPTION="test OOM killer logic"
TEST_NO_NSPAWN=1
-
. $TEST_BASE_DIR/test-functions
UNIFIED_CGROUP_HIERARCHY=yes
-test_setup() {
- create_empty_image_rootdir
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/testsuite.sh
-Type=oneshot
-MemoryAccounting=yes
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- )
-}
-
-do_test "$@"
+do_test "$@" 32
diff --git a/test/TEST-33-CLEAN-UNIT/test.sh b/test/TEST-33-CLEAN-UNIT/test.sh
index 310cf7b145..64cb6aee59 100755
--- a/test/TEST-33-CLEAN-UNIT/test.sh
+++ b/test/TEST-33-CLEAN-UNIT/test.sh
@@ -3,33 +3,6 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh
set -e
TEST_DESCRIPTION="test CleanUnit"
-
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/bin/bash -x /testsuite.sh
-Type=oneshot
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- ) || return 1
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 33
diff --git a/test/TEST-34-DYNAMICUSERMIGRATE/test.sh b/test/TEST-34-DYNAMICUSERMIGRATE/test.sh
index ad299df420..0b2174a894 100755
--- a/test/TEST-34-DYNAMICUSERMIGRATE/test.sh
+++ b/test/TEST-34-DYNAMICUSERMIGRATE/test.sh
@@ -1,33 +1,6 @@
#!/usr/bin/env bash
set -e
TEST_DESCRIPTION="test migrating state directory from DynamicUser=1 to DynamicUser=0 and back"
-
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/bin/bash -x /testsuite.sh
-Type=oneshot
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- )
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 34
diff --git a/test/TEST-35-NETWORK-GENERATOR/Makefile b/test/TEST-35-NETWORK-GENERATOR/Makefile
deleted file mode 120000
index e9f93b1104..0000000000
--- a/test/TEST-35-NETWORK-GENERATOR/Makefile
+++ /dev/null
@@ -1 +0,0 @@
-../TEST-01-BASIC/Makefile \ No newline at end of file
diff --git a/test/TEST-35-NETWORK-GENERATOR/test.sh b/test/TEST-35-NETWORK-GENERATOR/test.sh
deleted file mode 100755
index 7853281850..0000000000
--- a/test/TEST-35-NETWORK-GENERATOR/test.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-set -e
-TEST_DESCRIPTION="network-generator tests"
-
-. $TEST_BASE_DIR/test-functions
-
-test_setup() {
- mkdir -p $TESTDIR/run/systemd/network
-}
-
-test_run() {
- local generator
-
- if [[ -x $BUILD_DIR/systemd-network-generator ]]; then
- generator=$BUILD_DIR/systemd-network-generator
- elif [[ -x /usr/lib/systemd/systemd-network-generator ]]; then
- generator=/usr/lib/systemd/systemd-network-generator
- elif [[ -x /lib/systemd/systemd-network-generator ]]; then
- generator=/lib/systemd/systemd-network-generator
- else
- exit 1
- fi
-
- for f in test-*.input; do
- echo "*** Running $f"
- rm -f $TESTDIR/run/systemd/network/*
- $generator --root $TESTDIR -- $(cat $f)
-
- if ! diff -u $TESTDIR/run/systemd/network ${f%.input}.expected; then
- echo "**** Unexpected output for $f"
- exit 1
- fi
- done
-}
-
-do_test "$@"
diff --git a/test/TEST-36-NUMAPOLICY/test.sh b/test/TEST-36-NUMAPOLICY/test.sh
index 29addc958b..02f013568c 100755
--- a/test/TEST-36-NUMAPOLICY/test.sh
+++ b/test/TEST-36-NUMAPOLICY/test.sh
@@ -4,34 +4,6 @@ set -e
TEST_DESCRIPTION="test MUMAPolicy= and NUMAMask= options"
TEST_NO_NSPAWN=1
QEMU_OPTIONS="-numa node,nodeid=0"
-
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
- dracut_install mktemp
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/bin/bash -x /testsuite.sh
-Type=oneshot
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- )
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 36
diff --git a/test/TEST-37-RUNTIMEDIRECTORYPRESERVE/test.sh b/test/TEST-37-RUNTIMEDIRECTORYPRESERVE/test.sh
index 2c5ad430b5..b5806c429f 100755
--- a/test/TEST-37-RUNTIMEDIRECTORYPRESERVE/test.sh
+++ b/test/TEST-37-RUNTIMEDIRECTORYPRESERVE/test.sh
@@ -3,33 +3,6 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh
set -e
TEST_DESCRIPTION="test RuntimeDirectoryPreserve=yes"
-
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/bin/bash -x /testsuite.sh
-Type=oneshot
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- ) || return 1
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 37
diff --git a/test/TEST-39-EXECRELOAD/test.sh b/test/TEST-39-EXECRELOAD/test.sh
index ac1d0c9cf6..e38a9902ce 100755
--- a/test/TEST-39-EXECRELOAD/test.sh
+++ b/test/TEST-39-EXECRELOAD/test.sh
@@ -1,35 +1,6 @@
#!/usr/bin/env bash
set -e
TEST_DESCRIPTION="Test ExecReload= (PR #13098)"
-
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- # Create what will eventually be our root filesystem onto an overlay
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
- dracut_install mktemp
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/bin/bash -x /testsuite.sh
-Type=oneshot
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- )
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 39
diff --git a/test/TEST-40-EXEC-COMMAND-EX/test.sh b/test/TEST-40-EXEC-COMMAND-EX/test.sh
index a7933b0070..4ee84d4d35 100755
--- a/test/TEST-40-EXEC-COMMAND-EX/test.sh
+++ b/test/TEST-40-EXEC-COMMAND-EX/test.sh
@@ -1,33 +1,6 @@
#!/usr/bin/env bash
set -e
TEST_DESCRIPTION="test ExecXYZEx= service unit dbus hookups"
-
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/testsuite.sh
-Type=oneshot
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- )
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 40
diff --git a/test/TEST-41-ONESHOT-RESTART/test.sh b/test/TEST-41-ONESHOT-RESTART/test.sh
index 54292c0ca2..d3f96ae107 100755
--- a/test/TEST-41-ONESHOT-RESTART/test.sh
+++ b/test/TEST-41-ONESHOT-RESTART/test.sh
@@ -3,30 +3,4 @@ set -e
TEST_DESCRIPTION="Test oneshot unit restart on failure"
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/testsuite.sh
-Type=oneshot
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- )
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 41
diff --git a/test/TEST-42-EXECSTOPPOST/test.sh b/test/TEST-42-EXECSTOPPOST/test.sh
index 0c393597c7..53e6fa3dd0 100755
--- a/test/TEST-42-EXECSTOPPOST/test.sh
+++ b/test/TEST-42-EXECSTOPPOST/test.sh
@@ -4,46 +4,4 @@ TEST_DESCRIPTION="test that ExecStopPost= is always run"
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
-
- mask_supporting_services
-
- # setup policy for Type=dbus test
- mkdir -p $initdir/etc/dbus-1/system.d
- cat > $initdir/etc/dbus-1/system.d/systemd.test.ExecStopPost.conf <<EOF
-<?xml version="1.0"?>
-<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-<busconfig>
- <policy user="root">
- <allow own="systemd.test.ExecStopPost"/>
- </policy>
-</busconfig>
-EOF
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-Before=getty-pre.target
-Wants=getty-pre.target
-
-[Service]
-ExecStart=/testsuite.sh
-Type=oneshot
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- )
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 42
diff --git a/test/TEST-43-PRIVATEUSER-UNPRIV/test.sh b/test/TEST-43-PRIVATEUSER-UNPRIV/test.sh
index 3b40bf7d8b..4749150ff1 100755
--- a/test/TEST-43-PRIVATEUSER-UNPRIV/test.sh
+++ b/test/TEST-43-PRIVATEUSER-UNPRIV/test.sh
@@ -3,47 +3,6 @@ set -e
TEST_DESCRIPTION="Test PrivateUsers=yes on user manager"
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- inst_binary stat
-
- mask_supporting_services
-
- # Allocate user for running test case under
- mkdir -p $initdir/etc/sysusers.d
- cat >$initdir/etc/sysusers.d/testuser.conf <<EOF
-u testuser 4711 "Test User" /home/testuser
-EOF
-
- mkdir -p $initdir/home/testuser -m 0700
- chown 4711:4711 $initdir/home/testuser
-
- enable_user_manager testuser
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-After=systemd-logind.service user@4711.service
-Wants=user@4711.service
-
-[Service]
-ExecStart=/testsuite.sh
-Type=oneshot
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- )
- setup_nspawn_root
-}
-
has_user_dbus_socket || exit 0
-do_test "$@"
+do_test "$@" 43
diff --git a/test/TEST-44-LOG-NAMESPACE/test.sh b/test/TEST-44-LOG-NAMESPACE/test.sh
index c2070f2b61..26d863708e 100755
--- a/test/TEST-44-LOG-NAMESPACE/test.sh
+++ b/test/TEST-44-LOG-NAMESPACE/test.sh
@@ -4,36 +4,4 @@ TEST_DESCRIPTION="test log namespaces"
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
-
- mask_supporting_services
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-Before=getty-pre.target
-Wants=getty-pre.target
-Wants=systemd-journald@foobar.socket systemd-journald-varlink@foobar.socket
-After=systemd-journald@foobar.socket systemd-journald-varlink@foobar.socket
-
-[Service]
-ExecStart=/testsuite.sh
-Type=oneshot
-LogTarget=foobar
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- )
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 44
diff --git a/test/TEST-45-REPART/Makefile b/test/TEST-45-REPART/Makefile
deleted file mode 120000
index e9f93b1104..0000000000
--- a/test/TEST-45-REPART/Makefile
+++ /dev/null
@@ -1 +0,0 @@
-../TEST-01-BASIC/Makefile \ No newline at end of file
diff --git a/test/TEST-45-REPART/test.sh b/test/TEST-45-REPART/test.sh
deleted file mode 100755
index e7015d57e0..0000000000
--- a/test/TEST-45-REPART/test.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env bash
-set -e
-TEST_DESCRIPTION="test systemd-repart"
-
-. $TEST_BASE_DIR/test-functions
-
-test_setup() {
- create_empty_image_rootdir
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
-
- mask_supporting_services
- dracut_install truncate sfdisk grep
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-Before=getty-pre.target
-Wants=getty-pre.target
-
-[Service]
-ExecStart=/testsuite.sh
-Type=oneshot
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- )
- setup_nspawn_root
-}
-
-do_test "$@"
diff --git a/test/TEST-45-REPART/testsuite.sh b/test/TEST-45-REPART/testsuite.sh
deleted file mode 100755
index 804faefe78..0000000000
--- a/test/TEST-45-REPART/testsuite.sh
+++ /dev/null
@@ -1,120 +0,0 @@
-#!/usr/bin/env bash
-set -ex
-
-# Check if repart is installed, and if it isn't bail out early instead of failing
-if ! test -x /usr/bin/systemd-repart ; then
- echo OK > /testok
- exit 0
-fi
-
-systemd-analyze log-level debug
-
-truncate -s 1G /tmp/zzz
-
-SEED=e2a40bf9-73f1-4278-9160-49c031e7aef8
-
-systemd-repart /tmp/zzz --empty=force --dry-run=no --seed=$SEED
-
-sfdisk -d /tmp/zzz | grep -v -e 'sector-size' -e '^$' > /tmp/empty
-
-cmp /tmp/empty - <<EOF
-label: gpt
-label-id: EF7F7EE2-47B3-4251-B1A1-09EA8BF12D5D
-device: /tmp/zzz
-unit: sectors
-first-lba: 2048
-last-lba: 2097118
-EOF
-
-mkdir /tmp/definitions
-
-cat > /tmp/definitions/root.conf <<EOF
-[Partition]
-Type=root
-EOF
-
-ln -s root.conf /tmp/definitions/root2.conf
-
-cat > /tmp/definitions/home.conf <<EOF
-[Partition]
-Type=home
-EOF
-
-cat > /tmp/definitions/swap.conf <<EOF
-[Partition]
-Type=swap
-SizeMaxBytes=64M
-PaddingMinBytes=92M
-EOF
-
-systemd-repart /tmp/zzz --dry-run=no --seed=$SEED --definitions=/tmp/definitions
-
-sfdisk -d /tmp/zzz | grep -v -e 'sector-size' -e '^$' > /tmp/populated
-
-cmp /tmp/populated - <<EOF
-label: gpt
-label-id: EF7F7EE2-47B3-4251-B1A1-09EA8BF12D5D
-device: /tmp/zzz
-unit: sectors
-first-lba: 2048
-last-lba: 2097118
-/tmp/zzz1 : start= 2048, size= 591856, type=933AC7E1-2EB4-4F13-B844-0E14E2AEF915, uuid=A6005774-F558-4330-A8E5-D6D2C01C01D6, name="home"
-/tmp/zzz2 : start= 593904, size= 591856, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=CE9C76EB-A8F1-40FF-813C-11DCA6C0A55B, name="root-x86-64"
-/tmp/zzz3 : start= 1185760, size= 591864, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=AC60A837-550C-43BD-B5C4-9CB73B884E79, name="root-x86-64-2"
-/tmp/zzz4 : start= 1777624, size= 131072, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F, uuid=2AA78CDB-59C7-4173-AF11-C7453737A5D1, name="swap"
-EOF
-
-cat > /tmp/definitions/swap.conf <<EOF
-[Partition]
-Type=swap
-SizeMaxBytes=64M
-EOF
-
-cat > /tmp/definitions/extra.conf <<EOF
-[Partition]
-Type=linux-generic
-EOF
-
-systemd-repart /tmp/zzz --dry-run=no --seed=$SEED --definitions=/tmp/definitions
-
-sfdisk -d /tmp/zzz | grep -v -e 'sector-size' -e '^$' > /tmp/populated2
-
-cmp /tmp/populated2 - <<EOF
-label: gpt
-label-id: EF7F7EE2-47B3-4251-B1A1-09EA8BF12D5D
-device: /tmp/zzz
-unit: sectors
-first-lba: 2048
-last-lba: 2097118
-/tmp/zzz1 : start= 2048, size= 591856, type=933AC7E1-2EB4-4F13-B844-0E14E2AEF915, uuid=A6005774-F558-4330-A8E5-D6D2C01C01D6, name="home"
-/tmp/zzz2 : start= 593904, size= 591856, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=CE9C76EB-A8F1-40FF-813C-11DCA6C0A55B, name="root-x86-64"
-/tmp/zzz3 : start= 1185760, size= 591864, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=AC60A837-550C-43BD-B5C4-9CB73B884E79, name="root-x86-64-2"
-/tmp/zzz4 : start= 1777624, size= 131072, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F, uuid=2AA78CDB-59C7-4173-AF11-C7453737A5D1, name="swap"
-/tmp/zzz5 : start= 1908696, size= 188416, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=03477476-06AD-44E8-9EF4-BC2BD7771289, name="linux-generic"
-EOF
-
-truncate -s 2G /tmp/zzz
-
-systemd-repart /tmp/zzz --dry-run=no --seed=$SEED --definitions=/tmp/definitions
-
-sfdisk -d /tmp/zzz | grep -v -e 'sector-size' -e '^$' > /tmp/populated3
-
-cmp /tmp/populated3 - <<EOF
-label: gpt
-label-id: EF7F7EE2-47B3-4251-B1A1-09EA8BF12D5D
-device: /tmp/zzz
-unit: sectors
-first-lba: 2048
-last-lba: 4194270
-/tmp/zzz1 : start= 2048, size= 591856, type=933AC7E1-2EB4-4F13-B844-0E14E2AEF915, uuid=A6005774-F558-4330-A8E5-D6D2C01C01D6, name="home"
-/tmp/zzz2 : start= 593904, size= 591856, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=CE9C76EB-A8F1-40FF-813C-11DCA6C0A55B, name="root-x86-64"
-/tmp/zzz3 : start= 1185760, size= 591864, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=AC60A837-550C-43BD-B5C4-9CB73B884E79, name="root-x86-64-2"
-/tmp/zzz4 : start= 1777624, size= 131072, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F, uuid=2AA78CDB-59C7-4173-AF11-C7453737A5D1, name="swap"
-/tmp/zzz5 : start= 1908696, size= 2285568, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=03477476-06AD-44E8-9EF4-BC2BD7771289, name="linux-generic"
-EOF
-
-systemd-analyze log-level info
-
-echo OK > /testok
-
-exit 0
diff --git a/test/TEST-46-HOMED/test.sh b/test/TEST-46-HOMED/test.sh
index 99fd5b85b8..877cbfefd0 100755
--- a/test/TEST-46-HOMED/test.sh
+++ b/test/TEST-46-HOMED/test.sh
@@ -5,38 +5,4 @@ TEST_NO_QEMU=1
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image
- mkdir -p $TESTDIR/root
- mount ${LOOPDEV}p1 $TESTDIR/root
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-Before=getty-pre.target
-Wants=getty-pre.target
-
-[Service]
-ExecStart=/bin/bash -x /testsuite.sh
-Type=oneshot
-NotifyAccess=all
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
- ) || return 1
- setup_nspawn_root
-
- ddebug "umount $TESTDIR/root"
- umount $TESTDIR/root
-}
-
-do_test "$@"
+do_test "$@" 46
diff --git a/test/TEST-47-ISSUE-14566/test.sh b/test/TEST-47-ISSUE-14566/test.sh
index 35f862331c..11ae3d2524 100755
--- a/test/TEST-47-ISSUE-14566/test.sh
+++ b/test/TEST-47-ISSUE-14566/test.sh
@@ -1,43 +1,6 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
TEST_DESCRIPTION="Test that KillMode=mixed does not leave left over proccesses with ExecStopPost="
. $TEST_BASE_DIR/test-functions
-test_setup() {
- create_empty_image_rootdir
-
- (
- LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
-
- setup_basic_environment
- mask_supporting_services
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/testsuite.sh
-Type=oneshot
-EOF
- cat > $initdir/etc/systemd/system/issue_14566_test.service << EOF
-[Unit]
-Description=Issue 14566 Repro
-
-[Service]
-ExecStart=/repro.sh
-ExecStopPost=/bin/true
-KillMode=mixed
-EOF
-
- cp testsuite.sh $initdir/
- cp repro.sh $initdir/
-
- setup_testsuite
- )
- setup_nspawn_root
-}
-
-do_test "$@"
+do_test "$@" 47
diff --git a/test/basic.target b/test/basic.target
deleted file mode 120000
index 0612934682..0000000000
--- a/test/basic.target
+++ /dev/null
@@ -1 +0,0 @@
-../units/basic.target \ No newline at end of file
diff --git a/test/TEST-13-NSPAWN-SMOKE/create-busybox-container b/test/create-busybox-container
index 08fb5d4aa6..08fb5d4aa6 100755
--- a/test/TEST-13-NSPAWN-SMOKE/create-busybox-container
+++ b/test/create-busybox-container
diff --git a/test/loopy2.service b/test/loopy2.service
deleted file mode 120000
index 961b1fe9bc..0000000000
--- a/test/loopy2.service
+++ /dev/null
@@ -1 +0,0 @@
-loopy.service \ No newline at end of file
diff --git a/test/loopy4.service b/test/loopy4.service
deleted file mode 120000
index 43e5658bcd..0000000000
--- a/test/loopy4.service
+++ /dev/null
@@ -1 +0,0 @@
-loopy3.service \ No newline at end of file
diff --git a/test/meson.build b/test/meson.build
index 2fbea31ccd..404b923467 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -1,236 +1,56 @@
# SPDX-License-Identifier: LGPL-2.1+
-test_data_files = '''
- a.service
- a-conj.service
- b.service
- basic.target
- c.service
- d.service
- daughter.service
- dml.slice
- dml-passthrough.slice
- dml-passthrough-empty.service
- dml-passthrough-set-dml.service
- dml-passthrough-set-ml.service
- dml-override.slice
- dml-override-empty.service
- dml-discard.slice
- dml-discard-empty.service
- dml-discard-set-ml.service
- e.service
- end.service
- f.service
- g.service
- grandchild.service
- h.service
- hello-after-sleep.target
- hello.service
- hwdb.d/10-bad.hwdb
- i.service
- journal-data/journal-1.txt
- journal-data/journal-2.txt
- nomem.slice
- nomemleaf.service
- parent-deep.slice
- parent.slice
- sched_idle_bad.service
- sched_idle_ok.service
- sched_rr_bad.service
- sched_rr_change.service
- sched_rr_ok.service
- shutdown.target
- sleep.service
- sockets.target
- son.service
- sysinit.target
- test-execute/exec-basic.service
- test-execute/exec-ambientcapabilities-merge-nfsnobody.service
- test-execute/exec-ambientcapabilities-merge-nobody.service
- test-execute/exec-ambientcapabilities-merge.service
- test-execute/exec-ambientcapabilities-nfsnobody.service
- test-execute/exec-ambientcapabilities-nobody.service
- test-execute/exec-ambientcapabilities.service
- test-execute/exec-bindpaths.service
- test-execute/exec-capabilityboundingset-invert.service
- test-execute/exec-capabilityboundingset-merge.service
- test-execute/exec-capabilityboundingset-reset.service
- test-execute/exec-capabilityboundingset-simple.service
- test-execute/exec-condition-failed.service
- test-execute/exec-condition-skip.service
- test-execute/exec-cpuaffinity1.service
- test-execute/exec-cpuaffinity2.service
- test-execute/exec-cpuaffinity3.service
- test-execute/exec-dynamicuser-fixeduser-adm.service
- test-execute/exec-dynamicuser-fixeduser-games.service
- test-execute/exec-dynamicuser-fixeduser-one-supplementarygroup.service
- test-execute/exec-dynamicuser-fixeduser.service
- test-execute/exec-dynamicuser-statedir-migrate-step1.service
- test-execute/exec-dynamicuser-statedir-migrate-step2.service
- test-execute/exec-dynamicuser-statedir.service
- test-execute/exec-dynamicuser-supplementarygroups.service
- test-execute/exec-environment-no-substitute.service
- test-execute/exec-environment-empty.service
- test-execute/exec-environment-multiple.service
- test-execute/exec-environment.service
- test-execute/exec-environmentfile.service
- test-execute/exec-group-nfsnobody.service
- test-execute/exec-group-nobody.service
- test-execute/exec-group-nogroup.service
- test-execute/exec-group.service
- test-execute/exec-ignoresigpipe-no.service
- test-execute/exec-ignoresigpipe-yes.service
- test-execute/exec-inaccessiblepaths-mount-propagation.service
- test-execute/exec-inaccessiblepaths-sys.service
- test-execute/exec-ioschedulingclass-best-effort.service
- test-execute/exec-ioschedulingclass-idle.service
- test-execute/exec-ioschedulingclass-none.service
- test-execute/exec-ioschedulingclass-realtime.service
- test-execute/exec-oomscoreadjust-negative.service
- test-execute/exec-oomscoreadjust-positive.service
- test-execute/exec-passenvironment-absent.service
- test-execute/exec-passenvironment-empty.service
- test-execute/exec-passenvironment-repeated.service
- test-execute/exec-passenvironment.service
- test-execute/exec-personality-aarch64.service
- test-execute/exec-personality-ppc64.service
- test-execute/exec-personality-ppc64le.service
- test-execute/exec-personality-s390.service
- test-execute/exec-personality-x86-64.service
- test-execute/exec-personality-x86.service
- test-execute/exec-privatedevices-disabled-by-prefix.service
- test-execute/exec-privatedevices-no-capability-mknod.service
- test-execute/exec-privatedevices-no-capability-sys-rawio.service
- test-execute/exec-privatedevices-no.service
- test-execute/exec-privatedevices-yes-with-group.service
- test-execute/exec-privatedevices-yes-capability-mknod.service
- test-execute/exec-privatedevices-yes-capability-sys-rawio.service
- test-execute/exec-privatedevices-yes.service
- test-execute/exec-privatenetwork-yes.service
- test-execute/exec-privatetmp-no.service
- test-execute/exec-privatetmp-yes.service
- test-execute/exec-privatetmp-disabled-by-prefix.service
- test-execute/exec-protecthome-tmpfs-vs-protectsystem-strict.service
- test-execute/exec-protectkernellogs-yes-capabilities.service
- test-execute/exec-protectkernellogs-no-capabilities.service
- test-execute/exec-protectkernelmodules-no-capabilities.service
- test-execute/exec-protectkernelmodules-yes-capabilities.service
- test-execute/exec-protectkernelmodules-yes-mount-propagation.service
- test-execute/exec-readonlypaths-mount-propagation.service
- test-execute/exec-readonlypaths-simple.service
- test-execute/exec-readonlypaths-with-bindpaths.service
- test-execute/exec-readonlypaths.service
- test-execute/exec-readwritepaths-mount-propagation.service
- test-execute/exec-restrictnamespaces-merge-all.service
- test-execute/exec-restrictnamespaces-merge-and.service
- test-execute/exec-restrictnamespaces-merge-or.service
- test-execute/exec-restrictnamespaces-mnt-blacklist.service
- test-execute/exec-restrictnamespaces-mnt.service
- test-execute/exec-restrictnamespaces-no.service
- test-execute/exec-restrictnamespaces-yes.service
- test-execute/exec-runtimedirectory-mode.service
- test-execute/exec-runtimedirectory-owner-nfsnobody.service
- test-execute/exec-runtimedirectory-owner-nobody.service
- test-execute/exec-runtimedirectory-owner-nogroup.service
- test-execute/exec-runtimedirectory-owner.service
- test-execute/exec-runtimedirectory.service
- test-execute/exec-specifier-interpolation.service
- test-execute/exec-specifier.service
- test-execute/exec-specifier@.service
- test-execute/exec-standardinput-data.service
- test-execute/exec-standardinput-file.service
- test-execute/exec-standardinput-file-cat.service
- test-execute/exec-standardoutput-file.service
- test-execute/exec-standardoutput-append.service
- test-execute/exec-supplementarygroups-multiple-groups-default-group-user.service
- test-execute/exec-supplementarygroups-multiple-groups-withgid.service
- test-execute/exec-supplementarygroups-multiple-groups-withuid.service
- test-execute/exec-supplementarygroups-single-group-user.service
- test-execute/exec-supplementarygroups-single-group.service
- test-execute/exec-supplementarygroups.service
- test-execute/exec-systemcallerrornumber-name.service
- test-execute/exec-systemcallerrornumber-number.service
- test-execute/exec-systemcallfilter-failing.service
- test-execute/exec-systemcallfilter-failing2.service
- test-execute/exec-systemcallfilter-not-failing.service
- test-execute/exec-systemcallfilter-not-failing2.service
- test-execute/exec-systemcallfilter-system-user-nfsnobody.service
- test-execute/exec-systemcallfilter-system-user-nobody.service
- test-execute/exec-systemcallfilter-system-user.service
- test-execute/exec-systemcallfilter-with-errno-multi.service
- test-execute/exec-systemcallfilter-with-errno-name.service
- test-execute/exec-systemcallfilter-with-errno-number.service
- test-execute/exec-temporaryfilesystem-options.service
- test-execute/exec-temporaryfilesystem-ro.service
- test-execute/exec-temporaryfilesystem-rw.service
- test-execute/exec-temporaryfilesystem-usr.service
- test-execute/exec-umask-0177.service
- test-execute/exec-umask-default.service
- test-execute/exec-unsetenvironment.service
- test-execute/exec-user-nfsnobody.service
- test-execute/exec-user-nobody.service
- test-execute/exec-user.service
- test-execute/exec-workingdirectory.service
- test-execute/exec-workingdirectory-trailing-dot.service
- test-path/basic.target
- test-path/path-changed.path
- test-path/path-changed.service
- test-path/path-directorynotempty.path
- test-path/path-directorynotempty.service
- test-path/path-exists.path
- test-path/path-exists.service
- test-path/path-existsglob.path
- test-path/path-existsglob.service
- test-path/path-makedirectory.path
- test-path/path-makedirectory.service
- test-path/path-modified.path
- test-path/path-modified.service
- test-path/path-mycustomunit.service
- test-path/path-service.service
- test-path/path-unit.path
- test-path/paths.target
- test-path/sysinit.target
- test-umount/empty.mountinfo
- test-umount/example.swaps
- test-umount/garbled.mountinfo
- test-umount/rhbug-1554943.mountinfo
- testsuite.target
- timers.target
- unit-with-.service.d/20-override.conf
- unit-with-multiple-.service.d/20-override.conf
- unit-with-multiple-.service.d/30-override.conf
- unit-with-multiple-dashes.service
- unit-with-multiple-dashes.service.d/10-override.conf
- unstoppable.service
-'''.split()
+testdata_dir = testsdir + '/testdata/'
+
+install_subdir('journal-data',
+ install_dir : testdata_dir)
+install_subdir('units',
+ install_dir : testdata_dir)
+install_subdir('test-execute',
+ install_dir : testdata_dir)
+install_subdir('test-path',
+ install_dir : testdata_dir)
+install_subdir('test-umount',
+ install_dir : testdata_dir)
+install_subdir('test-network-generator-conversion',
+ install_dir : testdata_dir)
+install_subdir('testsuite-04.units',
+ install_dir : testdata_dir)
+install_subdir('testsuite-06.units',
+ install_dir : testdata_dir)
+install_subdir('testsuite-10.units',
+ install_dir : testdata_dir)
+install_subdir('testsuite-11.units',
+ install_dir : testdata_dir)
+install_subdir('testsuite-16.units',
+ install_dir : testdata_dir)
+install_subdir('testsuite-28.units',
+ install_dir : testdata_dir)
+install_subdir('testsuite-30.units',
+ install_dir : testdata_dir)
+
+testsuite08_dir = testdata_dir + '/testsuite-08.units'
+install_data('testsuite-08.units/-.mount',
+ install_dir : testsuite08_dir)
+install_data('testsuite-08.units/systemd-remount-fs.service',
+ install_dir : testsuite08_dir)
+meson.add_install_script(meson_make_symlink,
+ './-.mount',
+ testsuite08_dir + '/root.mount')
+meson.add_install_script(meson_make_symlink,
+ '../-.mount',
+ testsuite08_dir + '/local-fs.target.wants/-.mount')
if conf.get('ENABLE_RESOLVE') == 1
- test_data_files += '''
- test-resolve/_openpgpkey.fedoraproject.org.pkts
- test-resolve/fedoraproject.org.pkts
- test-resolve/gandi.net.pkts
- test-resolve/google.com.pkts
- test-resolve/root.pkts
- test-resolve/sw1a1aa-sw1a2aa-sw1a2ab-sw1a2ac.find.me.uk.pkts
- test-resolve/teamits.com.pkts
- test-resolve/zbyszek@fedoraproject.org.pkts
- test-resolve/_443._tcp.fedoraproject.org.pkts
- test-resolve/kyhwana.org.pkts
- test-resolve/fake-caa.pkts
- '''.split()
+ install_subdir('test-resolve',
+ install_dir : testdata_dir)
endif
-if install_tests
- foreach file : test_data_files
- subdir = file.split('/')[0]
- if subdir == file
- subdir = ''
- endif
+install_data('create-busybox-container',
+ install_mode : 'rwxr-xr-x',
+ install_dir : testdata_dir)
- install_data(file,
- install_dir : testsdir + '/testdata/' + subdir)
- endforeach
-endif
+test_network_generator_conversion_sh = find_program('test-network-generator-conversion.sh')
############################################################
@@ -257,6 +77,9 @@ if install_tests
install_data('run-unit-tests.py',
install_mode : 'rwxr-xr-x',
install_dir : testsdir)
+ install_data('test-network-generator-conversion.sh',
+ install_mode : 'rwxr-xr-x',
+ install_dir : testsdir)
endif
############################################################
diff --git a/test/run-integration-tests.sh b/test/run-integration-tests.sh
index c0a8448a88..bcbbb8b7ed 100755
--- a/test/run-integration-tests.sh
+++ b/test/run-integration-tests.sh
@@ -4,8 +4,10 @@ set -e
BUILD_DIR="$($(dirname "$0")/../tools/find-build-dir.sh)"
if [ $# -gt 0 ]; then
args="$@"
+ do_clean=0
else
- args="clean setup run clean-again"
+ args="setup run clean-again"
+ do_clean=1
fi
ninja -C "$BUILD_DIR"
@@ -16,6 +18,13 @@ COUNT=0
FAILURES=0
cd "$(dirname "$0")"
+
+if [ $do_clean = 1 ]; then
+ for TEST in TEST-??-* ; do
+ ( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" clean )
+ done
+fi
+
for TEST in TEST-??-* ; do
COUNT=$(($COUNT+1))
@@ -31,6 +40,12 @@ for TEST in TEST-??-* ; do
[ "$RESULT" -ne "0" ] && FAILURES=$(($FAILURES+1))
done
+if [ $FAILURES -eq 0 -a $do_clean = 1 ]; then
+ for TEST in TEST-??-* ; do
+ ( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" clean-again )
+ done
+fi
+
echo ""
for TEST in ${!results[@]}; do
diff --git a/test/shutdown.target b/test/shutdown.target
deleted file mode 120000
index 1a3c2eec84..0000000000
--- a/test/shutdown.target
+++ /dev/null
@@ -1 +0,0 @@
-../units/shutdown.target \ No newline at end of file
diff --git a/test/sockets.target b/test/sockets.target
deleted file mode 120000
index 8ff86a0775..0000000000
--- a/test/sockets.target
+++ /dev/null
@@ -1 +0,0 @@
-../units/sockets.target \ No newline at end of file
diff --git a/test/sysinit.target b/test/sysinit.target
deleted file mode 120000
index 3301338185..0000000000
--- a/test/sysinit.target
+++ /dev/null
@@ -1 +0,0 @@
-../units/sysinit.target \ No newline at end of file
diff --git a/test/test-functions b/test/test-functions
index 66cd60b559..ead815f2fa 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -14,8 +14,11 @@ NSPAWN_TIMEOUT="${NSPAWN_TIMEOUT:-infinity}"
TIMED_OUT= # will be 1 after run_* if *_TIMEOUT is set and test timed out
[[ "$LOOKS_LIKE_SUSE" ]] && FSTYPE="${FSTYPE:-btrfs}" || FSTYPE="${FSTYPE:-ext4}"
UNIFIED_CGROUP_HIERARCHY="${UNIFIED_CGROUP_HIERARCHY:-default}"
-EFI_MOUNT="$(bootctl -x 2>/dev/null || echo /boot)"
+EFI_MOUNT="${EFI_MOUNT:-$(bootctl -x 2>/dev/null || echo /boot)}"
QEMU_MEM="${QEMU_MEM:-512M}"
+IMAGE_NAME=${IMAGE_NAME:-default}
+TEST_REQUIRE_INSTALL_TESTS="${TEST_REQUIRE_INSTALL_TESTS:-1}"
+LOOPDEV=
# Decide if we can (and want to) run QEMU with KVM acceleration.
# Check if nested KVM is explicitly enabled (TEST_NESTED_KVM). If not,
@@ -39,11 +42,104 @@ PATH_TO_INIT=$ROOTLIBDIR/systemd
[ "$SYSTEMD_NSPAWN" ] || SYSTEMD_NSPAWN=$(which -a $BUILD_DIR/systemd-nspawn systemd-nspawn 2>/dev/null | grep '^/' -m1)
[ "$JOURNALCTL" ] || JOURNALCTL=$(which -a $BUILD_DIR/journalctl journalctl 2>/dev/null | grep '^/' -m1)
-BASICTOOLS="test env sh bash setsid loadkeys setfont login sulogin gzip sleep echo head tail cat mount umount cryptsetup date dmsetup modprobe sed cmp tee rm true false chmod chown ln xargs"
-DEBUGTOOLS="df free ls stty ps ln ip route dmesg dhclient mkdir cp ping dhclient strace less grep id tty touch du sort hostname find vi mv"
+BASICTOOLS=(
+ awk
+ basename
+ bash
+ busybox
+ capsh
+ cat
+ chmod
+ chown
+ cmp
+ cryptsetup
+ cut
+ date
+ dd
+ diff
+ dirname
+ dmsetup
+ echo
+ env
+ false
+ getent
+ getfacl
+ grep
+ gunzip
+ gzip
+ head
+ ionice
+ ip
+ ln
+ loadkeys
+ login
+ lz4cat
+ mkfifo
+ mktemp
+ modprobe
+ mount
+ mv
+ nc
+ nproc
+ readlink
+ rev
+ rm
+ rmdir
+ sed
+ seq
+ setfont
+ setsid
+ sfdisk
+ sh
+ sleep
+ socat
+ stat
+ su
+ sulogin
+ sysctl
+ tail
+ tar
+ tee
+ test
+ touch
+ tr
+ true
+ truncate
+ umount
+ uname
+ unshare
+ xargs
+ xzcat
+)
+
+DEBUGTOOLS=(
+ cp
+ df
+ dhclient
+ dmesg
+ du
+ find
+ free
+ grep
+ hostname
+ id
+ less
+ ln
+ ls
+ mkdir
+ ping
+ ps
+ route
+ sort
+ strace
+ stty
+ tty
+ vi
+)
STATEDIR="${BUILD_DIR:-.}/test/$(basename $(dirname $(realpath $0)))"
STATEFILE="$STATEDIR/.testdir"
+IMAGESTATEDIR="$STATEDIR/.."
TESTLOG="$STATEDIR/test.log"
is_built_with_asan() {
@@ -138,6 +234,10 @@ run_qemu() {
CONSOLE=ttyS0
+ # make sure the initdir is not mounted to avoid concurrent access
+ cleanup_initdir
+ umount_loopback
+
if [[ ! "$KERNEL_BIN" ]]; then
if [[ "$LOOKS_LIKE_ARCH" ]]; then
KERNEL_BIN=/boot/vmlinuz-linux
@@ -184,6 +284,9 @@ run_qemu() {
find_qemu_bin || return 1
+ # Umount initdir to avoid concurrent access to the filesystem
+ _umount_dir $initdir
+
local _cgroup_args
if [[ "$UNIFIED_CGROUP_HIERARCHY" = "yes" ]]; then
_cgroup_args="systemd.unified_cgroup_hierarchy=yes"
@@ -198,14 +301,18 @@ run_qemu() {
if [[ "$LOOKS_LIKE_SUSE" ]]; then
PARAMS+="rd.hostonly=0"
- elif [[ "$LOOKS_LIKE_ARCH" ]]; then
- PARAMS+="rw"
+ fi
+
+ local _end
+ if [[ ! "$INTERACTIVE_DEBUG" ]]; then
+ _end="systemd.wants=end.service"
else
- PARAMS+="ro"
+ _end=""
fi
KERNEL_APPEND="$PARAMS \
root=/dev/sda1 \
+rw \
raid=noautodetect \
rd.luks=0 \
loglevel=2 \
@@ -213,6 +320,9 @@ init=$PATH_TO_INIT \
console=$CONSOLE \
selinux=0 \
$_cgroup_args \
+SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/testsuite-$1.units:/usr/lib/systemd/tests/testdata/units: \
+systemd.unit=testsuite.target \
+systemd.wants=testsuite-$1.service ${_end} \
$KERNEL_APPEND \
"
@@ -221,7 +331,7 @@ $KERNEL_APPEND \
-m $QEMU_MEM \
-nographic \
-kernel $KERNEL_BIN \
--drive format=raw,cache=unsafe,file=${TESTDIR}/rootdisk.img \
+-drive format=raw,cache=unsafe,file=${IMAGESTATEDIR}/${IMAGE_NAME}.img \
$QEMU_OPTIONS \
"
@@ -253,24 +363,41 @@ $QEMU_OPTIONS \
run_nspawn() {
[[ -d /run/systemd/system ]] || return 1
- local _nspawn_cmd="$SYSTEMD_NSPAWN $NSPAWN_ARGUMENTS --register=no --kill-signal=SIGKILL --directory=$TESTDIR/$1 $PATH_TO_INIT $KERNEL_APPEND"
+ local _nspawn_cmd=(
+ --register=no
+ --kill-signal=SIGKILL
+ --directory=$1
+ --setenv=SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/testsuite-$2.units:/usr/lib/systemd/tests/testdata/units:
+ $PATH_TO_INIT
+ $KERNEL_APPEND
+ systemd.unit=testsuite.target
+ systemd.wants=testsuite-$2.service
+ )
+
+ if [[ ! "$INTERACTIVE_DEBUG" ]]; then
+ _nspawn_cmd+=( systemd.wants=end.service )
+ fi
+
+ local _nspawn_pre
if [[ "$NSPAWN_TIMEOUT" != "infinity" ]]; then
- _nspawn_cmd="timeout --foreground $NSPAWN_TIMEOUT $_nspawn_cmd"
+ _nspawn_pre=(timeout --foreground $NSPAWN_TIMEOUT)
+ else
+ _nspawn_pre=()
fi
if [[ "$UNIFIED_CGROUP_HIERARCHY" = "hybrid" ]]; then
dwarn "nspawn doesn't support SYSTEMD_NSPAWN_UNIFIED_HIERARCHY=hybrid, skipping"
exit
elif [[ "$UNIFIED_CGROUP_HIERARCHY" = "yes" || "$UNIFIED_CGROUP_HIERARCHY" = "no" ]]; then
- _nspawn_cmd="env SYSTEMD_NSPAWN_UNIFIED_HIERARCHY=$UNIFIED_CGROUP_HIERARCHY $_nspawn_cmd"
+ _nspawn_pre=("${nspawn_pre[@]}" env SYSTEMD_NSPAWN_UNIFIED_HIERARCHY=$UNIFIED_CGROUP_HIERARCHY)
elif [[ "$UNIFIED_CGROUP_HIERARCHY" = "default" ]]; then
- _nspawn_cmd="env --unset=UNIFIED_CGROUP_HIERARCHY --unset=SYSTEMD_NSPAWN_UNIFIED_HIERARCHY $_nspawn_cmd"
+ _nspawn_pre=("${nspawn_pre[@]}" env --unset=UNIFIED_CGROUP_HIERARCHY --unset=SYSTEMD_NSPAWN_UNIFIED_HIERARCHY)
else
dfatal "Unknown UNIFIED_CGROUP_HIERARCHY. Got $UNIFIED_CGROUP_HIERARCHY, expected [yes|no|hybrid|default]"
exit 1
fi
- (set -x; $_nspawn_cmd)
+ (set -x; "${_nspawn_pre[@]}" "$SYSTEMD_NSPAWN" $NSPAWN_ARGUMENTS "${_nspawn_cmd[@]}")
rc=$?
if [ "$rc" = 124 ] && [ "$NSPAWN_TIMEOUT" != "infinity" ]; then
derror "test timed out after $NSPAWN_TIMEOUT s"
@@ -288,6 +415,7 @@ setup_basic_environment() {
install_systemd
install_missing_libraries
install_config_files
+ install_zoneinfo
create_rc_local
install_basic_tools
install_libnss
@@ -301,6 +429,8 @@ setup_basic_environment() {
install_plymouth
install_debug_tools
install_ld_so_conf
+ install_testuser
+ has_user_dbus_socket && install_user_dbus
setup_selinux
strip_binaries
install_depmod_files
@@ -326,27 +456,9 @@ setup_selinux() {
exit 1
fi
- cat <<EOF >$initdir/etc/systemd/system/autorelabel.service
-[Unit]
-Description=Relabel all filesystems
-DefaultDependencies=no
-Requires=local-fs.target
-Conflicts=shutdown.target
-After=local-fs.target
-Before=sysinit.target shutdown.target
-ConditionSecurity=selinux
-ConditionPathExists=|/.autorelabel
-
-[Service]
-ExecStart=/bin/sh -x -c 'echo 0 >/sys/fs/selinux/enforce && fixfiles -f -F relabel && rm /.autorelabel && systemctl --force reboot'
-Type=oneshot
-TimeoutSec=0
-RemainAfterExit=yes
-EOF
-
touch $initdir/.autorelabel
- mkdir -p $initdir/etc/systemd/system/basic.target.wants
- ln -fs autorelabel.service $initdir/etc/systemd/system/basic.target.wants/autorelabel.service
+ mkdir -p $initdir/usr/lib/systemd/tests/testdata/units/basic.target.wants
+ ln -sf ../autorelabel.service $initdir/usr/lib/systemd/tests/testdata/units/basic.target.wants/
dracut_install $_fixfiles_tools
dracut_install fixfiles
@@ -475,7 +587,7 @@ unset_ld_preload() {
}
unset_ld_preload systemd-remount-fs
-unset_ld_preload testsuite
+unset_ld_preload testsuite-
export ASAN_OPTIONS=\$DEFAULT_ASAN_OPTIONS:log_path=/systemd.asan.log UBSAN_OPTIONS=\$DEFAULT_UBSAN_OPTIONS
exec $ROOTLIBDIR/systemd "\$@"
@@ -530,7 +642,7 @@ install_systemd() {
# and it could fill the available space
strip_binaries
- [[ "$LOOKS_LIKE_SUSE" ]] && setup_suse
+ [[ "$LOOKS_LIKE_SUSE" ]] && setup_suse
# enable debug logging in PID1
echo LogLevel=debug >> $initdir/etc/systemd/system.conf
@@ -556,17 +668,37 @@ install_missing_libraries() {
done
}
+cleanup_loopdev() {
+ if [ -n "${LOOPDEV}" ]; then
+ ddebug "losetup -d $LOOPDEV"
+ losetup -d "${LOOPDEV}"
+ fi
+}
+
+trap cleanup_loopdev EXIT
+
create_empty_image() {
+ if [ -z "$IMAGE_NAME" ]; then
+ echo "create_empty_image: \$IMAGE_NAME not set"
+ exit 1
+ fi
+
local _size=500
if [[ "$STRIP_BINARIES" = "no" ]]; then
_size=$((4*_size))
fi
- rm -f "$TESTDIR/rootdisk.img"
+
+ image="${TESTDIR}/${IMAGE_NAME}.img"
+ public="$IMAGESTATEDIR/${IMAGE_NAME}.img"
+ echo "Setting up $public (${_size} MB)"
+ rm -f "$image" "$public"
+
# Create the blank file to use as a root filesystem
- truncate -s "${_size}M" "$TESTDIR/rootdisk.img"
- LOOPDEV=$(losetup --show -P -f $TESTDIR/rootdisk.img)
+ truncate -s "${_size}M" "$image"
+ ln -vs "$(realpath $image)" "$public"
+
+ LOOPDEV=$(losetup --show -P -f "$public")
[ -b "$LOOPDEV" ] || return 1
- echo "LOOPDEV=$LOOPDEV" >> $STATEFILE
sfdisk "$LOOPDEV" <<EOF
,$((_size-50))M
,
@@ -574,20 +706,50 @@ EOF
udevadm settle
- local _label="-L systemd"
+ local _label="-L systemd.${name}"
# mkfs.reiserfs doesn't know -L. so, use --label instead
- [[ "$FSTYPE" == "reiserfs" ]] && _label="--label systemd"
- if ! mkfs -t "${FSTYPE}" ${_label} "${LOOPDEV}p1" -q; then
+ [[ "$FSTYPE" == "reiserfs" ]] && _label="--label systemd.${name}"
+ mkfs -t "${FSTYPE}" ${_label} "${LOOPDEV}p1" -q; ret=$?
+ if [ $ret -ne 0 ] ; then
dfatal "Failed to mkfs -t ${FSTYPE}"
exit 1
fi
}
+mount_initdir() {
+ if [ -z "${LOOPDEV}" ]; then
+ image="${IMAGESTATEDIR}/${IMAGE_NAME}.img"
+ LOOPDEV=$(losetup --show -P -f "$image")
+ [ -b "$LOOPDEV" ] || return 1
+
+ udevadm settle
+ fi
+
+ if ! mountpoint -q $initdir; then
+ mkdir -p $initdir
+ mount ${LOOPDEV}p1 $initdir
+ TEST_SETUP_CLEANUP_ROOTDIR=1
+ fi
+}
+
+cleanup_initdir() {
+ # only umount if create_empty_image_rootdir() was called to mount it
+ [[ -z $TEST_SETUP_CLEANUP_ROOTDIR ]] || _umount_dir $initdir
+}
+
+umount_loopback() {
+ # unmount the loopback device from all places. Otherwise we risk file
+ # system corruption.
+ image="${IMAGESTATEDIR}/${IMAGE_NAME}.img"
+ for device in $(losetup -l | awk '$6=="'"$image"'" {print $1}'); do
+ ddebug "Unmounting all uses of $device"
+ mount | awk '/^'"${device}"'p/{print $1}' | xargs --no-run-if-empty umount -v
+ done
+}
+
create_empty_image_rootdir() {
create_empty_image
- mkdir -p $initdir
- mount ${LOOPDEV}p1 $initdir
- TEST_SETUP_CLEANUP_ROOTDIR=1
+ mount_initdir
}
check_asan_reports() {
@@ -632,27 +794,29 @@ check_result_nspawn() {
local ret=1
local journald_report=""
local pids=""
- [[ -e $TESTDIR/$1/testok ]] && ret=0
- [[ -f $TESTDIR/$1/failed ]] && cp -a $TESTDIR/$1/failed $TESTDIR
- cp -a $TESTDIR/$1/var/log/journal $TESTDIR
+ [[ -e $1/testok ]] && ret=0
+ [[ -f $1/failed ]] && cp -a $1/failed $TESTDIR
+ cp -a $1/var/log/journal $TESTDIR
+ rm -r $1/var/log/journal/*
[[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed
ls -l $TESTDIR/journal/*/*.journal
test -s $TESTDIR/failed && ret=$(($ret+1))
[ -n "$TIMED_OUT" ] && ret=$(($ret+1))
- check_asan_reports "$TESTDIR/$1" || ret=$(($ret+1))
+ check_asan_reports "$1" || ret=$(($ret+1))
+ _umount_dir $initdir
return $ret
}
# can be overridden in specific test
check_result_qemu() {
local ret=1
- mkdir -p $initdir
- mount ${LOOPDEV}p1 $initdir
+ mount_initdir
[[ -e $initdir/testok ]] && ret=0
[[ -f $initdir/failed ]] && cp -a $initdir/failed $TESTDIR
cp -a $initdir/var/log/journal $TESTDIR
+ rm -r $initdir/var/log/journal/*
check_asan_reports "$initdir" || ret=$(($ret+1))
- umount $initdir
+ _umount_dir $initdir
[[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed
ls -l $TESTDIR/journal/*/*.journal
test -s $TESTDIR/failed && ret=$(($ret+1))
@@ -727,6 +891,17 @@ install_ld_so_conf() {
ldconfig -r "$initdir"
}
+install_testuser() {
+ # create unprivileged user for user manager tests
+ mkdir -p $initdir/etc/sysusers.d
+ cat >$initdir/etc/sysusers.d/testuser.conf <<EOF
+u testuser 4711 "Test User" /home/testuser
+EOF
+
+ mkdir -p $initdir/home/testuser -m 0700
+ chown 4711:4711 $initdir/home/testuser
+}
+
install_config_files() {
inst /etc/sysconfig/init || :
inst /etc/passwd
@@ -741,29 +916,20 @@ install_config_files() {
# we want an empty environment
> $initdir/etc/environment
> $initdir/etc/machine-id
+
# set the hostname
echo systemd-testsuite > $initdir/etc/hostname
- # fstab
- if [[ "$LOOKS_LIKE_SUSE" ]]; then
- ROOTMOUNT="/dev/sda1 / ${FSTYPE} rw 0 1"
- else
- ROOTMOUNT="LABEL=systemd / ${FSTYPE} rw 0 1"
- fi
-
- cat >$initdir/etc/fstab <<EOF
-$ROOTMOUNT
-EOF
}
install_basic_tools() {
- [[ $BASICTOOLS ]] && dracut_install $BASICTOOLS
+ dracut_install "${BASICTOOLS[@]}"
dracut_install -o sushell
# in Debian ldconfig is just a shell script wrapper around ldconfig.real
dracut_install -o ldconfig.real
}
install_debug_tools() {
- [[ $DEBUGTOOLS ]] && dracut_install $DEBUGTOOLS
+ dracut_install "${DEBUGTOOLS[@]}"
if [[ $INTERACTIVE_DEBUG ]]; then
# Set default TERM from vt220 to linux, so at least basic key shortcuts work
@@ -810,6 +976,19 @@ install_dbus() {
| while read file; do
inst $file
done
+
+ # setup policy for Type=dbus test
+ mkdir -p $initdir/etc/dbus-1/system.d
+ cat > $initdir/etc/dbus-1/system.d/systemd.test.ExecStopPost.conf <<EOF
+<?xml version="1.0"?>
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+ <policy user="root">
+ <allow own="systemd.test.ExecStopPost"/>
+ </policy>
+</busconfig>
+EOF
}
install_user_dbus() {
@@ -885,10 +1064,16 @@ install_keymaps() {
}
install_zoneinfo() {
- for i in /usr/share/zoneinfo/{,*/,*/*/}*; do
- [[ -f $i ]] || continue
- inst $i
- done
+ inst_any /usr/share/zoneinfo/Asia/Seoul
+ inst_any /usr/share/zoneinfo/Asia/Vladivostok
+ inst_any /usr/share/zoneinfo/Australia/Sydney
+ inst_any /usr/share/zoneinfo/Europe/Berlin
+ inst_any /usr/share/zoneinfo/Europe/Kiev
+ inst_any /usr/share/zoneinfo/Pacific/Auckland
+ inst_any /usr/share/zoneinfo/Pacific/Honolulu
+ inst_any /usr/share/zoneinfo/CET
+ inst_any /usr/share/zoneinfo/EET
+ inst_any /usr/share/zoneinfo/UTC
}
install_fonts() {
@@ -916,40 +1101,17 @@ has_user_dbus_socket() {
fi
}
-enable_user_manager() {
- has_user_dbus_socket || return 0
-
- local _userid
- [[ $# -gt 0 ]] || set -- nobody
- mkdir -p "$initdir/var/lib/systemd/linger"
- for _userid; do
- touch "$initdir/var/lib/systemd/linger/$_userid"
- done
- dracut_install su
- install_user_dbus
-}
-
-setup_testsuite() {
- cp $TEST_BASE_DIR/testsuite.target $initdir/etc/systemd/system/
- cp $TEST_BASE_DIR/end.service $initdir/etc/systemd/system/
+setup_nspawn_root() {
+ if [ -z "${initdir}" ]; then
+ dfatal "\$initdir not defined"
+ exit 1
+ fi
- mkdir -p $initdir/etc/systemd/system/testsuite.target.wants
- ln -fs $TEST_BASE_DIR/testsuite.service $initdir/etc/systemd/system/testsuite.target.wants/testsuite.service
- # Don't shutdown the machine after running the test when INTERACTIVE_DEBUG is set
- [[ -z $INTERACTIVE_DEBUG ]] && ln -fs $TEST_BASE_DIR/end.service $initdir/etc/systemd/system/testsuite.target.wants/end.service
+ rm -rf "$TESTDIR/unprivileged-nspawn-root"
- # make the testsuite the default target
- ln -fs testsuite.target $initdir/etc/systemd/system/default.target
-}
-
-setup_nspawn_root() {
- rm -fr $TESTDIR/nspawn-root
- ddebug "cp -ar $initdir $TESTDIR/nspawn-root"
- cp -ar $initdir $TESTDIR/nspawn-root
- # we don't mount in the nspawn root
- rm -f $TESTDIR/nspawn-root/etc/fstab
if [[ "$RUN_IN_UNPRIVILEGED_CONTAINER" = "yes" ]]; then
- cp -ar $TESTDIR/nspawn-root $TESTDIR/unprivileged-nspawn-root
+ ddebug "cp -ar $initdir $TESTDIR/unprivileged-nspawn-root"
+ cp -ar $initdir $TESTDIR/unprivileged-nspawn-root
fi
}
@@ -1005,7 +1167,10 @@ inst_libs() {
}
import_testdir() {
+ # make sure we don't get a stale LOOPDEV value from old times
+ __LOOPDEV=$LOOPDEV
[[ -e $STATEFILE ]] && . $STATEFILE
+ LOOPDEV=$__LOOPDEV
if [[ ! -d "$TESTDIR" ]]; then
if [[ -z "$TESTDIR" ]]; then
TESTDIR=$(mktemp --tmpdir=/var/tmp -d -t systemd-test.XXXXXX)
@@ -1013,7 +1178,9 @@ import_testdir() {
mkdir -p "$TESTDIR"
fi
- echo "TESTDIR=\"$TESTDIR\"" > $STATEFILE
+ cat >$STATEFILE<<EOF
+TESTDIR="$TESTDIR"
+EOF
export TESTDIR
fi
}
@@ -1755,14 +1922,9 @@ _umount_dir() {
fi
}
-_test_setup_cleanup() {
- # only umount if create_empty_image_rootdir() was called to mount it
- [[ -z $TEST_SETUP_CLEANUP_ROOTDIR ]] || _umount_dir $initdir
-}
-
# can be overridden in specific test
test_setup_cleanup() {
- _test_setup_cleanup
+ cleanup_initdir
}
_test_cleanup() {
@@ -1770,12 +1932,9 @@ _test_cleanup() {
(
set +e
_umount_dir $initdir
- if [[ $LOOPDEV && -b $LOOPDEV ]]; then
- ddebug "losetup -d $LOOPDEV"
- losetup -d $LOOPDEV
- fi
- rm -fr "$TESTDIR"
- rm -f "$STATEFILE"
+ rm -vf "${IMAGESTATEDIR}/${IMAGE_NAME}.img"
+ rm -vfr "$TESTDIR"
+ rm -vf "$STATEFILE"
) || :
}
@@ -1784,24 +1943,70 @@ test_cleanup() {
_test_cleanup
}
+test_cleanup_again() {
+ [ -n "$TESTDIR" ] || return
+ rm -rf "$TESTDIR/unprivileged-nspawn-root"
+ _umount_dir $initdir
+}
+
+test_create_image() {
+ create_empty_image_rootdir
+
+ # Create what will eventually be our root filesystem onto an overlay
+ (
+ LOG_LEVEL=5
+ setup_basic_environment
+ mask_supporting_services
+ )
+}
+
+test_setup() {
+ if [ ${TEST_REQUIRE_INSTALL_TESTS} -ne 0 ] && \
+ type -P meson >/dev/null && \
+ [[ "$(meson configure $BUILD_DIR | grep install-tests | awk '{ print $2 }')" != "true" ]]; then
+ dfatal "Needs to be built with -Dinstall-tests=true"
+ exit 1
+ fi
+
+ image="${TESTDIR}/${IMAGE_NAME}.img"
+ public="${IMAGESTATEDIR}/${IMAGE_NAME}.img"
+ if [ -e "$image" ]; then
+ echo "Reusing existing image $PWD/$image → $(realpath $image)"
+ mount_initdir
+ elif [ -e "$public" ]; then
+ echo "Reusing existing cached image $PWD/$public → $(realpath $public)"
+ ln -s "$(realpath $public)" "$image"
+ mount_initdir
+ else
+ test_create_image
+ fi
+
+ setup_nspawn_root
+}
+
test_run() {
+ mount_initdir
+ rm -f "$initdir"/{testok,failed,skipped}
+
if [ -z "$TEST_NO_QEMU" ]; then
- if run_qemu; then
- check_result_qemu || return 1
+ if run_qemu "$1"; then
+ check_result_qemu || { echo "QEMU test failed"; return 1; }
else
dwarn "can't run QEMU, skipping"
fi
fi
if [ -z "$TEST_NO_NSPAWN" ]; then
- if run_nspawn "nspawn-root"; then
- check_result_nspawn "nspawn-root" || return 1
+ mount_initdir
+ if run_nspawn "$initdir" "$1"; then
+ check_result_nspawn "$initdir" || { echo "nspawn-root test failed"; return 1; }
else
dwarn "can't run systemd-nspawn, skipping"
fi
if [[ "$RUN_IN_UNPRIVILEGED_CONTAINER" = "yes" ]]; then
- if NSPAWN_ARGUMENTS="-U --private-network $NSPAWN_ARGUMENTS" run_nspawn "unprivileged-nspawn-root"; then
- check_result_nspawn "unprivileged-nspawn-root" || return 1
+ dir="$TESTDIR/unprivileged-nspawn-root"
+ if NSPAWN_ARGUMENTS="-U --private-network $NSPAWN_ARGUMENTS" run_nspawn "$dir" "$1"; then
+ check_result_nspawn "$dir" || { echo "unprivileged-nspawn-root test failed"; return 1; }
else
dwarn "can't run systemd-nspawn, skipping"
fi
@@ -1830,34 +2035,40 @@ do_test() {
import_testdir
import_initdir
+ testname="$(basename $PWD)"
+
while (($# > 0)); do
case $1 in
--run)
- echo "TEST RUN: $TEST_DESCRIPTION"
- test_run
+ echo "${testname} RUN: $TEST_DESCRIPTION"
+ test_run "$2"
ret=$?
if (( $ret == 0 )); then
- echo "TEST RUN: $TEST_DESCRIPTION [OK]"
+ echo "${testname} RUN: $TEST_DESCRIPTION [OK]"
else
- echo "TEST RUN: $TEST_DESCRIPTION [FAILED]"
+ echo "${testname} RUN: $TEST_DESCRIPTION [FAILED]"
fi
exit $ret;;
--setup)
- echo "TEST SETUP: $TEST_DESCRIPTION"
+ echo "${testname} SETUP: $TEST_DESCRIPTION"
test_setup
test_setup_cleanup
;;
--clean)
- echo "TEST CLEANUP: $TEST_DESCRIPTION"
+ echo "${testname} CLEANUP: $TEST_DESCRIPTION"
test_cleanup
;;
+ --clean-again)
+ echo "${testname} CLEANUP AGAIN: $TEST_DESCRIPTION"
+ test_cleanup_again
+ ;;
--all)
ret=0
- echo -n "TEST: $TEST_DESCRIPTION "
+ echo -n "${testname}: $TEST_DESCRIPTION "
(
test_setup
test_setup_cleanup
- test_run
+ test_run "$2"
) </dev/null >"$TESTLOG" 2>&1 || ret=$?
test_cleanup
if [ $ret -eq 0 ]; then
diff --git a/test/test-network-generator-conversion.sh b/test/test-network-generator-conversion.sh
new file mode 100755
index 0000000000..d0d0834518
--- /dev/null
+++ b/test/test-network-generator-conversion.sh
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+set -ex
+
+if [[ -n "$1" ]]; then
+ generator=$1
+elif [[ -x /usr/lib/systemd/systemd-network-generator ]]; then
+ generator=/usr/lib/systemd/systemd-network-generator
+elif [[ -x /lib/systemd/systemd-network-generator ]]; then
+ generator=/lib/systemd/systemd-network-generator
+else
+ exit 1
+fi
+
+src="$(dirname "$0")/testdata/test-network-generator-conversion"
+
+for f in "$src"/test-*.input; do
+ echo "*** Running $f"
+
+ (
+ out=$(mktemp --directory)
+ trap "rm -rf '$out'" EXIT INT QUIT PIPE
+
+ $generator --root "$out" -- $(cat $f)
+
+ if ! diff -u "$out"/run/systemd/network ${f%.input}.expected; then
+ echo "**** Unexpected output for $f"
+ exit 1
+ fi
+ ) || exit 1
+done
diff --git a/test/TEST-35-NETWORK-GENERATOR/test-01-dhcp.expected/91-default.network b/test/test-network-generator-conversion/test-01-dhcp.expected/91-default.network
index e42ce1e311..e42ce1e311 100644
--- a/test/TEST-35-NETWORK-GENERATOR/test-01-dhcp.expected/91-default.network
+++ b/test/test-network-generator-conversion/test-01-dhcp.expected/91-default.network
diff --git a/test/TEST-35-NETWORK-GENERATOR/test-01-dhcp.input b/test/test-network-generator-conversion/test-01-dhcp.input
index e55893e756..e55893e756 100644
--- a/test/TEST-35-NETWORK-GENERATOR/test-01-dhcp.input
+++ b/test/test-network-generator-conversion/test-01-dhcp.input
diff --git a/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/90-bridge99.netdev b/test/test-network-generator-conversion/test-02-bridge.expected/90-bridge99.netdev
index 97c22485b7..97c22485b7 100644
--- a/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/90-bridge99.netdev
+++ b/test/test-network-generator-conversion/test-02-bridge.expected/90-bridge99.netdev
diff --git a/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/90-bridge99.network b/test/test-network-generator-conversion/test-02-bridge.expected/90-bridge99.network
index f8d19baaea..f8d19baaea 100644
--- a/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/90-bridge99.network
+++ b/test/test-network-generator-conversion/test-02-bridge.expected/90-bridge99.network
diff --git a/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/90-eth0.network b/test/test-network-generator-conversion/test-02-bridge.expected/90-eth0.network
index 8842b57921..8842b57921 100644
--- a/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/90-eth0.network
+++ b/test/test-network-generator-conversion/test-02-bridge.expected/90-eth0.network
diff --git a/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/90-eth1.network b/test/test-network-generator-conversion/test-02-bridge.expected/90-eth1.network
index feff4f5ba8..feff4f5ba8 100644
--- a/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/90-eth1.network
+++ b/test/test-network-generator-conversion/test-02-bridge.expected/90-eth1.network
diff --git a/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.input b/test/test-network-generator-conversion/test-02-bridge.input
index 0c863fc356..0c863fc356 100644
--- a/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.input
+++ b/test/test-network-generator-conversion/test-02-bridge.input
diff --git a/test/TEST-35-NETWORK-GENERATOR/test-03-issue-14319.expected/90-enp3s0.network b/test/test-network-generator-conversion/test-03-issue-14319.expected/90-enp3s0.network
index 28ccfdd9b0..28ccfdd9b0 100644
--- a/test/TEST-35-NETWORK-GENERATOR/test-03-issue-14319.expected/90-enp3s0.network
+++ b/test/test-network-generator-conversion/test-03-issue-14319.expected/90-enp3s0.network
diff --git a/test/TEST-35-NETWORK-GENERATOR/test-03-issue-14319.input b/test/test-network-generator-conversion/test-03-issue-14319.input
index 3be752067b..3be752067b 100644
--- a/test/TEST-35-NETWORK-GENERATOR/test-03-issue-14319.input
+++ b/test/test-network-generator-conversion/test-03-issue-14319.input
diff --git a/test/test-path/basic.target b/test/test-path/basic.target
index a882b72cc9..4f44292249 120000..100644
--- a/test/test-path/basic.target
+++ b/test/test-path/basic.target
@@ -1 +1,22 @@
-../../units/basic.target \ No newline at end of file
+# SPDX-License-Identifier: LGPL-2.1+
+#
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Basic System
+Documentation=man:systemd.special(7)
+Requires=sysinit.target
+Wants=sockets.target timers.target paths.target slices.target
+After=sysinit.target sockets.target paths.target slices.target tmp.mount
+
+# We support /var, /tmp, /var/tmp, being on NFS, but we don't pull in
+# remote-fs.target by default, hence pull them in explicitly here. Note that we
+# require /var and /var/tmp, but only add a Wants= type dependency on /tmp, as
+# we support that unit being masked, and this should not be considered an error.
+RequiresMountsFor=/var /var/tmp
+Wants=tmp.mount
diff --git a/test/test-path/path-changed.service b/test/test-path/path-changed.service
index 8bdf178830..f8499ec619 120000..100644
--- a/test/test-path/path-changed.service
+++ b/test/test-path/path-changed.service
@@ -1 +1,6 @@
-path-service.service \ No newline at end of file
+[Unit]
+Description=Service Test for Path units
+
+[Service]
+ExecStart=/bin/true
+Type=oneshot
diff --git a/test/test-path/path-directorynotempty.service b/test/test-path/path-directorynotempty.service
index 8bdf178830..f8499ec619 120000..100644
--- a/test/test-path/path-directorynotempty.service
+++ b/test/test-path/path-directorynotempty.service
@@ -1 +1,6 @@
-path-service.service \ No newline at end of file
+[Unit]
+Description=Service Test for Path units
+
+[Service]
+ExecStart=/bin/true
+Type=oneshot
diff --git a/test/test-path/path-exists.service b/test/test-path/path-exists.service
index 8bdf178830..f8499ec619 120000..100644
--- a/test/test-path/path-exists.service
+++ b/test/test-path/path-exists.service
@@ -1 +1,6 @@
-path-service.service \ No newline at end of file
+[Unit]
+Description=Service Test for Path units
+
+[Service]
+ExecStart=/bin/true
+Type=oneshot
diff --git a/test/test-path/path-existsglob.service b/test/test-path/path-existsglob.service
index 8bdf178830..f8499ec619 120000..100644
--- a/test/test-path/path-existsglob.service
+++ b/test/test-path/path-existsglob.service
@@ -1 +1,6 @@
-path-service.service \ No newline at end of file
+[Unit]
+Description=Service Test for Path units
+
+[Service]
+ExecStart=/bin/true
+Type=oneshot
diff --git a/test/test-path/path-makedirectory.service b/test/test-path/path-makedirectory.service
index 8bdf178830..f8499ec619 120000..100644
--- a/test/test-path/path-makedirectory.service
+++ b/test/test-path/path-makedirectory.service
@@ -1 +1,6 @@
-path-service.service \ No newline at end of file
+[Unit]
+Description=Service Test for Path units
+
+[Service]
+ExecStart=/bin/true
+Type=oneshot
diff --git a/test/test-path/path-modified.service b/test/test-path/path-modified.service
index 8bdf178830..f8499ec619 120000..100644
--- a/test/test-path/path-modified.service
+++ b/test/test-path/path-modified.service
@@ -1 +1,6 @@
-path-service.service \ No newline at end of file
+[Unit]
+Description=Service Test for Path units
+
+[Service]
+ExecStart=/bin/true
+Type=oneshot
diff --git a/test/test-path/paths.target b/test/test-path/paths.target
index b402796cb9..9b6ed1c13f 120000..100644
--- a/test/test-path/paths.target
+++ b/test/test-path/paths.target
@@ -1 +1,12 @@
-../../units/paths.target \ No newline at end of file
+# SPDX-License-Identifier: LGPL-2.1+
+#
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Paths
+Documentation=man:systemd.special(7)
diff --git a/test/test-path/sysinit.target b/test/test-path/sysinit.target
index 9d10e5b2e2..b6c16a1412 120000..100644
--- a/test/test-path/sysinit.target
+++ b/test/test-path/sysinit.target
@@ -1 +1,15 @@
-../../units/sysinit.target \ No newline at end of file
+# SPDX-License-Identifier: LGPL-2.1+
+#
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=System Initialization
+Documentation=man:systemd.special(7)
+Conflicts=emergency.service emergency.target
+Wants=local-fs.target swap.target
+After=local-fs.target swap.target emergency.service emergency.target
diff --git a/test/testdata b/test/testdata
new file mode 120000
index 0000000000..945c9b46d6
--- /dev/null
+++ b/test/testdata
@@ -0,0 +1 @@
+. \ No newline at end of file
diff --git a/test/testsuite-04.units/forever-print-hola.service b/test/testsuite-04.units/forever-print-hola.service
new file mode 100644
index 0000000000..a0dc095688
--- /dev/null
+++ b/test/testsuite-04.units/forever-print-hola.service
@@ -0,0 +1,6 @@
+[Unit]
+Description=ForeverPrintHola service
+
+[Service]
+Type=simple
+ExecStart=sh -x -c 'while :; do printf "Hola\n" || touch /i-lose-my-logs; sleep 1; done'
diff --git a/test/testsuite-06.units/hola.service b/test/testsuite-06.units/hola.service
new file mode 100644
index 0000000000..5dc633206a
--- /dev/null
+++ b/test/testsuite-06.units/hola.service
@@ -0,0 +1,6 @@
+[Service]
+Type=oneshot
+ExecStart=/bin/echo Start Hola
+ExecReload=/bin/echo Reload Hola
+ExecStop=/bin/echo Stop Hola
+RemainAfterExit=yes
diff --git a/test/testsuite-06.units/load-systemd-test-module.service b/test/testsuite-06.units/load-systemd-test-module.service
new file mode 100644
index 0000000000..323a76c68d
--- /dev/null
+++ b/test/testsuite-06.units/load-systemd-test-module.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Load systemd-test module
+DefaultDependencies=no
+Requires=local-fs.target
+Conflicts=shutdown.target
+After=local-fs.target
+Before=sysinit.target shutdown.target autorelabel.service
+ConditionSecurity=selinux
+
+[Service]
+ExecStart=sh -x -c 'echo 0 >/sys/fs/selinux/enforce && cd /systemd-test-module && make -f /usr/share/selinux/devel/Makefile load'
+Type=oneshot
+TimeoutSec=0
+RemainAfterExit=yes
diff --git a/test/testsuite-08.units/-.mount b/test/testsuite-08.units/-.mount
new file mode 100644
index 0000000000..af4e219759
--- /dev/null
+++ b/test/testsuite-08.units/-.mount
@@ -0,0 +1,12 @@
+[Unit]
+Before=local-fs.target
+
+[Mount]
+What=/dev/sda1
+Where=/
+Type=ext4
+Options=errors=remount-ro,noatime
+
+[Install]
+WantedBy=local-fs.target
+Alias=root.mount
diff --git a/test/testsuite-08.units/local-fs.target.wants/-.mount b/test/testsuite-08.units/local-fs.target.wants/-.mount
new file mode 120000
index 0000000000..5566fceaa3
--- /dev/null
+++ b/test/testsuite-08.units/local-fs.target.wants/-.mount
@@ -0,0 +1 @@
+../-.mount \ No newline at end of file
diff --git a/test/testsuite-08.units/root.mount b/test/testsuite-08.units/root.mount
new file mode 120000
index 0000000000..fd8c47d1b0
--- /dev/null
+++ b/test/testsuite-08.units/root.mount
@@ -0,0 +1 @@
+-.mount \ No newline at end of file
diff --git a/test/testsuite-08.units/systemd-remount-fs.service b/test/testsuite-08.units/systemd-remount-fs.service
new file mode 100644
index 0000000000..398d612749
--- /dev/null
+++ b/test/testsuite-08.units/systemd-remount-fs.service
@@ -0,0 +1,11 @@
+[Unit]
+DefaultDependencies=no
+Conflicts=shutdown.target
+After=systemd-fsck-root.service
+Before=local-fs-pre.target local-fs.target shutdown.target
+Wants=local-fs-pre.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/bin/systemctl reload /
diff --git a/test/testsuite-10.units/test10.service b/test/testsuite-10.units/test10.service
new file mode 100644
index 0000000000..d0be786b01
--- /dev/null
+++ b/test/testsuite-10.units/test10.service
@@ -0,0 +1,6 @@
+[Unit]
+Requires=test10.socket
+ConditionPathExistsGlob=/tmp/nonexistent
+
+[Service]
+ExecStart=true
diff --git a/test/testsuite-10.units/test10.socket b/test/testsuite-10.units/test10.socket
new file mode 100644
index 0000000000..9cceebbb8e
--- /dev/null
+++ b/test/testsuite-10.units/test10.socket
@@ -0,0 +1,2 @@
+[Socket]
+ListenStream=/run/test.ctl
diff --git a/test/testsuite-11.units/fail-on-restart.service b/test/testsuite-11.units/fail-on-restart.service
new file mode 100644
index 0000000000..9264f151f3
--- /dev/null
+++ b/test/testsuite-11.units/fail-on-restart.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Fail on restart
+StartLimitIntervalSec=1m
+StartLimitBurst=3
+
+[Service]
+Type=simple
+ExecStart=false
+Restart=always
diff --git a/test/TEST-16-EXTEND-TIMEOUT/extend_timeout_test_service.sh b/test/testsuite-16.units/extend-timeout.sh
index 40bf046dcd..ed1af8afeb 100755
--- a/test/TEST-16-EXTEND-TIMEOUT/extend_timeout_test_service.sh
+++ b/test/testsuite-16.units/extend-timeout.sh
@@ -4,23 +4,15 @@ set -e
set -o pipefail
# sleep interval (seconds)
-sleep_interval=1
+: ${sleep_interval:=1}
# extend_timeout_interval second(s)
-extend_timeout_interval=1
+: ${extend_timeout_interval:=1}
# number of sleep_intervals before READY=1
-start_intervals=10
+: ${start_intervals:=10}
# number of sleep_intervals before exiting
-stop_intervals=10
+: ${stop_intervals:=10}
# run intervals, number of sleep_intervals to run
-run_intervals=7
-# service name
-SERVICE=unknown
-
-while [ $# -gt 0 ];
-do
- eval ${1%=*}=${1#*=}
- shift
-done
+: ${run_intervals:=7}
# We convert to usec
extend_timeout_interval=$(( $extend_timeout_interval * 1000000 ))
diff --git a/test/TEST-16-EXTEND-TIMEOUT/testsuite-fail-runtime.service b/test/testsuite-16.units/fail-runtime.service
index e0b9f6a70b..baa655f2f1 100644
--- a/test/TEST-16-EXTEND-TIMEOUT/testsuite-fail-runtime.service
+++ b/test/testsuite-16.units/fail-runtime.service
@@ -1,13 +1,12 @@
-
[Unit]
Description=Testsuite: Fail Runtime (EXTEND_TIMEOUT_USEC Didn't occur in sufficient time after RuntimeSecMax.)
[Service]
-
# EXTEND_TIMEOUT_USEC on runtime start (0) and 7 seconds after. Systemd will expect one at 7+5 (extend_timeout_interval)
# seconds this won't happen until 7 + 7 (sleep interval) seconds. Therefore timeout at 12 seconds.
Type=notify
TimeoutStartSec=4
TimeoutStopSec=4
RuntimeMaxSec=10
-ExecStart=/extend_timeout_test_service.sh SERVICE=fail_runtime extend_timeout_interval=5 sleep_interval=7 start_intervals=0 run_intervals=2 stop_intervals=0
+Environment=SERVICE=fail_runtime extend_timeout_interval=5 sleep_interval=7 start_intervals=0 run_intervals=2 stop_intervals=0
+ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh
diff --git a/test/TEST-16-EXTEND-TIMEOUT/testsuite-fail-start.service b/test/testsuite-16.units/fail-start.service
index c3fcf23dc0..882900440f 100644
--- a/test/TEST-16-EXTEND-TIMEOUT/testsuite-fail-start.service
+++ b/test/testsuite-16.units/fail-start.service
@@ -1,4 +1,3 @@
-
[Unit]
Description=Testsuite: Fail Start (EXTEND_TIMEOUT_USEC Didn't occur in sufficient time after TimeoutStartSec.)
@@ -10,4 +9,5 @@ Type=notify
TimeoutStartSec=10
TimeoutStopSec=4
RuntimeMaxSec=4
-ExecStart=/extend_timeout_test_service.sh SERVICE=fail_start extend_timeout_interval=5 sleep_interval=7 start_intervals=2 run_intervals=0 stop_intervals=0
+Environment=SERVICE=fail_start extend_timeout_interval=5 sleep_interval=7 start_intervals=2 run_intervals=0 stop_intervals=0
+ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh
diff --git a/test/TEST-16-EXTEND-TIMEOUT/testsuite-fail-stop.service b/test/testsuite-16.units/fail-stop.service
index ce76d10db7..cdea2a9a2d 100644
--- a/test/TEST-16-EXTEND-TIMEOUT/testsuite-fail-stop.service
+++ b/test/testsuite-16.units/fail-stop.service
@@ -1,16 +1,15 @@
-
[Unit]
Description=Testsuite: Fail Stop (EXTEND_TIMEOUT_USEC Didn't occur in sufficient time after TimeoutStopSec.)
[Service]
-
# EXTEND_TIMEOUT_USEC on stop (0) and 7 seconds after. Systemd will expect one at 7+5 (extend_timeout_interval)
# seconds this won't happen until 7 + 7 (sleep interval) seconds. Therefore timeout at 12 seconds.
Type=notify
TimeoutStartSec=4
TimeoutStopSec=10
RuntimeMaxSec=4
-ExecStart=/extend_timeout_test_service.sh SERVICE=fail_stop extend_timeout_interval=5 sleep_interval=7 start_intervals=0 run_intervals=0 stop_intervals=2
+Environment=SERVICE=fail_stop extend_timeout_interval=5 sleep_interval=7 start_intervals=0 run_intervals=0 stop_intervals=2
+ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh
# Due to 6041a7ee2c1bbff6301082f192fc1b0882400d42 SIGTERM isn't sent as the service shuts down with STOPPING=1
# This file makes the test assess.sh quicker by notifing it that this test has finished.
ExecStopPost=/bin/bash -c '[[ $SERVICE_RESULT == timeout && $EXIT_CODE == killed ]] && touch /fail_runtime.terminated'
diff --git a/test/TEST-16-EXTEND-TIMEOUT/testsuite-success-all.service b/test/testsuite-16.units/success-all.service
index 666f4229bf..e2d7e607ba 100644
--- a/test/TEST-16-EXTEND-TIMEOUT/testsuite-success-all.service
+++ b/test/testsuite-16.units/success-all.service
@@ -1,4 +1,3 @@
-
[Unit]
Description=Testsuite: EXTEND_TIMEOUT_USEC Success - extend timeout on all services
@@ -11,4 +10,5 @@ Type=notify
TimeoutStartSec=4
TimeoutStopSec=4
RuntimeMaxSec=4
-ExecStart=/extend_timeout_test_service.sh SERVICE=success_all extend_timeout_interval=4 sleep_interval=2 start_intervals=3 run_intervals=3 stop_intervals=3
+Environment=SERVICE=success_all extend_timeout_interval=4 sleep_interval=2 start_intervals=3 run_intervals=3 stop_intervals=3
+ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh
diff --git a/test/TEST-16-EXTEND-TIMEOUT/testsuite-success-runtime.service b/test/testsuite-16.units/success-runtime.service
index dc226f5054..15283b73a8 100644
--- a/test/TEST-16-EXTEND-TIMEOUT/testsuite-success-runtime.service
+++ b/test/testsuite-16.units/success-runtime.service
@@ -1,4 +1,3 @@
-
[Unit]
Description=Testsuite: Success Runtime (EXTEND_TIMEOUT_USEC > WATCHDOG_USEC however < RuntimeMaxSec)
@@ -10,4 +9,5 @@ Type=notify
TimeoutStartSec=4
TimeoutStopSec=4
RuntimeMaxSec=8
-ExecStart=/extend_timeout_test_service.sh SERVICE=success_runtime extend_timeout_interval=4 sleep_interval=6 start_intervals=0 run_intervals=1 stop_intervals=0
+Environment=SERVICE=success_runtime extend_timeout_interval=4 sleep_interval=6 start_intervals=0 run_intervals=1 stop_intervals=0
+ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh
diff --git a/test/TEST-16-EXTEND-TIMEOUT/testsuite-success-start.service b/test/testsuite-16.units/success-start.service
index 228eece73e..cfdcc33cc8 100644
--- a/test/TEST-16-EXTEND-TIMEOUT/testsuite-success-start.service
+++ b/test/testsuite-16.units/success-start.service
@@ -1,13 +1,12 @@
-
[Unit]
Description=Testsuite: Success Start (EXTEND_TIMEOUT_USEC > WATCHDOG_USEC however < TimeoutStartSec)
[Service]
-
# EXTEND_TIMEOUT_USEC=4 second interval once at startup, but sleep 6 seconds.
# Therefore startup is 6 seconds and < TimeoutStartSec so still successful.
Type=notify
TimeoutStartSec=8
TimeoutStopSec=4
RuntimeMaxSec=4
-ExecStart=/extend_timeout_test_service.sh SERVICE=success_start extend_timeout_interval=4 sleep_interval=6 start_intervals=1 run_intervals=0 stop_intervals=0
+Environment=SERVICE=success_start extend_timeout_interval=4 sleep_interval=6 start_intervals=1 run_intervals=0 stop_intervals=0
+ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh
diff --git a/test/TEST-16-EXTEND-TIMEOUT/testsuite-success-stop.service b/test/testsuite-16.units/success-stop.service
index b809397bf3..c4600ace41 100644
--- a/test/TEST-16-EXTEND-TIMEOUT/testsuite-success-stop.service
+++ b/test/testsuite-16.units/success-stop.service
@@ -1,13 +1,12 @@
-
[Unit]
Description=Testsuite: Success Stop (EXTEND_TIMEOUT_USEC > WATCHDOG_USEC however < TimeoutStopSec)
[Service]
-
# EXTEND_TIMEOUT_USEC=4 seconds once during shutdown, but sleep for 6 seconds.
# Therefore stop time is 6 seconds and < TimeoutStopSec so still successful.
Type=notify
TimeoutStartSec=4
TimeoutStopSec=8
RuntimeMaxSec=4
-ExecStart=/extend_timeout_test_service.sh SERVICE=success_stop extend_timeout_interval=4 sleep_interval=6 start_intervals=0 run_intervals=0 stop_intervals=1
+Environment=SERVICE=success_stop extend_timeout_interval=4 sleep_interval=6 start_intervals=0 run_intervals=0 stop_intervals=1
+ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh
diff --git a/test/testsuite-28.units/specifier-j-depends-wants.service b/test/testsuite-28.units/specifier-j-depends-wants.service
new file mode 100644
index 0000000000..f9c6abb493
--- /dev/null
+++ b/test/testsuite-28.units/specifier-j-depends-wants.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=Dependent service for percent-j specifier
+After=testsuite-28-pre.service
+
+[Service]
+Type=oneshot
+ExecStart=touch /tmp/test-specifier-j-wants
diff --git a/test/testsuite-28.units/specifier-j-wants.service b/test/testsuite-28.units/specifier-j-wants.service
new file mode 100644
index 0000000000..facf5577be
--- /dev/null
+++ b/test/testsuite-28.units/specifier-j-wants.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Wants with percent-j specifier
+Wants=specifier-j-depends-%j.service
+After=specifier-j-depends-%j.service
+After=testsuite-28-pre.service
+
+[Service]
+Type=oneshot
+ExecStart=test -f /tmp/test-specifier-j-%j
+ExecStart=sh -c 'echo OK > /testok'
diff --git a/test/testsuite-28.units/testsuite-28-pre.service b/test/testsuite-28.units/testsuite-28-pre.service
new file mode 100644
index 0000000000..2b8ef98911
--- /dev/null
+++ b/test/testsuite-28.units/testsuite-28-pre.service
@@ -0,0 +1,3 @@
+[Service]
+ExecStart=rm -f /failed /testok
+Type=oneshot
diff --git a/test/testsuite-30.units/systemd-timedated.service.d/watchdog.conf b/test/testsuite-30.units/systemd-timedated.service.d/watchdog.conf
new file mode 100644
index 0000000000..d5ed27cf6b
--- /dev/null
+++ b/test/testsuite-30.units/systemd-timedated.service.d/watchdog.conf
@@ -0,0 +1,2 @@
+[Service]
+WatchdogSec=10min
diff --git a/test/timers.target b/test/timers.target
deleted file mode 120000
index 576d47fed7..0000000000
--- a/test/timers.target
+++ /dev/null
@@ -1 +0,0 @@
-../units/timers.target \ No newline at end of file
diff --git a/test/a-conj.service b/test/units/a-conj.service
index db37ae71d4..db37ae71d4 100644
--- a/test/a-conj.service
+++ b/test/units/a-conj.service
diff --git a/test/a.service b/test/units/a.service
index 4168d2d051..4168d2d051 100644
--- a/test/a.service
+++ b/test/units/a.service
diff --git a/test/units/autorelabel.service b/test/units/autorelabel.service
new file mode 100644
index 0000000000..cb38849373
--- /dev/null
+++ b/test/units/autorelabel.service
@@ -0,0 +1,18 @@
+[Unit]
+Description=Relabel all filesystems
+DefaultDependencies=no
+Requires=local-fs.target
+Conflicts=shutdown.target
+After=local-fs.target
+Before=sysinit.target shutdown.target
+ConditionSecurity=selinux
+ConditionPathExists=|/.autorelabel
+
+[Service]
+ExecStart=sh -x -c 'echo 0 >/sys/fs/selinux/enforce && fixfiles -f -F relabel && rm /.autorelabel && systemctl --force reboot'
+Type=oneshot
+TimeoutSec=0
+RemainAfterExit=yes
+
+[Install]
+WantedBy=basic.target
diff --git a/test/b.service b/test/units/b.service
index e03bae36be..e03bae36be 100644
--- a/test/b.service
+++ b/test/units/b.service
diff --git a/test/units/basic.target b/test/units/basic.target
new file mode 100644
index 0000000000..4f44292249
--- /dev/null
+++ b/test/units/basic.target
@@ -0,0 +1,22 @@
+# SPDX-License-Identifier: LGPL-2.1+
+#
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Basic System
+Documentation=man:systemd.special(7)
+Requires=sysinit.target
+Wants=sockets.target timers.target paths.target slices.target
+After=sysinit.target sockets.target paths.target slices.target tmp.mount
+
+# We support /var, /tmp, /var/tmp, being on NFS, but we don't pull in
+# remote-fs.target by default, hence pull them in explicitly here. Note that we
+# require /var and /var/tmp, but only add a Wants= type dependency on /tmp, as
+# we support that unit being masked, and this should not be considered an error.
+RequiresMountsFor=/var /var/tmp
+Wants=tmp.mount
diff --git a/test/c.service b/test/units/c.service
index e2f60a8fbf..e2f60a8fbf 100644
--- a/test/c.service
+++ b/test/units/c.service
diff --git a/test/d.service b/test/units/d.service
index 921fd2ee1b..921fd2ee1b 100644
--- a/test/d.service
+++ b/test/units/d.service
diff --git a/test/daughter.service b/test/units/daughter.service
index c790b9d04b..c790b9d04b 100644
--- a/test/daughter.service
+++ b/test/units/daughter.service
diff --git a/test/dml-discard-empty.service b/test/units/dml-discard-empty.service
index 75228f6470..75228f6470 100644
--- a/test/dml-discard-empty.service
+++ b/test/units/dml-discard-empty.service
diff --git a/test/dml-discard-set-ml.service b/test/units/dml-discard-set-ml.service
index 591c99270c..591c99270c 100644
--- a/test/dml-discard-set-ml.service
+++ b/test/units/dml-discard-set-ml.service
diff --git a/test/dml-discard.slice b/test/units/dml-discard.slice
index e26d86846c..e26d86846c 100644
--- a/test/dml-discard.slice
+++ b/test/units/dml-discard.slice
diff --git a/test/dml-override-empty.service b/test/units/dml-override-empty.service
index 142c98720c..142c98720c 100644
--- a/test/dml-override-empty.service
+++ b/test/units/dml-override-empty.service
diff --git a/test/dml-override.slice b/test/units/dml-override.slice
index feb6773e39..feb6773e39 100644
--- a/test/dml-override.slice
+++ b/test/units/dml-override.slice
diff --git a/test/dml-passthrough-empty.service b/test/units/dml-passthrough-empty.service
index 34832de491..34832de491 100644
--- a/test/dml-passthrough-empty.service
+++ b/test/units/dml-passthrough-empty.service
diff --git a/test/dml-passthrough-set-dml.service b/test/units/dml-passthrough-set-dml.service
index 5bdf4ed4b7..5bdf4ed4b7 100644
--- a/test/dml-passthrough-set-dml.service
+++ b/test/units/dml-passthrough-set-dml.service
diff --git a/test/dml-passthrough-set-ml.service b/test/units/dml-passthrough-set-ml.service
index 2e568b5deb..2e568b5deb 100644
--- a/test/dml-passthrough-set-ml.service
+++ b/test/units/dml-passthrough-set-ml.service
diff --git a/test/dml-passthrough.slice b/test/units/dml-passthrough.slice
index 1b1a848edb..1b1a848edb 100644
--- a/test/dml-passthrough.slice
+++ b/test/units/dml-passthrough.slice
diff --git a/test/dml.slice b/test/units/dml.slice
index 84e333ef04..84e333ef04 100644
--- a/test/dml.slice
+++ b/test/units/dml.slice
diff --git a/test/e.service b/test/units/e.service
index 5ba98c7c43..5ba98c7c43 100644
--- a/test/e.service
+++ b/test/units/e.service
diff --git a/test/end.service b/test/units/end.service
index 6e1996fd02..e7ed75ef05 100644
--- a/test/end.service
+++ b/test/units/end.service
@@ -1,6 +1,6 @@
[Unit]
Description=End the test
-After=testsuite.service
+After=testsuite.target
OnFailure=poweroff.target
OnFailureJobMode=replace-irreversibly
diff --git a/test/f.service b/test/units/f.service
index 7dde681c17..7dde681c17 100644
--- a/test/f.service
+++ b/test/units/f.service
diff --git a/test/g.service b/test/units/g.service
index cbfa82a454..cbfa82a454 100644
--- a/test/g.service
+++ b/test/units/g.service
diff --git a/test/grandchild.service b/test/units/grandchild.service
index ab641300e4..ab641300e4 100644
--- a/test/grandchild.service
+++ b/test/units/grandchild.service
diff --git a/test/h.service b/test/units/h.service
index 74a7751cad..74a7751cad 100644
--- a/test/h.service
+++ b/test/units/h.service
diff --git a/test/hello-after-sleep.target b/test/units/hello-after-sleep.target
index 526fbd2a12..526fbd2a12 100644
--- a/test/hello-after-sleep.target
+++ b/test/units/hello-after-sleep.target
diff --git a/test/hello.service b/test/units/hello.service
index 82907b64e1..82907b64e1 100644
--- a/test/hello.service
+++ b/test/units/hello.service
diff --git a/test/i.service b/test/units/i.service
index 938ea77bdf..938ea77bdf 100644
--- a/test/i.service
+++ b/test/units/i.service
diff --git a/test/loopy.service b/test/units/loopy.service
index 9eb645748e..9eb645748e 100644
--- a/test/loopy.service
+++ b/test/units/loopy.service
diff --git a/test/loopy.service.d/compat.conf b/test/units/loopy.service.d/compat.conf
index 51b84b89ed..51b84b89ed 100644
--- a/test/loopy.service.d/compat.conf
+++ b/test/units/loopy.service.d/compat.conf
diff --git a/test/units/loopy2.service b/test/units/loopy2.service
new file mode 100644
index 0000000000..9eb645748e
--- /dev/null
+++ b/test/units/loopy2.service
@@ -0,0 +1,2 @@
+[Service]
+ExecStart=/bin/true
diff --git a/test/loopy3.service b/test/units/loopy3.service
index 606e26b5da..606e26b5da 100644
--- a/test/loopy3.service
+++ b/test/units/loopy3.service
diff --git a/test/units/loopy4.service b/test/units/loopy4.service
new file mode 100644
index 0000000000..606e26b5da
--- /dev/null
+++ b/test/units/loopy4.service
@@ -0,0 +1,5 @@
+[Service]
+ExecStart=/bin/true
+
+[Unit]
+Conflicts=loopy4.service
diff --git a/test/nomem.slice b/test/units/nomem.slice
index 9c5d208cb4..9c5d208cb4 100644
--- a/test/nomem.slice
+++ b/test/units/nomem.slice
diff --git a/test/nomemleaf.service b/test/units/nomemleaf.service
index 3cbaccb82f..3cbaccb82f 100644
--- a/test/nomemleaf.service
+++ b/test/units/nomemleaf.service
diff --git a/test/parent-deep.slice b/test/units/parent-deep.slice
index 79b302f38d..79b302f38d 100644
--- a/test/parent-deep.slice
+++ b/test/units/parent-deep.slice
diff --git a/test/parent.slice b/test/units/parent.slice
index a95f90392d..a95f90392d 100644
--- a/test/parent.slice
+++ b/test/units/parent.slice
diff --git a/test/sched_idle_bad.service b/test/units/sched_idle_bad.service
index 589a87ccfd..589a87ccfd 100644
--- a/test/sched_idle_bad.service
+++ b/test/units/sched_idle_bad.service
diff --git a/test/sched_idle_ok.service b/test/units/sched_idle_ok.service
index 262ef3e319..262ef3e319 100644
--- a/test/sched_idle_ok.service
+++ b/test/units/sched_idle_ok.service
diff --git a/test/sched_rr_bad.service b/test/units/sched_rr_bad.service
index 0be534a546..0be534a546 100644
--- a/test/sched_rr_bad.service
+++ b/test/units/sched_rr_bad.service
diff --git a/test/sched_rr_change.service b/test/units/sched_rr_change.service
index b3e3a000f8..b3e3a000f8 100644
--- a/test/sched_rr_change.service
+++ b/test/units/sched_rr_change.service
diff --git a/test/sched_rr_ok.service b/test/units/sched_rr_ok.service
index b88adc5434..b88adc5434 100644
--- a/test/sched_rr_ok.service
+++ b/test/units/sched_rr_ok.service
diff --git a/test/units/shutdown.target b/test/units/shutdown.target
new file mode 100644
index 0000000000..d48e6d6494
--- /dev/null
+++ b/test/units/shutdown.target
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: LGPL-2.1+
+#
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Shutdown
+Documentation=man:systemd.special(7)
+DefaultDependencies=no
+RefuseManualStart=yes
diff --git a/test/sleep.service b/test/units/sleep.service
index 946c44b621..946c44b621 100644
--- a/test/sleep.service
+++ b/test/units/sleep.service
diff --git a/test/units/sockets.target b/test/units/sockets.target
new file mode 100644
index 0000000000..9af67fdb1f
--- /dev/null
+++ b/test/units/sockets.target
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: LGPL-2.1+
+#
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Sockets
+Documentation=man:systemd.special(7)
diff --git a/test/son.service b/test/units/son.service
index 50bb96a941..50bb96a941 100644
--- a/test/son.service
+++ b/test/units/son.service
diff --git a/test/units/sysinit.target b/test/units/sysinit.target
new file mode 100644
index 0000000000..b6c16a1412
--- /dev/null
+++ b/test/units/sysinit.target
@@ -0,0 +1,15 @@
+# SPDX-License-Identifier: LGPL-2.1+
+#
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=System Initialization
+Documentation=man:systemd.special(7)
+Conflicts=emergency.service emergency.target
+Wants=local-fs.target swap.target
+After=local-fs.target swap.target emergency.service emergency.target
diff --git a/test/units/testsuite-01.service b/test/units/testsuite-01.service
new file mode 100644
index 0000000000..85b9cf5a96
--- /dev/null
+++ b/test/units/testsuite-01.service
@@ -0,0 +1,8 @@
+[Unit]
+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
diff --git a/test/units/testsuite-02.service b/test/units/testsuite-02.service
new file mode 100644
index 0000000000..701610b790
--- /dev/null
+++ b/test/units/testsuite-02.service
@@ -0,0 +1,8 @@
+[Unit]
+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
diff --git a/test/units/testsuite-03.service b/test/units/testsuite-03.service
new file mode 100644
index 0000000000..fe18fdc7d7
--- /dev/null
+++ b/test/units/testsuite-03.service
@@ -0,0 +1,8 @@
+[Unit]
+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
diff --git a/test/TEST-03-JOBS/test-jobs.sh b/test/units/testsuite-03.sh
index 85efeeb741..85efeeb741 100755
--- a/test/TEST-03-JOBS/test-jobs.sh
+++ b/test/units/testsuite-03.sh
diff --git a/test/units/testsuite-04.service b/test/units/testsuite-04.service
new file mode 100644
index 0000000000..3d2b4a8bc2
--- /dev/null
+++ b/test/units/testsuite-04.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-04-JOURNAL
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/TEST-04-JOURNAL/test-journal.sh b/test/units/testsuite-04.sh
index 1431dad862..1431dad862 100755
--- a/test/TEST-04-JOURNAL/test-journal.sh
+++ b/test/units/testsuite-04.sh
diff --git a/test/units/testsuite-05.service b/test/units/testsuite-05.service
new file mode 100644
index 0000000000..66356fd16f
--- /dev/null
+++ b/test/units/testsuite-05.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-05-RLIMITS
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/units/testsuite-05.sh b/test/units/testsuite-05.sh
new file mode 100755
index 0000000000..eed30c8b85
--- /dev/null
+++ b/test/units/testsuite-05.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+set -x
+set -e
+set -o pipefail
+
+P=/run/systemd/system.conf.d
+mkdir $P
+
+cat >$P/rlimits.conf <<EOF
+[Manager]
+DefaultLimitNOFILE=10000:16384
+EOF
+
+systemctl daemon-reload
+
+[[ "$(systemctl show --value -p DefaultLimitNOFILESoft)" = "10000" ]]
+[[ "$(systemctl show --value -p DefaultLimitNOFILE)" = "16384" ]]
+
+[[ "$(systemctl show --value -p LimitNOFILESoft testsuite-05.service)" = "10000" ]]
+[[ "$(systemctl show --value -p LimitNOFILE testsuite-05.service)" = "16384" ]]
+
+systemd-run --wait -t bash -c '[[ "$(ulimit -n -S)" = "10000" ]]'
+systemd-run --wait -t bash -c '[[ "$(ulimit -n -H)" = "16384" ]]'
+
+touch /testok
diff --git a/test/units/testsuite-06.service b/test/units/testsuite-06.service
new file mode 100644
index 0000000000..3f8dad36dc
--- /dev/null
+++ b/test/units/testsuite-06.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=TEST-06-SELINUX
+
+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
diff --git a/test/TEST-06-SELINUX/test-selinux-checks.sh b/test/units/testsuite-06.sh
index 9e722e362e..f9b106da7b 100755
--- a/test/TEST-06-SELINUX/test-selinux-checks.sh
+++ b/test/units/testsuite-06.sh
@@ -3,7 +3,12 @@ set -x
set -e
set -o pipefail
-echo 1 >/sys/fs/selinux/enforce
+echo 1 >/sys/fs/selinux/enforce || {
+ echo "Can't make selinux enforcing, skipping test"
+ touch /testok
+ exit
+}
+
runcon -t systemd_test_start_t systemctl start hola
runcon -t systemd_test_reload_t systemctl reload hola
runcon -t systemd_test_stop_t systemctl stop hola
diff --git a/test/units/testsuite-07.service b/test/units/testsuite-07.service
new file mode 100644
index 0000000000..2506c211c2
--- /dev/null
+++ b/test/units/testsuite-07.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-07-ISSUE-1981
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/TEST-07-ISSUE-1981/test-segfault.sh b/test/units/testsuite-07.sh
index fbb2d1d30a..fbb2d1d30a 100755
--- a/test/TEST-07-ISSUE-1981/test-segfault.sh
+++ b/test/units/testsuite-07.sh
diff --git a/test/units/testsuite-08.service b/test/units/testsuite-08.service
new file mode 100644
index 0000000000..d961dc7ae2
--- /dev/null
+++ b/test/units/testsuite-08.service
@@ -0,0 +1,7 @@
+[Unit]
+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
diff --git a/test/units/testsuite-09.service b/test/units/testsuite-09.service
new file mode 100644
index 0000000000..fc59e80889
--- /dev/null
+++ b/test/units/testsuite-09.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=TEST-09-ISSUE-2691
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=sh -c '>/testok'
+ExecStop=sh -c 'kill -SEGV $$$$'
+Type=oneshot
+RemainAfterExit=yes
+TimeoutStopSec=270s
diff --git a/test/units/testsuite-10.service b/test/units/testsuite-10.service
new file mode 100644
index 0000000000..24f0da35ab
--- /dev/null
+++ b/test/units/testsuite-10.service
@@ -0,0 +1,7 @@
+[Unit]
+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'
diff --git a/test/units/testsuite-11.service b/test/units/testsuite-11.service
new file mode 100644
index 0000000000..1544fd6819
--- /dev/null
+++ b/test/units/testsuite-11.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-11-ISSUE-3166
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/units/testsuite-11.sh b/test/units/testsuite-11.sh
new file mode 100755
index 0000000000..708c7cebb7
--- /dev/null
+++ b/test/units/testsuite-11.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+set -x
+
+systemctl start fail-on-restart.service
+active_state=$(systemctl show --value --property ActiveState fail-on-restart.service)
+while [[ "$active_state" == "activating" || "$active_state" == "active" ]]; do
+ sleep 1
+ active_state=$(systemctl show --value --property ActiveState fail-on-restart.service)
+done
+systemctl is-failed fail-on-restart.service || exit 1
+touch /testok
diff --git a/test/units/testsuite-12.service b/test/units/testsuite-12.service
new file mode 100644
index 0000000000..72894eff92
--- /dev/null
+++ b/test/units/testsuite-12.service
@@ -0,0 +1,8 @@
+[Unit]
+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
diff --git a/test/units/testsuite-12.sh b/test/units/testsuite-12.sh
new file mode 100755
index 0000000000..b5888a255b
--- /dev/null
+++ b/test/units/testsuite-12.sh
@@ -0,0 +1,47 @@
+#!/usr/bin/env bash
+set -x
+set -e
+set -o pipefail
+
+U=/run/systemd/system/test12.socket
+cat <<'EOF' >$U
+[Unit]
+Description=Test 12 socket
+[Socket]
+Accept=yes
+ListenStream=/run/test12.socket
+SocketGroup=adm
+SocketMode=0660
+EOF
+
+cat <<'EOF' > /run/systemd/system/test12@.service
+[Unit]
+Description=Test service
+[Service]
+StandardInput=socket
+ExecStart=/bin/sh -x -c cat
+EOF
+
+systemctl start test12.socket
+systemctl is-active test12.socket
+[[ "$(stat --format='%G' /run/test12.socket)" == adm ]]
+echo A | nc -w1 -U /run/test12.socket
+
+mv $U ${U}.disabled
+systemctl daemon-reload
+systemctl is-active test12.socket
+[[ "$(stat --format='%G' /run/test12.socket)" == adm ]]
+echo B | nc -w1 -U /run/test12.socket && exit 1
+
+mv ${U}.disabled $U
+systemctl daemon-reload
+systemctl is-active test12.socket
+echo C | nc -w1 -U /run/test12.socket && exit 1
+[[ "$(stat --format='%G' /run/test12.socket)" == adm ]]
+
+systemctl restart test12.socket
+systemctl is-active test12.socket
+echo D | nc -w1 -U /run/test12.socket
+[[ "$(stat --format='%G' /run/test12.socket)" == adm ]]
+
+touch /testok
diff --git a/test/units/testsuite-13.service b/test/units/testsuite-13.service
new file mode 100644
index 0000000000..5086793a90
--- /dev/null
+++ b/test/units/testsuite-13.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-13-NSPAWN-SMOKE
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/units/testsuite-13.sh b/test/units/testsuite-13.sh
new file mode 100755
index 0000000000..0ab684732c
--- /dev/null
+++ b/test/units/testsuite-13.sh
@@ -0,0 +1,150 @@
+#!/usr/bin/env bash
+set -x
+set -e
+set -u
+set -o pipefail
+
+export SYSTEMD_LOG_LEVEL=debug
+
+# check cgroup-v2
+is_v2_supported=no
+mkdir -p /tmp/cgroup2
+if mount -t cgroup2 cgroup2 /tmp/cgroup2; then
+ is_v2_supported=yes
+ umount /tmp/cgroup2
+fi
+rmdir /tmp/cgroup2
+
+# check cgroup namespaces
+is_cgns_supported=no
+if [[ -f /proc/1/ns/cgroup ]]; then
+ is_cgns_supported=yes
+fi
+
+is_user_ns_supported=no
+# On some systems (e.g. CentOS 7) the default limit for user namespaces
+# is set to 0, which causes the following unshare syscall to fail, even
+# with enabled user namespaces support. By setting this value explicitly
+# we can ensure the user namespaces support to be detected correctly.
+sysctl -w user.max_user_namespaces=10000
+if unshare -U sh -c :; then
+ is_user_ns_supported=yes
+fi
+
+function check_bind_tmp_path {
+ # https://github.com/systemd/systemd/issues/4789
+ local _root="/var/lib/machines/bind-tmp-path"
+ /usr/lib/systemd/tests/testdata/create-busybox-container "$_root"
+ >/tmp/bind
+ systemd-nspawn --register=no -D "$_root" --bind=/tmp/bind /bin/sh -c 'test -e /tmp/bind'
+}
+
+function check_norbind {
+ # https://github.com/systemd/systemd/issues/13170
+ local _root="/var/lib/machines/norbind-path"
+ mkdir -p /tmp/binddir/subdir
+ echo -n "outer" > /tmp/binddir/subdir/file
+ mount -t tmpfs tmpfs /tmp/binddir/subdir
+ echo -n "inner" > /tmp/binddir/subdir/file
+ /usr/lib/systemd/tests/testdata/create-busybox-container "$_root"
+ systemd-nspawn --register=no -D "$_root" --bind=/tmp/binddir:/mnt:norbind /bin/sh -c 'CONTENT=$(cat /mnt/subdir/file); if [[ $CONTENT != "outer" ]]; then echo "*** unexpected content: $CONTENT"; return 1; fi'
+}
+
+function check_notification_socket {
+ # https://github.com/systemd/systemd/issues/4944
+ local _cmd='echo a | $(busybox which nc) -U -u -w 1 /run/systemd/nspawn/notify'
+ systemd-nspawn --register=no -D /nc-container /bin/sh -x -c "$_cmd"
+ systemd-nspawn --register=no -D /nc-container -U /bin/sh -x -c "$_cmd"
+}
+
+function run {
+ if [[ "$1" = "yes" && "$is_v2_supported" = "no" ]]; then
+ printf "Unified cgroup hierarchy is not supported. Skipping.\n" >&2
+ return 0
+ fi
+ if [[ "$2" = "yes" && "$is_cgns_supported" = "no" ]]; then
+ printf "CGroup namespaces are not supported. Skipping.\n" >&2
+ return 0
+ fi
+
+ local _root="/var/lib/machines/unified-$1-cgns-$2-api-vfs-writable-$3"
+ /usr/lib/systemd/tests/testdata/create-busybox-container "$_root"
+ SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" -b
+ SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" --private-network -b
+
+ if SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" -U -b; then
+ [[ "$is_user_ns_supported" = "yes" && "$3" = "network" ]] && return 1
+ else
+ [[ "$is_user_ns_supported" = "no" && "$3" = "network" ]] && return 1
+ fi
+
+ if SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" --private-network -U -b; then
+ [[ "$is_user_ns_supported" = "yes" && "$3" = "yes" ]] && return 1
+ else
+ [[ "$is_user_ns_supported" = "no" && "$3" = "yes" ]] && return 1
+ fi
+
+ local _netns_opt="--network-namespace-path=/proc/self/ns/net"
+
+ # --network-namespace-path and network-related options cannot be used together
+ if SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" "$_netns_opt" --network-interface=lo -b; then
+ return 1
+ fi
+
+ if SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" "$_netns_opt" --network-macvlan=lo -b; then
+ return 1
+ fi
+
+ if SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" "$_netns_opt" --network-ipvlan=lo -b; then
+ return 1
+ fi
+
+ if SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" "$_netns_opt" --network-veth -b; then
+ return 1
+ fi
+
+ if SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" "$_netns_opt" --network-veth-extra=lo -b; then
+ return 1
+ fi
+
+ if SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" "$_netns_opt" --network-bridge=lo -b; then
+ return 1
+ fi
+
+ if SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" "$_netns_opt" --network-zone=zone -b; then
+ return 1
+ fi
+
+ # allow combination of --network-namespace-path and --private-network
+ if ! SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" "$_netns_opt" --private-network -b; then
+ return 1
+ fi
+
+ # test --network-namespace-path works with a network namespace created by "ip netns"
+ ip netns add nspawn_test
+ _netns_opt="--network-namespace-path=/run/netns/nspawn_test"
+ SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" "$_netns_opt" /bin/ip a | grep -v -E '^1: lo.*UP'
+ local r=$?
+ ip netns del nspawn_test
+
+ if [ $r -ne 0 ]; then
+ return 1
+ fi
+
+ return 0
+}
+
+check_bind_tmp_path
+
+check_norbind
+
+check_notification_socket
+
+for api_vfs_writable in yes no network; do
+ run no no $api_vfs_writable
+ run yes no $api_vfs_writable
+ run no yes $api_vfs_writable
+ run yes yes $api_vfs_writable
+done
+
+touch /testok
diff --git a/test/units/testsuite-14.service b/test/units/testsuite-14.service
new file mode 100644
index 0000000000..1606c68fb1
--- /dev/null
+++ b/test/units/testsuite-14.service
@@ -0,0 +1,8 @@
+[Unit]
+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
diff --git a/test/units/testsuite-14.sh b/test/units/testsuite-14.sh
new file mode 100755
index 0000000000..95ac9b65ae
--- /dev/null
+++ b/test/units/testsuite-14.sh
@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+set -e
+set -x
+
+function setup_root {
+ local _root="$1"
+ mkdir -p "$_root"
+ mount -t tmpfs tmpfs "$_root"
+ mkdir -p "$_root/etc" "$_root/run"
+}
+
+function check {
+ printf "Expected\n"
+ cat "$1"
+ printf "\nGot\n"
+ cat "$2"
+ cmp "$1" "$2"
+}
+
+r="$(pwd)/overwrite-broken-machine-id"
+setup_root "$r"
+systemd-machine-id-setup --print --root "$r"
+echo abc >>"$r/etc/machine-id"
+id=$(systemd-machine-id-setup --print --root "$r")
+echo $id >expected
+check expected "$r/etc/machine-id"
+
+r="$(pwd)/transient-machine-id"
+setup_root "$r"
+systemd-machine-id-setup --print --root "$r"
+echo abc >>"$r/etc/machine-id"
+mount -o remount,ro "$r"
+mount -t tmpfs tmpfs "$r/run"
+transient_id=$(systemd-machine-id-setup --print --root "$r")
+mount -o remount,rw "$r"
+commited_id=$(systemd-machine-id-setup --print --commit --root "$r")
+[[ "$transient_id" = "$commited_id" ]]
+check "$r/etc/machine-id" "$r/run/machine-id"
diff --git a/test/units/testsuite-15.service b/test/units/testsuite-15.service
new file mode 100644
index 0000000000..09571ed1ab
--- /dev/null
+++ b/test/units/testsuite-15.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-15-DROPIN
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/TEST-15-DROPIN/test-dropin.sh b/test/units/testsuite-15.sh
index f80c9df107..b872a24c20 100755
--- a/test/TEST-15-DROPIN/test-dropin.sh
+++ b/test/units/testsuite-15.sh
@@ -7,6 +7,12 @@ _clear_service () {
rm -f /{etc,run,usr/lib}/systemd/system/$1.service
rm -fr /{etc,run,usr/lib}/systemd/system/$1.service.d
rm -fr /{etc,run,usr/lib}/systemd/system/$1.service.{wants,requires}
+ if [[ $1 == *@ ]]; then
+ systemctl stop $1*.service 2>/dev/null || :
+ rm -f /{etc,run,usr/lib}/systemd/system/$1*.service
+ rm -fr /{etc,run,usr/lib}/systemd/system/$1*.service.d
+ rm -fr /{etc,run,usr/lib}/systemd/system/$1*.service.{wants,requires}
+ fi
}
clear_services () {
@@ -56,65 +62,66 @@ test_basic_dropins () {
echo "Testing basic dropins..."
echo "*** test a wants b wants c"
- create_services a b c
- ln -s ../b.service /etc/systemd/system/a.service.wants/
- ln -s ../c.service /etc/systemd/system/b.service.wants/
- check_ok a Wants b.service
- check_ok b Wants c.service
+ create_services test15-a test15-b test15-c
+ ln -s ../test15-b.service /etc/systemd/system/test15-a.service.wants/
+ ln -s ../test15-c.service /etc/systemd/system/test15-b.service.wants/
+ check_ok test15-a Wants test15-b.service
+ check_ok test15-b Wants test15-c.service
echo "*** test a wants,requires b"
- create_services a b c
- ln -s ../b.service /etc/systemd/system/a.service.wants/
- ln -s ../b.service /etc/systemd/system/a.service.requires/
- check_ok a Wants b.service
- check_ok a Requires b.service
+ create_services test15-a test15-b test15-c
+ ln -s ../test15-b.service /etc/systemd/system/test15-a.service.wants/
+ ln -s ../test15-b.service /etc/systemd/system/test15-a.service.requires/
+ check_ok test15-a Wants test15-b.service
+ check_ok test15-a Requires test15-b.service
echo "*** test a wants nonexistent"
- create_service a
- ln -s ../nonexistent.service /etc/systemd/system/a.service.wants/
- check_ok a Wants nonexistent.service
- systemctl start a
- systemctl stop a
+ create_service test15-a
+ ln -s ../nonexistent.service /etc/systemd/system/test15-a.service.wants/
+ check_ok test15-a Wants nonexistent.service
+ systemctl start test15-a
+ systemctl stop test15-a
echo "*** test a requires nonexistent"
- ln -sf ../nonexistent.service /etc/systemd/system/a.service.requires/
+ ln -sf ../nonexistent.service /etc/systemd/system/test15-a.service.requires/
systemctl daemon-reload
- check_ok a Requires nonexistent.service
+ check_ok test15-a Requires nonexistent.service
# 'b' is already loaded when 'c' pulls it in via a dropin.
echo "*** test a,c require b"
- create_services a b c
- ln -sf ../b.service /etc/systemd/system/a.service.requires/
- ln -sf ../b.service /etc/systemd/system/c.service.requires/
- systemctl start a
- check_ok c Requires b.service
- systemctl stop a b
+ create_services test15-a test15-b test15-c
+ ln -sf ../test15-b.service /etc/systemd/system/test15-a.service.requires/
+ ln -sf ../test15-b.service /etc/systemd/system/test15-c.service.requires/
+ systemctl start test15-a
+ check_ok test15-c Requires test15-b.service
+ systemctl stop test15-a test15-b
# 'b' is already loaded when 'c' pulls it in via an alias dropin.
echo "*** test a wants alias"
- create_services a b c
- ln -sf c.service /etc/systemd/system/c1.service
- ln -sf ../c.service /etc/systemd/system/a.service.wants/
- ln -sf ../c1.service /etc/systemd/system/b.service.wants/
- systemctl start a
- check_ok a Wants c.service
- check_ok b Wants c.service
- systemctl stop a c
+ create_services test15-a test15-b test15-c
+ ln -sf test15-c.service /etc/systemd/system/test15-c1.service
+ ln -sf ../test15-c.service /etc/systemd/system/test15-a.service.wants/
+ ln -sf ../test15-c1.service /etc/systemd/system/test15-b.service.wants/
+ systemctl start test15-a
+ check_ok test15-a Wants test15-c.service
+ check_ok test15-b Wants test15-c.service
+ systemctl stop test15-a test15-c
echo "*** test service.d/ top level drop-in"
- create_services a b
- check_ko a ExecCondition "/bin/echo a"
- check_ko b ExecCondition "/bin/echo b"
+ create_services test15-a test15-b
+ check_ko test15-a ExecCondition "/bin/echo a"
+ check_ko test15-b ExecCondition "/bin/echo b"
mkdir -p /usr/lib/systemd/system/service.d
cat >/usr/lib/systemd/system/service.d/override.conf <<EOF
[Service]
ExecCondition=/bin/echo %n
EOF
- check_ok a ExecCondition "/bin/echo a"
- check_ok b ExecCondition "/bin/echo b"
+ systemctl daemon-reload
+ check_ok test15-a ExecCondition "/bin/echo test15-a"
+ check_ok test15-b ExecCondition "/bin/echo test15-b"
rm -rf /usr/lib/systemd/system/service.d
- clear_services a b c
+ clear_services test15-a test15-b test15-c
}
test_hierarchical_dropins () {
@@ -132,6 +139,7 @@ test_hierarchical_dropins () {
[Service]
ExecCondition=/bin/echo $dropin
" > /usr/lib/systemd/system/$dropin/override.conf
+ systemctl daemon-reload
check_ok a-b-c ExecCondition "/bin/echo $dropin"
done
for dropin in service.d a-.service.d a-b-.service.d a-b-c.service.d; do
@@ -294,153 +302,153 @@ test_alias_dropins () {
echo "Testing alias dropins..."
echo "*** test a wants b1 alias of b"
- create_services a b
- ln -sf b.service /etc/systemd/system/b1.service
- ln -sf ../b1.service /etc/systemd/system/a.service.wants/
- check_ok a Wants b.service
- systemctl start a
- systemctl --quiet is-active b
- systemctl stop a b
- rm /etc/systemd/system/b1.service
- clear_services a b
+ create_services test15-a test15-b
+ ln -sf test15-b.service /etc/systemd/system/test15-b1.service
+ ln -sf ../test15-b1.service /etc/systemd/system/test15-a.service.wants/
+ check_ok test15-a Wants test15-b.service
+ systemctl start test15-a
+ systemctl --quiet is-active test15-b
+ systemctl stop test15-a test15-b
+ rm /etc/systemd/system/test15-b1.service
+ clear_services test15-a test15-b
# Check that dependencies don't vary.
echo "*** test 2"
- create_services a x y
- mkdir -p /etc/systemd/system/a1.service.wants/
- ln -sf a.service /etc/systemd/system/a1.service
- ln -sf ../x.service /etc/systemd/system/a.service.wants/
- ln -sf ../y.service /etc/systemd/system/a1.service.wants/
- check_ok a1 Wants x.service # see [1]
- check_ok a1 Wants y.service
- systemctl start a
- check_ok a1 Wants x.service # see [2]
- check_ok a1 Wants y.service
- systemctl stop a x y
- rm /etc/systemd/system/a1.service
-
- clear_services a x y
+ create_services test15-a test15-x test15-y
+ mkdir -p /etc/systemd/system/test15-a1.service.wants/
+ ln -sf test15-a.service /etc/systemd/system/test15-a1.service
+ ln -sf ../test15-x.service /etc/systemd/system/test15-a.service.wants/
+ ln -sf ../test15-y.service /etc/systemd/system/test15-a1.service.wants/
+ check_ok test15-a1 Wants test15-x.service # see [1]
+ check_ok test15-a1 Wants test15-y.service
+ systemctl start test15-a
+ check_ok test15-a1 Wants test15-x.service # see [2]
+ check_ok test15-a1 Wants test15-y.service
+ systemctl stop test15-a test15-x test15-y
+ rm /etc/systemd/system/test15-a1.service
+
+ clear_services test15-a test15-x test15-y
}
test_masked_dropins () {
echo "Testing masked dropins..."
- create_services a b
+ create_services test15-a test15-b
# 'b' is masked for both deps
echo "*** test a wants,requires b is masked"
- ln -sf /dev/null /etc/systemd/system/a.service.wants/b.service
- ln -sf /dev/null /etc/systemd/system/a.service.requires/b.service
- check_ko a Wants b.service
- check_ko a Requires b.service
+ ln -sf /dev/null /etc/systemd/system/test15-a.service.wants/test15-b.service
+ ln -sf /dev/null /etc/systemd/system/test15-a.service.requires/test15-b.service
+ check_ko test15-a Wants test15-b.service
+ check_ko test15-a Requires test15-b.service
# 'a' wants 'b' and 'b' is masked at a lower level
echo "*** test a wants b, mask override"
- ln -sf ../b.service /etc/systemd/system/a.service.wants/b.service
- ln -sf /dev/null /usr/lib/systemd/system/a.service.wants/b.service
- check_ok a Wants b.service
+ ln -sf ../test15-b.service /etc/systemd/system/test15-a.service.wants/test15-b.service
+ ln -sf /dev/null /usr/lib/systemd/system/test15-a.service.wants/test15-b.service
+ check_ok test15-a Wants test15-b.service
# 'a' wants 'b' and 'b' is masked at a higher level
echo "*** test a wants b, mask"
- ln -sf /dev/null /etc/systemd/system/a.service.wants/b.service
- ln -sf ../b.service /usr/lib/systemd/system/a.service.wants/b.service
- check_ko a Wants b.service
+ ln -sf /dev/null /etc/systemd/system/test15-a.service.wants/test15-b.service
+ ln -sf ../test15-b.service /usr/lib/systemd/system/test15-a.service.wants/test15-b.service
+ check_ko test15-a Wants test15-b.service
# 'a' is masked but has an override config file
echo "*** test a is masked but has an override"
- create_services a b
- ln -sf /dev/null /etc/systemd/system/a.service
- cat >/usr/lib/systemd/system/a.service.d/override.conf <<EOF
+ create_services test15-a test15-b
+ ln -sf /dev/null /etc/systemd/system/test15-a.service
+ cat >/usr/lib/systemd/system/test15-a.service.d/override.conf <<EOF
[Unit]
-After=b.service
+After=test15-b.service
EOF
- check_ok a UnitFileState masked
+ check_ok test15-a UnitFileState masked
# 'b1' is an alias for 'b': masking 'b' dep should not influence 'b1' dep
echo "*** test a wants b, b1, and one is masked"
- create_services a b
- ln -sf b.service /etc/systemd/system/b1.service
- ln -sf /dev/null /etc/systemd/system/a.service.wants/b.service
- ln -sf ../b1.service /usr/lib/systemd/system/a.service.wants/b1.service
- systemctl cat a
- systemctl show -p Wants,Requires a
- systemctl cat b1
- systemctl show -p Wants,Requires b1
- check_ok a Wants b.service
- check_ko a Wants b1.service # the alias does not show up in the list of units
- rm /etc/systemd/system/b1.service
+ create_services test15-a test15-b
+ ln -sf test15-b.service /etc/systemd/system/test15-b1.service
+ ln -sf /dev/null /etc/systemd/system/test15-a.service.wants/test15-b.service
+ ln -sf ../test15-b1.service /usr/lib/systemd/system/test15-a.service.wants/test15-b1.service
+ systemctl cat test15-a
+ systemctl show -p Wants,Requires test15-a
+ systemctl cat test15-b1
+ systemctl show -p Wants,Requires test15-b1
+ check_ok test15-a Wants test15-b.service
+ check_ko test15-a Wants test15-b1.service # the alias does not show up in the list of units
+ rm /etc/systemd/system/test15-b1.service
# 'b1' is an alias for 'b': masking 'b1' should not influence 'b' dep
echo "*** test a wants b, alias dep is masked"
- create_services a b
- ln -sf b.service /etc/systemd/system/b1.service
- ln -sf /dev/null /etc/systemd/system/a.service.wants/b1.service
- ln -sf ../b.service /usr/lib/systemd/system/a.service.wants/b.service
- check_ok a Wants b.service
- check_ko a Wants b1.service # the alias does not show up in the list of units
- rm /etc/systemd/system/b1.service
+ create_services test15-a test15-b
+ ln -sf test15-b.service /etc/systemd/system/test15-b1.service
+ ln -sf /dev/null /etc/systemd/system/test15-a.service.wants/test15-b1.service
+ ln -sf ../test15-b.service /usr/lib/systemd/system/test15-a.service.wants/test15-b.service
+ check_ok test15-a Wants test15-b.service
+ check_ko test15-a Wants test15-b1.service # the alias does not show up in the list of units
+ rm /etc/systemd/system/test15-b1.service
# 'a' has Wants=b.service but also has a masking
# dropin 'b': 'b' should still be pulled in.
echo "*** test a wants b both ways"
- create_services a b
- ln -sf /dev/null /etc/systemd/system/a.service.wants/b.service
- cat >/usr/lib/systemd/system/a.service.d/wants-b.conf<<EOF
+ create_services test15-a test15-b
+ ln -sf /dev/null /etc/systemd/system/test15-a.service.wants/test15-b.service
+ cat >/usr/lib/systemd/system/test15-a.service.d/wants-b.conf<<EOF
[Unit]
-Wants=b.service
+Wants=test15-b.service
EOF
- check_ok a Wants b.service
+ check_ok test15-a Wants test15-b.service
# mask a dropin that points to an nonexistent unit.
echo "*** test a wants nonexistent is masked"
- create_services a
- ln -sf /dev/null /etc/systemd/system/a.service.requires/nonexistent.service
- ln -sf ../nonexistent.service /usr/lib/systemd/system/a.service.requires/
- check_ko a Requires nonexistent.service
+ create_services test15-a
+ ln -sf /dev/null /etc/systemd/system/test15-a.service.requires/nonexistent.service
+ ln -sf ../nonexistent.service /usr/lib/systemd/system/test15-a.service.requires/
+ check_ko test15-a Requires nonexistent.service
# 'b' is already loaded when 'c' pulls it in via a dropin but 'b' is
# masked at a higher level.
echo "*** test a wants b is masked"
- create_services a b c
- ln -sf ../b.service /etc/systemd/system/a.service.requires/
- ln -sf ../b.service /run/systemd/system/c.service.requires/
- ln -sf /dev/null /etc/systemd/system/c.service.requires/b.service
- systemctl start a
- check_ko c Requires b.service
- systemctl stop a b
+ create_services test15-a test15-b test15-c
+ ln -sf ../test15-b.service /etc/systemd/system/test15-a.service.requires/
+ ln -sf ../test15-b.service /run/systemd/system/test15-c.service.requires/
+ ln -sf /dev/null /etc/systemd/system/test15-c.service.requires/test15-b.service
+ systemctl start test15-a
+ check_ko test15-c Requires test15-b.service
+ systemctl stop test15-a test15-b
# 'b' is already loaded when 'c' pulls it in via a dropin but 'b' is
# masked at a lower level.
echo "*** test a requires b is masked"
- create_services a b c
- ln -sf ../b.service /etc/systemd/system/a.service.requires/
- ln -sf ../b.service /etc/systemd/system/c.service.requires/
- ln -sf /dev/null /run/systemd/system/c.service.requires/b.service
- systemctl start a
- check_ok c Requires b.service
- systemctl stop a b
+ create_services test15-a test15-b test15-c
+ ln -sf ../test15-b.service /etc/systemd/system/test15-a.service.requires/
+ ln -sf ../test15-b.service /etc/systemd/system/test15-c.service.requires/
+ ln -sf /dev/null /run/systemd/system/test15-c.service.requires/test15-b.service
+ systemctl start test15-a
+ check_ok test15-c Requires test15-b.service
+ systemctl stop test15-a test15-b
# 'a' requires 2 aliases of 'b' and one of them is a mask.
echo "*** test a requires alias of b, other alias masked"
- create_services a b
- ln -sf b.service /etc/systemd/system/b1.service
- ln -sf b.service /etc/systemd/system/b2.service
- ln -sf /dev/null /etc/systemd/system/a.service.requires/b1.service
- ln -sf ../b1.service /run/systemd/system/a.service.requires/
- ln -sf ../b2.service /usr/lib/systemd/system/a.service.requires/
- check_ok a Requires b
+ create_services test15-a test15-b
+ ln -sf test15-b.service /etc/systemd/system/test15-b1.service
+ ln -sf test15-b.service /etc/systemd/system/test15-b2.service
+ ln -sf /dev/null /etc/systemd/system/test15-a.service.requires/test15-b1.service
+ ln -sf ../test15-b1.service /run/systemd/system/test15-a.service.requires/
+ ln -sf ../test15-b2.service /usr/lib/systemd/system/test15-a.service.requires/
+ check_ok test15-a Requires test15-b
# Same as above but now 'b' is masked.
echo "*** test a requires alias of b, b dep masked"
- create_services a b
- ln -sf b.service /etc/systemd/system/b1.service
- ln -sf b.service /etc/systemd/system/b2.service
- ln -sf ../b1.service /run/systemd/system/a.service.requires/
- ln -sf ../b2.service /usr/lib/systemd/system/a.service.requires/
- ln -sf /dev/null /etc/systemd/system/a.service.requires/b.service
- check_ok a Requires b
-
- clear_services a b
+ create_services test15-a test15-b
+ ln -sf test15-b.service /etc/systemd/system/test15-b1.service
+ ln -sf test15-b.service /etc/systemd/system/test15-b2.service
+ ln -sf ../test15-b1.service /run/systemd/system/test15-a.service.requires/
+ ln -sf ../test15-b2.service /usr/lib/systemd/system/test15-a.service.requires/
+ ln -sf /dev/null /etc/systemd/system/test15-a.service.requires/test15-b.service
+ check_ok test15-a Requires test15-b
+
+ clear_services test15-a test15-b
}
test_invalid_dropins () {
diff --git a/test/units/testsuite-16.service b/test/units/testsuite-16.service
new file mode 100644
index 0000000000..b44baad91a
--- /dev/null
+++ b/test/units/testsuite-16.service
@@ -0,0 +1,19 @@
+[Unit]
+Description=TEST-16-EXTEND-TIMEOUT
+# Testsuite: Assess all other testsuite-*.services worked as expected
+
+Wants=success-all.service
+Wants=success-start.service
+Wants=success-runtime.service
+Wants=success-stop.service
+Wants=fail-start.service
+Wants=fail-stop.service
+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
+ExecStart=true
diff --git a/test/TEST-16-EXTEND-TIMEOUT/assess.sh b/test/units/testsuite-16.sh
index 6f98810b30..68e5561245 100755
--- a/test/TEST-16-EXTEND-TIMEOUT/assess.sh
+++ b/test/units/testsuite-16.sh
@@ -19,7 +19,7 @@ function wait_for()
if [[ ! -f /${service}.${result} ]]
then
- journalctl -u testsuite-${service/_/-}.service >> "${TL}"
+ journalctl -u ${service/_/-}.service >> "${TL}"
fi
}
diff --git a/test/units/testsuite-17.service b/test/units/testsuite-17.service
new file mode 100644
index 0000000000..ed2017a848
--- /dev/null
+++ b/test/units/testsuite-17.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-17-UDEV-WANTS
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/TEST-17-UDEV-WANTS/testsuite.sh b/test/units/testsuite-17.sh
index 989c190ce3..7f8740ba35 100755
--- a/test/TEST-17-UDEV-WANTS/testsuite.sh
+++ b/test/units/testsuite-17.sh
@@ -69,6 +69,6 @@ while : ; do
sleep .5
done
-echo OK > /testok
+echo OK >/testok
exit 0
diff --git a/test/units/testsuite-18.service b/test/units/testsuite-18.service
new file mode 100644
index 0000000000..e4a945dc3e
--- /dev/null
+++ b/test/units/testsuite-18.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-18-FAILUREACTION
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/TEST-18-FAILUREACTION/testsuite.sh b/test/units/testsuite-18.sh
index e471cda51b..e471cda51b 100755
--- a/test/TEST-18-FAILUREACTION/testsuite.sh
+++ b/test/units/testsuite-18.sh
diff --git a/test/units/testsuite-19.service b/test/units/testsuite-19.service
new file mode 100644
index 0000000000..d6ad5beded
--- /dev/null
+++ b/test/units/testsuite-19.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-19-DELEGATE
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/TEST-19-DELEGATE/testsuite.sh b/test/units/testsuite-19.sh
index 57831c267f..57831c267f 100755
--- a/test/TEST-19-DELEGATE/testsuite.sh
+++ b/test/units/testsuite-19.sh
diff --git a/test/units/testsuite-20.service b/test/units/testsuite-20.service
new file mode 100644
index 0000000000..d31d531175
--- /dev/null
+++ b/test/units/testsuite-20.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=TEST-20-MAINPIDGAMES
+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
diff --git a/test/TEST-20-MAINPIDGAMES/testsuite.sh b/test/units/testsuite-20.sh
index f894026070..c038c05fa7 100755
--- a/test/TEST-20-MAINPIDGAMES/testsuite.sh
+++ b/test/units/testsuite-20.sh
@@ -5,7 +5,7 @@ set -o pipefail
systemd-analyze log-level debug
systemd-analyze log-target console
-test `systemctl show -p MainPID --value testsuite.service` -eq $$
+test `systemctl show -p MainPID --value testsuite-20.service` -eq $$
# Start a test process inside of our own cgroup
sleep infinity &
@@ -13,48 +13,48 @@ INTERNALPID=$!
disown
# Start a test process outside of our own cgroup
-systemd-run -p DynamicUser=1 --unit=sleep.service /bin/sleep infinity
-EXTERNALPID=`systemctl show -p MainPID --value sleep.service`
+systemd-run -p DynamicUser=1 --unit=test20-sleep.service /bin/sleep infinity
+EXTERNALPID=`systemctl show -p MainPID --value test20-sleep.service`
# Update our own main PID to the external test PID, this should work
systemd-notify MAINPID=$EXTERNALPID
-test `systemctl show -p MainPID --value testsuite.service` -eq $EXTERNALPID
+test `systemctl show -p MainPID --value testsuite-20.service` -eq $EXTERNALPID
# Update our own main PID to the internal test PID, this should work, too
systemd-notify MAINPID=$INTERNALPID
-test `systemctl show -p MainPID --value testsuite.service` -eq $INTERNALPID
+test `systemctl show -p MainPID --value testsuite-20.service` -eq $INTERNALPID
# Update it back to our own PID, this should also work
systemd-notify MAINPID=$$
-test `systemctl show -p MainPID --value testsuite.service` -eq $$
+test `systemctl show -p MainPID --value testsuite-20.service` -eq $$
# Try to set it to PID 1, which it should ignore, because that's the manager
systemd-notify MAINPID=1
-test `systemctl show -p MainPID --value testsuite.service` -eq $$
+test `systemctl show -p MainPID --value testsuite-20.service` -eq $$
# Try to set it to PID 0, which is invalid and should be ignored
systemd-notify MAINPID=0
-test `systemctl show -p MainPID --value testsuite.service` -eq $$
+test `systemctl show -p MainPID --value testsuite-20.service` -eq $$
# Try to set it to a valid but non-existing PID, which should be ignored. (Note
# that we set the PID to a value well above any known /proc/sys/kernel/pid_max,
# which means we can be pretty sure it doesn't exist by coincidence)
systemd-notify MAINPID=1073741824
-test `systemctl show -p MainPID --value testsuite.service` -eq $$
+test `systemctl show -p MainPID --value testsuite-20.service` -eq $$
# Change it again to the external PID, without privileges this time. This should be ignored, because the PID is from outside of our cgroup and we lack privileges.
systemd-notify --uid=1000 MAINPID=$EXTERNALPID
-test `systemctl show -p MainPID --value testsuite.service` -eq $$
+test `systemctl show -p MainPID --value testsuite-20.service` -eq $$
# Change it again to the internal PID, without privileges this time. This should work, as the process is on our cgroup, and that's enough even if we lack privileges.
systemd-notify --uid=1000 MAINPID=$INTERNALPID
-test `systemctl show -p MainPID --value testsuite.service` -eq $INTERNALPID
+test `systemctl show -p MainPID --value testsuite-20.service` -eq $INTERNALPID
# Update it back to our own PID, this should also work
systemd-notify --uid=1000 MAINPID=$$
-test `systemctl show -p MainPID --value testsuite.service` -eq $$
+test `systemctl show -p MainPID --value testsuite-20.service` -eq $$
-cat >/tmp/mainpid.sh <<EOF
+cat >/tmp/test20-mainpid.sh <<EOF
#!/usr/bin/env bash
set -eux
@@ -73,12 +73,12 @@ disown
echo \$MAINPID > /run/mainpidsh/pid
EOF
-chmod +x /tmp/mainpid.sh
+chmod +x /tmp/test20-mainpid.sh
-systemd-run --unit=mainpidsh.service -p StandardOutput=tty -p StandardError=tty -p Type=forking -p RuntimeDirectory=mainpidsh -p PIDFile=/run/mainpidsh/pid /tmp/mainpid.sh
-test `systemctl show -p MainPID --value mainpidsh.service` -eq `cat /run/mainpidsh/pid`
+systemd-run --unit=test20-mainpidsh.service -p StandardOutput=tty -p StandardError=tty -p Type=forking -p RuntimeDirectory=mainpidsh -p PIDFile=/run/mainpidsh/pid /tmp/test20-mainpid.sh
+test `systemctl show -p MainPID --value test20-mainpidsh.service` -eq `cat /run/mainpidsh/pid`
-cat >/tmp/mainpid2.sh <<EOF
+cat >/tmp/test20-mainpid2.sh <<EOF
#!/usr/bin/env bash
set -eux
@@ -98,12 +98,12 @@ disown
echo \$MAINPID > /run/mainpidsh2/pid
chown 1001:1001 /run/mainpidsh2/pid
EOF
-chmod +x /tmp/mainpid2.sh
+chmod +x /tmp/test20-mainpid2.sh
-systemd-run --unit=mainpidsh2.service -p StandardOutput=tty -p StandardError=tty -p Type=forking -p RuntimeDirectory=mainpidsh2 -p PIDFile=/run/mainpidsh2/pid /tmp/mainpid2.sh
-test `systemctl show -p MainPID --value mainpidsh2.service` -eq `cat /run/mainpidsh2/pid`
+systemd-run --unit=test20-mainpidsh2.service -p StandardOutput=tty -p StandardError=tty -p Type=forking -p RuntimeDirectory=mainpidsh2 -p PIDFile=/run/mainpidsh2/pid /tmp/test20-mainpid2.sh
+test `systemctl show -p MainPID --value test20-mainpidsh2.service` -eq `cat /run/mainpidsh2/pid`
-cat >/dev/shm/mainpid3.sh <<EOF
+cat >/dev/shm/test20-mainpid3.sh <<EOF
#!/usr/bin/env bash
set -eux
@@ -124,13 +124,13 @@ ln -s ../mainpidsh/pid /run/mainpidsh3/pid
# Quick assertion that the link isn't dead
test -f /run/mainpidsh3/pid
EOF
-chmod 755 /dev/shm/mainpid3.sh
+chmod 755 /dev/shm/test20-mainpid3.sh
# This has to fail, as we shouldn't accept the dangerous PID file, and then inotify-wait on it to be corrected which we never do
-! systemd-run --unit=mainpidsh3.service -p StandardOutput=tty -p StandardError=tty -p Type=forking -p RuntimeDirectory=mainpidsh3 -p PIDFile=/run/mainpidsh3/pid -p DynamicUser=1 -p TimeoutStartSec=2s /dev/shm/mainpid3.sh
+! systemd-run --unit=test20-mainpidsh3.service -p StandardOutput=tty -p StandardError=tty -p Type=forking -p RuntimeDirectory=mainpidsh3 -p PIDFile=/run/mainpidsh3/pid -p DynamicUser=1 -p TimeoutStartSec=2s /dev/shm/test20-mainpid3.sh
# Test that this failed due to timeout, and not some other error
-test `systemctl show -p Result --value mainpidsh3.service` = timeout
+test `systemctl show -p Result --value test20-mainpidsh3.service` = timeout
systemd-analyze log-level info
diff --git a/test/TEST-22-TMPFILES/test-01.sh b/test/units/testsuite-22.01.sh
index d233e37fb2..d233e37fb2 100755
--- a/test/TEST-22-TMPFILES/test-01.sh
+++ b/test/units/testsuite-22.01.sh
diff --git a/test/TEST-22-TMPFILES/test-02.sh b/test/units/testsuite-22.02.sh
index d1bf1ea04b..d1bf1ea04b 100755
--- a/test/TEST-22-TMPFILES/test-02.sh
+++ b/test/units/testsuite-22.02.sh
diff --git a/test/TEST-22-TMPFILES/test-03.sh b/test/units/testsuite-22.03.sh
index 8d009fb5bb..8d009fb5bb 100755
--- a/test/TEST-22-TMPFILES/test-03.sh
+++ b/test/units/testsuite-22.03.sh
diff --git a/test/TEST-22-TMPFILES/test-04.sh b/test/units/testsuite-22.04.sh
index f916086b1e..f916086b1e 100755
--- a/test/TEST-22-TMPFILES/test-04.sh
+++ b/test/units/testsuite-22.04.sh
diff --git a/test/TEST-22-TMPFILES/test-05.sh b/test/units/testsuite-22.05.sh
index 13c4ac80fc..13c4ac80fc 100755
--- a/test/TEST-22-TMPFILES/test-05.sh
+++ b/test/units/testsuite-22.05.sh
diff --git a/test/TEST-22-TMPFILES/test-06.sh b/test/units/testsuite-22.06.sh
index cd65ba6726..cd65ba6726 100755
--- a/test/TEST-22-TMPFILES/test-06.sh
+++ b/test/units/testsuite-22.06.sh
diff --git a/test/TEST-22-TMPFILES/test-07.sh b/test/units/testsuite-22.07.sh
index 39c04b925c..39c04b925c 100755
--- a/test/TEST-22-TMPFILES/test-07.sh
+++ b/test/units/testsuite-22.07.sh
diff --git a/test/TEST-22-TMPFILES/test-08.sh b/test/units/testsuite-22.08.sh
index e7bf044783..e7bf044783 100755
--- a/test/TEST-22-TMPFILES/test-08.sh
+++ b/test/units/testsuite-22.08.sh
diff --git a/test/TEST-22-TMPFILES/test-09.sh b/test/units/testsuite-22.09.sh
index c558dfd4db..c558dfd4db 100755
--- a/test/TEST-22-TMPFILES/test-09.sh
+++ b/test/units/testsuite-22.09.sh
diff --git a/test/TEST-22-TMPFILES/testsuite.service b/test/units/testsuite-22.service
index 2f1b15c3ed..55e3056d53 100644
--- a/test/TEST-22-TMPFILES/testsuite.service
+++ b/test/units/testsuite-22.service
@@ -1,12 +1,12 @@
[Unit]
-Description=Testsuite service
+Description=TEST-22-TMPFILES
After=systemd-tmpfiles-setup.service
Before=getty-pre.target
Wants=getty-pre.target
[Service]
-WorkingDirectory=/testsuite
-ExecStart=/testsuite/run-tmpfiles-tests.sh
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot
StandardOutput=tty
StandardError=tty
diff --git a/test/TEST-22-TMPFILES/run-tmpfiles-tests.sh b/test/units/testsuite-22.sh
index a0158f0421..afce85aceb 100755
--- a/test/TEST-22-TMPFILES/run-tmpfiles-tests.sh
+++ b/test/units/testsuite-22.sh
@@ -5,8 +5,8 @@ set -e
>/failed
-for t in test-*.sh; do
- echo "Running $t"; ./$t
+for t in ${0%.sh}.*.sh; do
+ echo "Running $t"; ./$t
done
touch /testok
diff --git a/test/units/testsuite-23.service b/test/units/testsuite-23.service
new file mode 100644
index 0000000000..b3b3297af8
--- /dev/null
+++ b/test/units/testsuite-23.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-23-TYPE-EXEC
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/TEST-23-TYPE-EXEC/testsuite.sh b/test/units/testsuite-23.sh
index 5e2966f848..5e2966f848 100755
--- a/test/TEST-23-TYPE-EXEC/testsuite.sh
+++ b/test/units/testsuite-23.sh
diff --git a/test/units/testsuite-24.service b/test/units/testsuite-24.service
new file mode 100644
index 0000000000..43d4816d48
--- /dev/null
+++ b/test/units/testsuite-24.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-24-UNIT-TESTS
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/TEST-24-UNIT-TESTS/testsuite.sh b/test/units/testsuite-24.sh
index cc78adbbe9..1ff1c3347b 100755
--- a/test/TEST-24-UNIT-TESTS/testsuite.sh
+++ b/test/units/testsuite-24.sh
@@ -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
@@ -21,23 +24,23 @@ function report_result() {
if [[ $ret -ne 0 && $ret != 77 ]]; then
echo "$name failed with $ret"
- echo "$name" >> /failed-tests
+ echo "$name" >>/failed-tests
{
echo "--- $name begin ---"
cat "/$name.log"
echo "--- $name end ---"
- } >> /failed
+ } >>/failed
elif [[ $ret == 77 ]]; then
echo "$name skipped"
- echo "$name" >> /skipped-tests
+ echo "$name" >>/skipped-tests
{
echo "--- $name begin ---"
cat "/$name.log"
echo "--- $name end ---"
- } >> /skipped
+ } >>/skipped
else
echo "$name OK"
- echo "$name" >> /testok
+ echo "$name" >>/testok
fi
systemd-cat echo "--- $name ---"
@@ -69,7 +72,7 @@ for task in "${TEST_LIST[@]}"; do
if [[ -x $task ]]; then
log_file="/${task##*/}.log"
- $task &> "$log_file" &
+ $task &>"$log_file" &
running[$task]=$!
fi
done
diff --git a/test/units/testsuite-25.service b/test/units/testsuite-25.service
new file mode 100644
index 0000000000..45d8b6945f
--- /dev/null
+++ b/test/units/testsuite-25.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-25-IMPORT
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/TEST-25-IMPORT/testsuite.sh b/test/units/testsuite-25.sh
index 6dcb780508..2558d5bf4c 100755
--- a/test/TEST-25-IMPORT/testsuite.sh
+++ b/test/units/testsuite-25.sh
@@ -133,6 +133,11 @@ rm -rf /var/tmp/extract
rm -rf /var/tmp/scratch
+# Test removal
+machinectl remove scratch5
+! test -f /var/lib/machines/scratch5
+! machinectl image-status scratch5
+
echo OK > /testok
exit 0
diff --git a/test/units/testsuite-26.service b/test/units/testsuite-26.service
new file mode 100644
index 0000000000..65b66835ed
--- /dev/null
+++ b/test/units/testsuite-26.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-26-SETENV
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/TEST-26-SETENV/testsuite.sh b/test/units/testsuite-26.sh
index 89c0937c8d..89c0937c8d 100755
--- a/test/TEST-26-SETENV/testsuite.sh
+++ b/test/units/testsuite-26.sh
diff --git a/test/units/testsuite-27.service b/test/units/testsuite-27.service
new file mode 100644
index 0000000000..52185f0572
--- /dev/null
+++ b/test/units/testsuite-27.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-27-STDOUTFILE
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/TEST-27-STDOUTFILE/testsuite.sh b/test/units/testsuite-27.sh
index c522f75dbc..9d92e6e574 100755
--- a/test/TEST-27-STDOUTFILE/testsuite.sh
+++ b/test/units/testsuite-27.sh
@@ -5,7 +5,7 @@ set -o pipefail
systemd-analyze log-level debug
systemd-analyze log-target console
-systemd-run --wait --unit=one \
+systemd-run --wait --unit=test27-one \
-p StandardOutput=file:/tmp/stdout \
-p StandardError=file:/tmp/stderr \
-p Type=exec \
@@ -17,7 +17,7 @@ cmp /tmp/stderr <<EOF
y
EOF
-systemd-run --wait --unit=two \
+systemd-run --wait --unit=test27-two \
-p StandardOutput=file:/tmp/stdout \
-p StandardError=file:/tmp/stderr \
-p Type=exec \
@@ -29,7 +29,7 @@ cmp /tmp/stderr <<EOF
a
EOF
-systemd-run --wait --unit=three \
+systemd-run --wait --unit=test27-three \
-p StandardOutput=append:/tmp/stdout \
-p StandardError=append:/tmp/stderr \
-p Type=exec \
@@ -45,6 +45,6 @@ EOF
systemd-analyze log-level info
-echo OK > /testok
+echo OK >/testok
exit 0
diff --git a/test/units/testsuite-28.service b/test/units/testsuite-28.service
new file mode 100644
index 0000000000..7ea8630011
--- /dev/null
+++ b/test/units/testsuite-28.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=TEST-28-PERCENTJ-WANTEDBY
+# Testsuite: Ensure %j Wants directives work
+Wants=specifier-j-wants.service
+After=specifier-j-wants.service
+Requires=testsuite-28-pre.service
+After=testsuite-28-pre.service
+
+[Service]
+ExecStart=true
+Type=oneshot
diff --git a/test/units/testsuite-29.service b/test/units/testsuite-29.service
new file mode 100644
index 0000000000..90c2187bd7
--- /dev/null
+++ b/test/units/testsuite-29.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-29-UDEV-ID_RENAMING
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/TEST-29-UDEV-ID_RENAMING/testsuite.sh b/test/units/testsuite-29.sh
index 5abdb53eb3..5abdb53eb3 100755
--- a/test/TEST-29-UDEV-ID_RENAMING/testsuite.sh
+++ b/test/units/testsuite-29.sh
diff --git a/test/units/testsuite-30.service b/test/units/testsuite-30.service
new file mode 100644
index 0000000000..eb342f3d17
--- /dev/null
+++ b/test/units/testsuite-30.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-30-ONCLOCKCHANGE
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/TEST-30-ONCLOCKCHANGE/testsuite.sh b/test/units/testsuite-30.sh
index a507ffcd7b..a507ffcd7b 100755
--- a/test/TEST-30-ONCLOCKCHANGE/testsuite.sh
+++ b/test/units/testsuite-30.sh
diff --git a/test/units/testsuite-31.service b/test/units/testsuite-31.service
new file mode 100644
index 0000000000..07dfb0bb54
--- /dev/null
+++ b/test/units/testsuite-31.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-31-DEVICE-ENUMERATION
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/TEST-31-DEVICE-ENUMERATION/testsuite.sh b/test/units/testsuite-31.sh
index fcff82d804..fcff82d804 100755
--- a/test/TEST-31-DEVICE-ENUMERATION/testsuite.sh
+++ b/test/units/testsuite-31.sh
diff --git a/test/units/testsuite-32.service b/test/units/testsuite-32.service
new file mode 100644
index 0000000000..aab95cb741
--- /dev/null
+++ b/test/units/testsuite-32.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=TEST-32-OOMPOLICY
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
+MemoryAccounting=yes
diff --git a/test/TEST-32-OOMPOLICY/testsuite.sh b/test/units/testsuite-32.sh
index aafafc1183..6b899652e2 100755
--- a/test/TEST-32-OOMPOLICY/testsuite.sh
+++ b/test/units/testsuite-32.sh
@@ -8,17 +8,19 @@ set -o pipefail
# an easier thing to test for, and also: let's not get confused by older
# kernels where the concept was still new.
-if test -f /sys/fs/cgroup/system.slice/testsuite.service/memory.oom.group ; then
+if test -f /sys/fs/cgroup/system.slice/testsuite-32.service/memory.oom.group; then
systemd-analyze log-level debug
systemd-analyze log-target console
# Run a service that is guaranteed to be the first candidate for OOM killing
- systemd-run --unit=oomtest.service -p Type=exec -p OOMScoreAdjust=1000 -p OOMPolicy=stop -p MemoryAccounting=yes /bin/sleep infinity
+ systemd-run --unit=oomtest.service \
+ -p Type=exec -p OOMScoreAdjust=1000 -p OOMPolicy=stop -p MemoryAccounting=yes \
+ sleep infinity
# Trigger an OOM killer run
- echo 1 > /proc/sys/kernel/sysrq
- echo f > /proc/sysrq-trigger
+ echo 1 >/proc/sys/kernel/sysrq
+ echo f >/proc/sysrq-trigger
while : ; do
STATE=`systemctl show -p ActiveState --value oomtest.service`
@@ -32,6 +34,6 @@ if test -f /sys/fs/cgroup/system.slice/testsuite.service/memory.oom.group ; then
systemd-analyze log-level info
fi
-echo OK > /testok
+echo OK >/testok
exit 0
diff --git a/test/units/testsuite-33.service b/test/units/testsuite-33.service
new file mode 100644
index 0000000000..b64f1e0b79
--- /dev/null
+++ b/test/units/testsuite-33.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-33-CLEAN-UNIT
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/TEST-33-CLEAN-UNIT/testsuite.sh b/test/units/testsuite-33.sh
index 0a6ee57b99..0a6ee57b99 100755
--- a/test/TEST-33-CLEAN-UNIT/testsuite.sh
+++ b/test/units/testsuite-33.sh
diff --git a/test/units/testsuite-34.service b/test/units/testsuite-34.service
new file mode 100644
index 0000000000..361e328221
--- /dev/null
+++ b/test/units/testsuite-34.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-34-DYNAMICUSERMIGRATE
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/TEST-34-DYNAMICUSERMIGRATE/testsuite.sh b/test/units/testsuite-34.sh
index 6d9488688a..6d9488688a 100755
--- a/test/TEST-34-DYNAMICUSERMIGRATE/testsuite.sh
+++ b/test/units/testsuite-34.sh
diff --git a/test/units/testsuite-36.service b/test/units/testsuite-36.service
new file mode 100644
index 0000000000..a681153ee4
--- /dev/null
+++ b/test/units/testsuite-36.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-36-NUMAPOLICY
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/TEST-36-NUMAPOLICY/testsuite.sh b/test/units/testsuite-36.sh
index bd04bb2efe..d04751b3f0 100755
--- a/test/TEST-36-NUMAPOLICY/testsuite.sh
+++ b/test/units/testsuite-36.sh
@@ -22,7 +22,7 @@ journalLog='journal.log'
# Systemd config files
testUnit='numa-test.service'
-testUnitFile="/etc/systemd/system/$testUnit"
+testUnitFile="/run/systemd/system/$testUnit"
testUnitNUMAConf="$testUnitFile.d/numa.conf"
# Sleep constants (we should probably figure out something better but nothing comes to mind)
@@ -70,9 +70,9 @@ writePID1NUMAPolicy() {
}
writeTestUnit() {
+ mkdir -p $testUnitFile.d/
echo [Service] > $testUnitFile
echo ExecStart=/bin/sleep 3600 >> $testUnitFile
- mkdir -p $testUnitFile.d/
}
writeTestUnitNUMAPolicy() {
@@ -129,7 +129,7 @@ systemctlCheckNUMAProperties() {
writeTestUnit
# Create systemd config drop-in directory
-confDir="/etc/systemd/system.conf.d/"
+confDir="/run/systemd/system.conf.d/"
mkdir -p "$confDir"
if ! checkNUMA; then
diff --git a/test/units/testsuite-37.service b/test/units/testsuite-37.service
new file mode 100644
index 0000000000..d25c6d2cf9
--- /dev/null
+++ b/test/units/testsuite-37.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-37-RUNTIMEDIRECTORYPRESERVE
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/TEST-37-RUNTIMEDIRECTORYPRESERVE/testsuite.sh b/test/units/testsuite-37.sh
index 32a9dd8694..32a9dd8694 100755
--- a/test/TEST-37-RUNTIMEDIRECTORYPRESERVE/testsuite.sh
+++ b/test/units/testsuite-37.sh
diff --git a/test/units/testsuite-39.service b/test/units/testsuite-39.service
new file mode 100644
index 0000000000..395fe803e7
--- /dev/null
+++ b/test/units/testsuite-39.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-39-EXECRELOAD
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/TEST-39-EXECRELOAD/testsuite.sh b/test/units/testsuite-39.sh
index eb7363fa6a..eb7363fa6a 100644..100755
--- a/test/TEST-39-EXECRELOAD/testsuite.sh
+++ b/test/units/testsuite-39.sh
diff --git a/test/units/testsuite-40.service b/test/units/testsuite-40.service
new file mode 100644
index 0000000000..38b0bd80d1
--- /dev/null
+++ b/test/units/testsuite-40.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-40-EXEC-COMMAND-EX
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/TEST-40-EXEC-COMMAND-EX/testsuite.sh b/test/units/testsuite-40.sh
index 957d22031a..957d22031a 100755
--- a/test/TEST-40-EXEC-COMMAND-EX/testsuite.sh
+++ b/test/units/testsuite-40.sh
diff --git a/test/units/testsuite-41.service b/test/units/testsuite-41.service
new file mode 100644
index 0000000000..766cb4c99a
--- /dev/null
+++ b/test/units/testsuite-41.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-41-ONESHOT-RESTART
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/TEST-41-ONESHOT-RESTART/testsuite.sh b/test/units/testsuite-41.sh
index 905f32e994..e3c5f1dad6 100755
--- a/test/TEST-41-ONESHOT-RESTART/testsuite.sh
+++ b/test/units/testsuite-41.sh
@@ -19,9 +19,9 @@ if [[ "$(systemctl show one.service -p NRestarts --value)" -le 0 ]]; then
exit 1
fi
-TMP_FILE="/test-41-oneshot-restart-test"
+TMP_FILE="/tmp/test-41-oneshot-restart-test"
-touch $TMP_FILE
+: >$TMP_FILE
# test two: make sure StartLimitBurst correctly limits the number of restarts
# and restarts execution of the unit from the first ExecStart=
diff --git a/test/units/testsuite-42.service b/test/units/testsuite-42.service
new file mode 100644
index 0000000000..a5504b515d
--- /dev/null
+++ b/test/units/testsuite-42.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=TEST-42-EXECSTOPPOST
+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
diff --git a/test/TEST-42-EXECSTOPPOST/testsuite.sh b/test/units/testsuite-42.sh
index 154398dd66..154398dd66 100755
--- a/test/TEST-42-EXECSTOPPOST/testsuite.sh
+++ b/test/units/testsuite-42.sh
diff --git a/test/units/testsuite-43.service b/test/units/testsuite-43.service
new file mode 100644
index 0000000000..31248f17e8
--- /dev/null
+++ b/test/units/testsuite-43.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=TEST-43-PRIVATEUSER-UNPRIV
+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
diff --git a/test/TEST-43-PRIVATEUSER-UNPRIV/testsuite.sh b/test/units/testsuite-43.sh
index ff94ad4d81..ff94ad4d81 100755
--- a/test/TEST-43-PRIVATEUSER-UNPRIV/testsuite.sh
+++ b/test/units/testsuite-43.sh
diff --git a/test/units/testsuite-44.service b/test/units/testsuite-44.service
new file mode 100644
index 0000000000..bd4dd728aa
--- /dev/null
+++ b/test/units/testsuite-44.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=TESTSUITE-44-LOG-NAMESPACE
+Before=getty-pre.target
+Wants=getty-pre.target
+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
diff --git a/test/TEST-44-LOG-NAMESPACE/testsuite.sh b/test/units/testsuite-44.sh
index 97541634d0..97541634d0 100755
--- a/test/TEST-44-LOG-NAMESPACE/testsuite.sh
+++ b/test/units/testsuite-44.sh
diff --git a/test/units/testsuite-46.service b/test/units/testsuite-46.service
new file mode 100644
index 0000000000..da359cbb23
--- /dev/null
+++ b/test/units/testsuite-46.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=TEST-46-HOMED
+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
diff --git a/test/TEST-46-HOMED/testsuite.sh b/test/units/testsuite-46.sh
index 9ef9f30f1e..9ef9f30f1e 100755
--- a/test/TEST-46-HOMED/testsuite.sh
+++ b/test/units/testsuite-46.sh
diff --git a/test/units/testsuite-47-repro.service b/test/units/testsuite-47-repro.service
new file mode 100644
index 0000000000..655eea68e5
--- /dev/null
+++ b/test/units/testsuite-47-repro.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=Issue 14566 Repro
+
+[Service]
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+ExecStopPost=/bin/true
+KillMode=mixed
diff --git a/test/TEST-47-ISSUE-14566/repro.sh b/test/units/testsuite-47-repro.sh
index 5217602257..8c34289c52 100755
--- a/test/TEST-47-ISSUE-14566/repro.sh
+++ b/test/units/testsuite-47-repro.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
sleep infinity &
echo $! > /leakedtestpid
diff --git a/test/units/testsuite-47.service b/test/units/testsuite-47.service
new file mode 100644
index 0000000000..3816c57eed
--- /dev/null
+++ b/test/units/testsuite-47.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-47-ISSUE-14566
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/TEST-47-ISSUE-14566/testsuite.sh b/test/units/testsuite-47.sh
index a0ba32530e..09be780a68 100755
--- a/test/TEST-47-ISSUE-14566/testsuite.sh
+++ b/test/units/testsuite-47.sh
@@ -1,17 +1,17 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -ex
set -o pipefail
systemd-analyze log-level debug
systemd-analyze log-target console
-systemctl start issue_14566_test
+systemctl start testsuite-47-repro
sleep 1
-systemctl status issue_14566_test
+systemctl status testsuite-47-repro
leaked_pid=$(cat /leakedtestpid)
-systemctl stop issue_14566_test
+systemctl stop testsuite-47-repro
# Leaked PID will still be around if we're buggy.
# I personally prefer to see 42.
diff --git a/test/testsuite.target b/test/units/testsuite.target
index 1a7e5b371a..1a7e5b371a 100644
--- a/test/testsuite.target
+++ b/test/units/testsuite.target
diff --git a/test/units/timers.target b/test/units/timers.target
new file mode 100644
index 0000000000..b1aa8c797c
--- /dev/null
+++ b/test/units/timers.target
@@ -0,0 +1,15 @@
+# SPDX-License-Identifier: LGPL-2.1+
+#
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Timers
+Documentation=man:systemd.special(7)
+
+DefaultDependencies=no
+Conflicts=shutdown.target
diff --git a/test/unit-.service.d/10-override.conf b/test/units/unit-.service.d/10-override.conf
index 916737d415..916737d415 100644
--- a/test/unit-.service.d/10-override.conf
+++ b/test/units/unit-.service.d/10-override.conf
diff --git a/test/unit-with-.service.d/20-override.conf b/test/units/unit-with-.service.d/20-override.conf
index c6c2438f73..c6c2438f73 100644
--- a/test/unit-with-.service.d/20-override.conf
+++ b/test/units/unit-with-.service.d/20-override.conf
diff --git a/test/unit-with-multiple-.service.d/20-override.conf b/test/units/unit-with-multiple-.service.d/20-override.conf
index 62fafd2e3b..62fafd2e3b 100644
--- a/test/unit-with-multiple-.service.d/20-override.conf
+++ b/test/units/unit-with-multiple-.service.d/20-override.conf
diff --git a/test/unit-with-multiple-.service.d/30-override.conf b/test/units/unit-with-multiple-.service.d/30-override.conf
index b9616da8a8..b9616da8a8 100644
--- a/test/unit-with-multiple-.service.d/30-override.conf
+++ b/test/units/unit-with-multiple-.service.d/30-override.conf
diff --git a/test/unit-with-multiple-dashes.service b/test/units/unit-with-multiple-dashes.service
index b38b3604b8..b38b3604b8 100644
--- a/test/unit-with-multiple-dashes.service
+++ b/test/units/unit-with-multiple-dashes.service
diff --git a/test/unit-with-multiple-dashes.service.d/10-override.conf b/test/units/unit-with-multiple-dashes.service.d/10-override.conf
index 982c3621a6..982c3621a6 100644
--- a/test/unit-with-multiple-dashes.service.d/10-override.conf
+++ b/test/units/unit-with-multiple-dashes.service.d/10-override.conf
diff --git a/test/unstoppable.service b/test/units/unstoppable.service
index 56b72c98f7..56b72c98f7 100644
--- a/test/unstoppable.service
+++ b/test/units/unstoppable.service
diff --git a/tools/meson-make-symlink.sh b/tools/meson-make-symlink.sh
index da0d13a341..cdd5214125 100755
--- a/tools/meson-make-symlink.sh
+++ b/tools/meson-make-symlink.sh
@@ -5,8 +5,8 @@ set -eu
# and we need to create the target directory...
mkdir -vp "$(dirname "${DESTDIR:-}$2")"
-if [ "$(dirname $1)" = . ]; then
- ln -vfs -T "$1" "${DESTDIR:-}$2"
+if [ "$(dirname $1)" = . -o "$(dirname $1)" = .. ]; then
+ ln -vfs -T -- "$1" "${DESTDIR:-}$2"
else
- ln -vfs -T --relative "${DESTDIR:-}$1" "${DESTDIR:-}$2"
+ ln -vfs -T --relative -- "${DESTDIR:-}$1" "${DESTDIR:-}$2"
fi