summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-10-08 09:10:12 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-10-08 09:10:12 +0200
commit51fa85913c4d1826414c6fa5a2e235f65425d91a (patch)
tree4efa7c9426038c38d1eba8e34d56c0619c7a6cdd
parent0f714a34c4a1149e2d368c4cc359a50f19b7cd9e (diff)
downloadsystemd-51fa85913c4d1826414c6fa5a2e235f65425d91a.tar.gz
systemd-51fa85913c4d1826414c6fa5a2e235f65425d91a.tar.bz2
systemd-51fa85913c4d1826414c6fa5a2e235f65425d91a.zip
test: add function to reduce copied setup boilerplate
Many tests were also masking systemd-machined.service. But machined should only start when activated, so having it not masked shouldn't be noticable. TEST-25-IMPORT needs it.
-rwxr-xr-xtest/TEST-02-CRYPTSETUP/test.sh9
-rwxr-xr-xtest/TEST-03-JOBS/test.sh9
-rwxr-xr-xtest/TEST-04-JOURNAL/test.sh9
-rwxr-xr-xtest/TEST-05-RLIMITS/test.sh9
-rwxr-xr-xtest/TEST-06-SELINUX/test.sh8
-rwxr-xr-xtest/TEST-07-ISSUE-1981/test.sh9
-rwxr-xr-xtest/TEST-08-ISSUE-2730/test.sh7
-rwxr-xr-xtest/TEST-09-ISSUE-2691/test.sh8
-rwxr-xr-xtest/TEST-10-ISSUE-2467/test.sh8
-rwxr-xr-xtest/TEST-11-ISSUE-3166/test.sh9
-rwxr-xr-xtest/TEST-12-ISSUE-3171/test.sh9
-rwxr-xr-xtest/TEST-13-NSPAWN-SMOKE/test.sh9
-rwxr-xr-xtest/TEST-14-MACHINE-ID/test.sh8
-rwxr-xr-xtest/TEST-15-DROPIN/test.sh8
-rwxr-xr-xtest/TEST-16-EXTEND-TIMEOUT/test.sh7
-rwxr-xr-xtest/TEST-17-UDEV-WANTS/test.sh8
-rwxr-xr-xtest/TEST-18-FAILUREACTION/test.sh9
-rwxr-xr-xtest/TEST-19-DELEGATE/test.sh9
-rwxr-xr-xtest/TEST-20-MAINPIDGAMES/test.sh10
-rwxr-xr-xtest/TEST-22-TMPFILES/test.sh9
-rwxr-xr-xtest/TEST-23-TYPE-EXEC/test.sh9
-rwxr-xr-xtest/TEST-27-STDOUTFILE/test.sh12
-rwxr-xr-xtest/TEST-28-PERCENTJ-WANTEDBY/test.sh9
-rwxr-xr-xtest/TEST-29-UDEV-ID_RENAMING/test.sh8
-rwxr-xr-xtest/TEST-30-ONCLOCKCHANGE/test.sh9
-rwxr-xr-xtest/TEST-31-DEVICE-ENUMERATION/test.sh8
-rwxr-xr-xtest/TEST-32-OOMPOLICY/test.sh9
-rwxr-xr-xtest/TEST-33-CLEAN-UNIT/test.sh9
-rwxr-xr-xtest/TEST-34-DYNAMICUSERMIGRATE/test.sh9
-rwxr-xr-xtest/TEST-36-NUMAPOLICY/test.sh9
-rwxr-xr-xtest/TEST-37-RUNTIMEDIRECTORYPRESERVE/test.sh9
-rwxr-xr-xtest/TEST-39-EXECRELOAD/test.sh9
-rwxr-xr-xtest/TEST-40-EXEC-COMMAND-EX/test.sh9
-rw-r--r--test/test-functions9
34 files changed, 46 insertions, 252 deletions
diff --git a/test/TEST-02-CRYPTSETUP/test.sh b/test/TEST-02-CRYPTSETUP/test.sh
index 801dc71569..a7563f4462 100755
--- a/test/TEST-02-CRYPTSETUP/test.sh
+++ b/test/TEST-02-CRYPTSETUP/test.sh
@@ -40,14 +40,7 @@ test_setup() {
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
setup_basic_environment
-
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
+ mask_supporting_services
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
diff --git a/test/TEST-03-JOBS/test.sh b/test/TEST-03-JOBS/test.sh
index 3359ee6840..50b7bce3ed 100755
--- a/test/TEST-03-JOBS/test.sh
+++ b/test/TEST-03-JOBS/test.sh
@@ -14,14 +14,7 @@ test_setup() {
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
setup_basic_environment
-
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
+ mask_supporting_services
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
diff --git a/test/TEST-04-JOURNAL/test.sh b/test/TEST-04-JOURNAL/test.sh
index cabc71f4ff..a18d21533e 100755
--- a/test/TEST-04-JOURNAL/test.sh
+++ b/test/TEST-04-JOURNAL/test.sh
@@ -13,14 +13,7 @@ test_setup() {
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
setup_basic_environment
-
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
+ mask_supporting_services
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
diff --git a/test/TEST-05-RLIMITS/test.sh b/test/TEST-05-RLIMITS/test.sh
index 159c1e0ea8..87fb89e781 100755
--- a/test/TEST-05-RLIMITS/test.sh
+++ b/test/TEST-05-RLIMITS/test.sh
@@ -13,14 +13,7 @@ test_setup() {
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
setup_basic_environment
-
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
+ mask_supporting_services
cat >$initdir/etc/systemd/system.conf <<EOF
[Manager]
diff --git a/test/TEST-06-SELINUX/test.sh b/test/TEST-06-SELINUX/test.sh
index 2e983f7879..646dfe024a 100755
--- a/test/TEST-06-SELINUX/test.sh
+++ b/test/TEST-06-SELINUX/test.sh
@@ -24,6 +24,7 @@ test_setup() {
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
@@ -91,13 +92,6 @@ EOF
dracut_install runcon
dracut_install checkmodule semodule semodule_package m4 make /usr/libexec/selinux/hll/pp load_policy sefcontext_compile
)
-
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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 "$@"
diff --git a/test/TEST-07-ISSUE-1981/test.sh b/test/TEST-07-ISSUE-1981/test.sh
index 2e4f67c5fe..199b4f85a8 100755
--- a/test/TEST-07-ISSUE-1981/test.sh
+++ b/test/TEST-07-ISSUE-1981/test.sh
@@ -16,14 +16,7 @@ test_setup() {
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
setup_basic_environment
-
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
+ mask_supporting_services
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
diff --git a/test/TEST-08-ISSUE-2730/test.sh b/test/TEST-08-ISSUE-2730/test.sh
index 8643842e81..a9e6ffa79d 100755
--- a/test/TEST-08-ISSUE-2730/test.sh
+++ b/test/TEST-08-ISSUE-2730/test.sh
@@ -64,12 +64,7 @@ EOF
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 some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
+ mask_supporting_services
}
do_test "$@"
diff --git a/test/TEST-09-ISSUE-2691/test.sh b/test/TEST-09-ISSUE-2691/test.sh
index 1a8b900672..ca3e69d2ca 100755
--- a/test/TEST-09-ISSUE-2691/test.sh
+++ b/test/TEST-09-ISSUE-2691/test.sh
@@ -15,6 +15,7 @@ test_setup() {
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'
@@ -31,13 +32,6 @@ EOF
setup_testsuite
)
-
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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 "$@"
diff --git a/test/TEST-10-ISSUE-2467/test.sh b/test/TEST-10-ISSUE-2467/test.sh
index 80b2fd923f..7bb2569630 100755
--- a/test/TEST-10-ISSUE-2467/test.sh
+++ b/test/TEST-10-ISSUE-2467/test.sh
@@ -13,6 +13,7 @@ test_setup() {
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
setup_basic_environment
+ mask_supporting_services
dracut_install true rm socat
# setup the testsuite service
@@ -42,13 +43,6 @@ EOF
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-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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 "$@"
diff --git a/test/TEST-11-ISSUE-3166/test.sh b/test/TEST-11-ISSUE-3166/test.sh
index c50efb8c9b..81c12a2783 100755
--- a/test/TEST-11-ISSUE-3166/test.sh
+++ b/test/TEST-11-ISSUE-3166/test.sh
@@ -14,16 +14,9 @@ test_setup() {
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
setup_basic_environment
+ mask_supporting_services
dracut_install false touch
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
-
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
[Unit]
diff --git a/test/TEST-12-ISSUE-3171/test.sh b/test/TEST-12-ISSUE-3171/test.sh
index 5b1c3aa313..d9a0e1a3dd 100755
--- a/test/TEST-12-ISSUE-3171/test.sh
+++ b/test/TEST-12-ISSUE-3171/test.sh
@@ -14,16 +14,9 @@ test_setup() {
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
setup_basic_environment
+ mask_supporting_services
dracut_install cat mv stat nc
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
-
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
[Unit]
diff --git a/test/TEST-13-NSPAWN-SMOKE/test.sh b/test/TEST-13-NSPAWN-SMOKE/test.sh
index 4f14bf12e3..747d30d952 100755
--- a/test/TEST-13-NSPAWN-SMOKE/test.sh
+++ b/test/TEST-13-NSPAWN-SMOKE/test.sh
@@ -14,16 +14,9 @@ test_setup() {
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
setup_basic_environment
+ mask_supporting_services
dracut_install busybox chmod rmdir unshare ip sysctl
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
-
cp create-busybox-container $initdir/
./create-busybox-container $initdir/nc-container
diff --git a/test/TEST-14-MACHINE-ID/test.sh b/test/TEST-14-MACHINE-ID/test.sh
index e52377c79d..72d7eacbf6 100755
--- a/test/TEST-14-MACHINE-ID/test.sh
+++ b/test/TEST-14-MACHINE-ID/test.sh
@@ -14,6 +14,7 @@ test_setup() {
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
@@ -72,13 +73,6 @@ chmod +x $initdir/test-machine-id-setup.sh
setup_testsuite
)
-
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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 "$@"
diff --git a/test/TEST-15-DROPIN/test.sh b/test/TEST-15-DROPIN/test.sh
index 9d5ea138b9..a1d0c618d9 100755
--- a/test/TEST-15-DROPIN/test.sh
+++ b/test/TEST-15-DROPIN/test.sh
@@ -8,13 +8,7 @@ TEST_NO_QEMU=1
test_setup() {
# create the basic filesystem layout
setup_basic_environment
-
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
+ mask_supporting_services
# import the test scripts in the rootfs and plug them in systemd
cp testsuite.service $initdir/etc/systemd/system/
diff --git a/test/TEST-16-EXTEND-TIMEOUT/test.sh b/test/TEST-16-EXTEND-TIMEOUT/test.sh
index 368c9e63ca..c5f8af6ec6 100755
--- a/test/TEST-16-EXTEND-TIMEOUT/test.sh
+++ b/test/TEST-16-EXTEND-TIMEOUT/test.sh
@@ -14,6 +14,7 @@ test_setup() {
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
@@ -27,12 +28,6 @@ test_setup() {
setup_testsuite
)
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
setup_nspawn_root
}
diff --git a/test/TEST-17-UDEV-WANTS/test.sh b/test/TEST-17-UDEV-WANTS/test.sh
index 36032348b8..1cdbbd2d8a 100755
--- a/test/TEST-17-UDEV-WANTS/test.sh
+++ b/test/TEST-17-UDEV-WANTS/test.sh
@@ -14,13 +14,7 @@ test_setup() {
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
setup_basic_environment
-
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
+ mask_supporting_services
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
diff --git a/test/TEST-18-FAILUREACTION/test.sh b/test/TEST-18-FAILUREACTION/test.sh
index 18b0be82e8..e9f6ee7afe 100755
--- a/test/TEST-18-FAILUREACTION/test.sh
+++ b/test/TEST-18-FAILUREACTION/test.sh
@@ -13,6 +13,7 @@ test_setup() {
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
@@ -27,14 +28,8 @@ EOF
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-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
+ setup_nspawn_root
}
do_test "$@"
diff --git a/test/TEST-19-DELEGATE/test.sh b/test/TEST-19-DELEGATE/test.sh
index bdd6562a33..706f0e9fbb 100755
--- a/test/TEST-19-DELEGATE/test.sh
+++ b/test/TEST-19-DELEGATE/test.sh
@@ -15,14 +15,7 @@ test_setup() {
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
setup_basic_environment
-
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
+ mask_supporting_services
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
diff --git a/test/TEST-20-MAINPIDGAMES/test.sh b/test/TEST-20-MAINPIDGAMES/test.sh
index 0f6aef7453..0ba30bdb00 100755
--- a/test/TEST-20-MAINPIDGAMES/test.sh
+++ b/test/TEST-20-MAINPIDGAMES/test.sh
@@ -12,14 +12,7 @@ test_setup() {
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
setup_basic_environment
-
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
+ mask_supporting_services
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
@@ -35,6 +28,7 @@ EOF
setup_testsuite
)
+
setup_nspawn_root
}
diff --git a/test/TEST-22-TMPFILES/test.sh b/test/TEST-22-TMPFILES/test.sh
index 5c509f63fb..32c3abdeab 100755
--- a/test/TEST-22-TMPFILES/test.sh
+++ b/test/TEST-22-TMPFILES/test.sh
@@ -8,6 +8,7 @@ TEST_NO_QEMU=1
test_setup() {
# create the basic filesystem layout
setup_basic_environment
+ mask_supporting_services
inst_binary mv
inst_binary stat
inst_binary seq
@@ -15,14 +16,6 @@ test_setup() {
inst_binary mkfifo
inst_binary readlink
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
-
# setup the testsuite service
cp testsuite.service $initdir/etc/systemd/system/
setup_testsuite
diff --git a/test/TEST-23-TYPE-EXEC/test.sh b/test/TEST-23-TYPE-EXEC/test.sh
index 2b10b9ad70..127d39319a 100755
--- a/test/TEST-23-TYPE-EXEC/test.sh
+++ b/test/TEST-23-TYPE-EXEC/test.sh
@@ -12,14 +12,7 @@ test_setup() {
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
setup_basic_environment
-
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
+ mask_supporting_services
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
diff --git a/test/TEST-27-STDOUTFILE/test.sh b/test/TEST-27-STDOUTFILE/test.sh
index a796dcd79e..c8338736bb 100755
--- a/test/TEST-27-STDOUTFILE/test.sh
+++ b/test/TEST-27-STDOUTFILE/test.sh
@@ -11,17 +11,9 @@ test_setup() {
LOG_LEVEL=5
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
- inst_binary cmp
-
setup_basic_environment
-
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
+ mask_supporting_services
+ inst_binary cmp
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
diff --git a/test/TEST-28-PERCENTJ-WANTEDBY/test.sh b/test/TEST-28-PERCENTJ-WANTEDBY/test.sh
index 1fb9825bf8..3427ba7a91 100755
--- a/test/TEST-28-PERCENTJ-WANTEDBY/test.sh
+++ b/test/TEST-28-PERCENTJ-WANTEDBY/test.sh
@@ -14,6 +14,7 @@ test_setup() {
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
@@ -48,14 +49,8 @@ EOF
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-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
+ setup_nspawn_root
}
do_test "$@"
diff --git a/test/TEST-29-UDEV-ID_RENAMING/test.sh b/test/TEST-29-UDEV-ID_RENAMING/test.sh
index 2a483bbc3d..7d173c8422 100755
--- a/test/TEST-29-UDEV-ID_RENAMING/test.sh
+++ b/test/TEST-29-UDEV-ID_RENAMING/test.sh
@@ -14,13 +14,7 @@ test_setup() {
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
setup_basic_environment
-
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
+ mask_supporting_services
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
diff --git a/test/TEST-30-ONCLOCKCHANGE/test.sh b/test/TEST-30-ONCLOCKCHANGE/test.sh
index 67e074af4c..8976e95308 100755
--- a/test/TEST-30-ONCLOCKCHANGE/test.sh
+++ b/test/TEST-30-ONCLOCKCHANGE/test.sh
@@ -16,14 +16,7 @@ test_setup() {
inst_any /usr/share/zoneinfo/Europe/Berlin
setup_basic_environment
-
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
+ mask_supporting_services
# extend the watchdog
mkdir -p $initdir/etc/systemd/system/systemd-timedated.service.d
diff --git a/test/TEST-31-DEVICE-ENUMERATION/test.sh b/test/TEST-31-DEVICE-ENUMERATION/test.sh
index 855ec42266..e88e0c367a 100755
--- a/test/TEST-31-DEVICE-ENUMERATION/test.sh
+++ b/test/TEST-31-DEVICE-ENUMERATION/test.sh
@@ -14,13 +14,7 @@ test_setup() {
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
setup_basic_environment
-
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
+ mask_supporting_services
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
diff --git a/test/TEST-32-OOMPOLICY/test.sh b/test/TEST-32-OOMPOLICY/test.sh
index 4578916762..1726b21fc3 100755
--- a/test/TEST-32-OOMPOLICY/test.sh
+++ b/test/TEST-32-OOMPOLICY/test.sh
@@ -15,14 +15,7 @@ test_setup() {
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
setup_basic_environment
-
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
+ mask_supporting_services
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
diff --git a/test/TEST-33-CLEAN-UNIT/test.sh b/test/TEST-33-CLEAN-UNIT/test.sh
index 90dd495c0a..b3316bdc26 100755
--- a/test/TEST-33-CLEAN-UNIT/test.sh
+++ b/test/TEST-33-CLEAN-UNIT/test.sh
@@ -14,14 +14,7 @@ test_setup() {
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
setup_basic_environment
-
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
+ mask_supporting_services
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
diff --git a/test/TEST-34-DYNAMICUSERMIGRATE/test.sh b/test/TEST-34-DYNAMICUSERMIGRATE/test.sh
index 0bff59fcb7..c7c1b29d86 100755
--- a/test/TEST-34-DYNAMICUSERMIGRATE/test.sh
+++ b/test/TEST-34-DYNAMICUSERMIGRATE/test.sh
@@ -12,14 +12,7 @@ test_setup() {
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
setup_basic_environment
-
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
+ mask_supporting_services
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
diff --git a/test/TEST-36-NUMAPOLICY/test.sh b/test/TEST-36-NUMAPOLICY/test.sh
index 14cbe5f386..e4c0e45ebe 100755
--- a/test/TEST-36-NUMAPOLICY/test.sh
+++ b/test/TEST-36-NUMAPOLICY/test.sh
@@ -15,16 +15,9 @@ test_setup() {
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
setup_basic_environment
+ mask_supporting_services
dracut_install mktemp
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
-
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
[Unit]
diff --git a/test/TEST-37-RUNTIMEDIRECTORYPRESERVE/test.sh b/test/TEST-37-RUNTIMEDIRECTORYPRESERVE/test.sh
index b7a3ab8ce4..ffe0ee9499 100755
--- a/test/TEST-37-RUNTIMEDIRECTORYPRESERVE/test.sh
+++ b/test/TEST-37-RUNTIMEDIRECTORYPRESERVE/test.sh
@@ -14,14 +14,7 @@ test_setup() {
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
setup_basic_environment
-
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
+ mask_supporting_services
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
diff --git a/test/TEST-39-EXECRELOAD/test.sh b/test/TEST-39-EXECRELOAD/test.sh
index e6bb7baedf..d2b1663aa3 100755
--- a/test/TEST-39-EXECRELOAD/test.sh
+++ b/test/TEST-39-EXECRELOAD/test.sh
@@ -13,16 +13,9 @@ test_setup() {
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
setup_basic_environment
+ mask_supporting_services
dracut_install mktemp
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
-
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
[Unit]
diff --git a/test/TEST-40-EXEC-COMMAND-EX/test.sh b/test/TEST-40-EXEC-COMMAND-EX/test.sh
index 4e73fbaee9..01d725eb5e 100755
--- a/test/TEST-40-EXEC-COMMAND-EX/test.sh
+++ b/test/TEST-40-EXEC-COMMAND-EX/test.sh
@@ -12,14 +12,7 @@ test_setup() {
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
setup_basic_environment
-
- # mask some services that we do not want to run in these tests
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
- 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
- ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
+ mask_supporting_services
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
diff --git a/test/test-functions b/test/test-functions
index 359fd4026e..3afc324110 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -913,6 +913,15 @@ setup_basic_dirs() {
ln -sfn /run/lock "$initdir/var/lock"
}
+mask_supporting_services() {
+ # mask some services that we do not want to run in these tests
+ ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
+ ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
+ 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
+}
+
inst_libs() {
local _bin=$1
local _so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'