From: Zbigniew Jędrzejewski-Szmek Date: Tue, 8 Oct 2019 07:10:12 +0000 (+0200) Subject: test: add function to reduce copied setup boilerplate X-Git-Tag: v244-rc1~211^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=51fa85913c4d1826414c6fa5a2e235f65425d91a;p=thirdparty%2Fsystemd.git 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. --- diff --git a/test/TEST-02-CRYPTSETUP/test.sh b/test/TEST-02-CRYPTSETUP/test.sh index 801dc715691..a7563f44620 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 <$initdir/etc/systemd/system/testsuite.service <$initdir/etc/systemd/system/testsuite.service <$initdir/etc/systemd/system.conf <$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 2e4f67c5fe5..199b4f85a88 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 <$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 80b2fd923f9..7bb25696300 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 c50efb8c9b1..81c12a2783c 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 <$initdir/etc/systemd/system/testsuite.service <$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 9d5ea138b90..a1d0c618d95 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 368c9e63ca3..c5f8af6ec61 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 36032348b89..1cdbbd2d8a0 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 <$initdir/etc/systemd/system/testsuite.service <$initdir/etc/systemd/system/testsuite.service <$initdir/etc/systemd/system/testsuite.service <$initdir/etc/systemd/system/testsuite.service <$initdir/etc/systemd/system/testsuite.service <$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 2a483bbc3dd..7d173c8422a 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 <$initdir/etc/systemd/system/testsuite.service <$initdir/etc/systemd/system/testsuite.service <$initdir/etc/systemd/system/testsuite.service <$initdir/etc/systemd/system/testsuite.service <$initdir/etc/systemd/system/testsuite.service <$initdir/etc/systemd/system/testsuite.service <$initdir/etc/systemd/system/testsuite.service <$initdir/etc/systemd/system/testsuite.service <