From 0f714a34c4a1149e2d368c4cc359a50f19b7cd9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 8 Oct 2019 08:45:12 +0200 Subject: [PATCH 1/3] test: drop redirection to tty in integration tests I *think* this was originally added to make it easier to see what was happening in tests. Later we added the functionality to print the journal on failure, so this redirection has stopped being useful. In https://github.com/systemd/systemd/pull/13719#issuecomment-539292650 @filbranden shows that grep tries to write to stdout and fails. In general, we should not assume that writing to the console it always possible. We have special code to handle this in pid1 after all: 99 19:22:10.731965 fstat(1, 99 19:22:10.731993 <... fstat resumed>{st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0), ...}) = 0 99 19:22:10.732070 write(1, "ExecStartPost={ path=/bin/echo ; argv[]=/bin/echo ${4_four_ex} ; ignore_errors=no ; start_time=[Mon 2019-10-07 19:22:10 PDT] ; stop_time=[Mon 209-10-07 19:22:10 PDT] ; pid=97 ; code=exited ; status=0 }\n", 203) = -1 EIO (Input/output error) 99 19:22:10.732174 write(2, "grep: ", 6) = -1 EIO (Input/output error) 99 19:22:10.732226 write(2, "write error", 11) = -1 EIO (Input/output error) 99 19:22:10.732263 write(2, ": Input/output error", 20) = -1 EIO (Input/output error) 99 19:22:10.732298 write(2, "\n", 1 99 19:22:10.732325 <... write resumed>) = -1 EIO (Input/output error) 99 19:22:10.732349 exit_group(2) = ? 99 19:22:10.732424 +++ exited with 2 +++ Removing the redirection should make the tests less flakey. Replaces #13719. While at it, also drop NotifyAccess=all. I think it was added purposefully in TEST-20-MAINPIDGAMES, and then cargo culted to newer tests. --- test/TEST-03-JOBS/test.sh | 2 -- test/TEST-10-ISSUE-2467/test.sh | 2 -- test/TEST-13-NSPAWN-SMOKE/test.sh | 2 -- test/TEST-17-UDEV-WANTS/test.sh | 2 -- test/TEST-18-FAILUREACTION/test.sh | 2 -- test/TEST-19-DELEGATE/test.sh | 2 -- test/TEST-20-MAINPIDGAMES/test.sh | 2 -- test/TEST-23-TYPE-EXEC/test.sh | 3 --- test/TEST-25-IMPORT/test.sh | 3 --- test/TEST-26-SETENV/test.sh | 3 --- test/TEST-27-STDOUTFILE/test.sh | 3 --- test/TEST-29-UDEV-ID_RENAMING/test.sh | 2 -- test/TEST-30-ONCLOCKCHANGE/test.sh | 3 --- test/TEST-31-DEVICE-ENUMERATION/test.sh | 2 -- test/TEST-32-OOMPOLICY/test.sh | 2 -- test/TEST-33-CLEAN-UNIT/test.sh | 2 -- test/TEST-34-DYNAMICUSERMIGRATE/test.sh | 3 --- test/TEST-36-NUMAPOLICY/test.sh | 3 --- test/TEST-37-RUNTIMEDIRECTORYPRESERVE/test.sh | 2 -- test/TEST-39-EXECRELOAD/test.sh | 3 --- test/TEST-40-EXEC-COMMAND-EX/test.sh | 3 --- 21 files changed, 51 deletions(-) diff --git a/test/TEST-03-JOBS/test.sh b/test/TEST-03-JOBS/test.sh index b815e7cb67..3359ee6840 100755 --- a/test/TEST-03-JOBS/test.sh +++ b/test/TEST-03-JOBS/test.sh @@ -32,8 +32,6 @@ After=multi-user.target [Service] ExecStart=/test-jobs.sh Type=oneshot -StandardOutput=tty -StandardError=tty EOF # copy the units used by this test diff --git a/test/TEST-10-ISSUE-2467/test.sh b/test/TEST-10-ISSUE-2467/test.sh index e0e78b1100..80b2fd923f 100755 --- a/test/TEST-10-ISSUE-2467/test.sh +++ b/test/TEST-10-ISSUE-2467/test.sh @@ -22,8 +22,6 @@ Description=Testsuite service [Service] Type=oneshot -StandardOutput=tty -StandardError=tty 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 diff --git a/test/TEST-13-NSPAWN-SMOKE/test.sh b/test/TEST-13-NSPAWN-SMOKE/test.sh index f89bdca99f..4f14bf12e3 100755 --- a/test/TEST-13-NSPAWN-SMOKE/test.sh +++ b/test/TEST-13-NSPAWN-SMOKE/test.sh @@ -37,8 +37,6 @@ Description=Testsuite service [Service] ExecStart=/test-nspawn.sh Type=oneshot -StandardOutput=tty -StandardError=tty EOF cat >$initdir/test-nspawn.sh <<'EOF' diff --git a/test/TEST-17-UDEV-WANTS/test.sh b/test/TEST-17-UDEV-WANTS/test.sh index 8727432e30..36032348b8 100755 --- a/test/TEST-17-UDEV-WANTS/test.sh +++ b/test/TEST-17-UDEV-WANTS/test.sh @@ -30,8 +30,6 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-18-FAILUREACTION/test.sh b/test/TEST-18-FAILUREACTION/test.sh index 503c5ca551..18b0be82e8 100755 --- a/test/TEST-18-FAILUREACTION/test.sh +++ b/test/TEST-18-FAILUREACTION/test.sh @@ -22,8 +22,6 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-19-DELEGATE/test.sh b/test/TEST-19-DELEGATE/test.sh index 348c697f63..bdd6562a33 100755 --- a/test/TEST-19-DELEGATE/test.sh +++ b/test/TEST-19-DELEGATE/test.sh @@ -32,8 +32,6 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-20-MAINPIDGAMES/test.sh b/test/TEST-20-MAINPIDGAMES/test.sh index 457ef6ae74..0f6aef7453 100755 --- a/test/TEST-20-MAINPIDGAMES/test.sh +++ b/test/TEST-20-MAINPIDGAMES/test.sh @@ -29,8 +29,6 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty NotifyAccess=all EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-23-TYPE-EXEC/test.sh b/test/TEST-23-TYPE-EXEC/test.sh index 9163f88c82..2b10b9ad70 100755 --- a/test/TEST-23-TYPE-EXEC/test.sh +++ b/test/TEST-23-TYPE-EXEC/test.sh @@ -29,9 +29,6 @@ Description=Testsuite service [Service] ExecStart=/testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty -NotifyAccess=all EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-25-IMPORT/test.sh b/test/TEST-25-IMPORT/test.sh index 026c38a264..c0f51f3b89 100755 --- a/test/TEST-25-IMPORT/test.sh +++ b/test/TEST-25-IMPORT/test.sh @@ -22,9 +22,6 @@ Description=Testsuite service [Service] ExecStart=/testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty -NotifyAccess=all EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-26-SETENV/test.sh b/test/TEST-26-SETENV/test.sh index fc216ee5bf..065a8e461c 100755 --- a/test/TEST-26-SETENV/test.sh +++ b/test/TEST-26-SETENV/test.sh @@ -21,9 +21,6 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty -NotifyAccess=all EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-27-STDOUTFILE/test.sh b/test/TEST-27-STDOUTFILE/test.sh index d481f1b8bf..a796dcd79e 100755 --- a/test/TEST-27-STDOUTFILE/test.sh +++ b/test/TEST-27-STDOUTFILE/test.sh @@ -31,9 +31,6 @@ Description=Testsuite service [Service] ExecStart=/testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty -NotifyAccess=all EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-29-UDEV-ID_RENAMING/test.sh b/test/TEST-29-UDEV-ID_RENAMING/test.sh index 67641746d8..2a483bbc3d 100755 --- a/test/TEST-29-UDEV-ID_RENAMING/test.sh +++ b/test/TEST-29-UDEV-ID_RENAMING/test.sh @@ -30,8 +30,6 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-30-ONCLOCKCHANGE/test.sh b/test/TEST-30-ONCLOCKCHANGE/test.sh index 98a9db8007..67e074af4c 100755 --- a/test/TEST-30-ONCLOCKCHANGE/test.sh +++ b/test/TEST-30-ONCLOCKCHANGE/test.sh @@ -40,9 +40,6 @@ Description=Testsuite service [Service] ExecStart=/testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty -NotifyAccess=all EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-31-DEVICE-ENUMERATION/test.sh b/test/TEST-31-DEVICE-ENUMERATION/test.sh index 064daf9235..855ec42266 100755 --- a/test/TEST-31-DEVICE-ENUMERATION/test.sh +++ b/test/TEST-31-DEVICE-ENUMERATION/test.sh @@ -30,8 +30,6 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-32-OOMPOLICY/test.sh b/test/TEST-32-OOMPOLICY/test.sh index 17610af21d..4578916762 100755 --- a/test/TEST-32-OOMPOLICY/test.sh +++ b/test/TEST-32-OOMPOLICY/test.sh @@ -32,8 +32,6 @@ Description=Testsuite service [Service] ExecStart=/testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty MemoryAccounting=yes EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-33-CLEAN-UNIT/test.sh b/test/TEST-33-CLEAN-UNIT/test.sh index aeda69baae..90dd495c0a 100755 --- a/test/TEST-33-CLEAN-UNIT/test.sh +++ b/test/TEST-33-CLEAN-UNIT/test.sh @@ -31,8 +31,6 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-34-DYNAMICUSERMIGRATE/test.sh b/test/TEST-34-DYNAMICUSERMIGRATE/test.sh index 7339d3b656..0bff59fcb7 100755 --- a/test/TEST-34-DYNAMICUSERMIGRATE/test.sh +++ b/test/TEST-34-DYNAMICUSERMIGRATE/test.sh @@ -29,9 +29,6 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty -NotifyAccess=all EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-36-NUMAPOLICY/test.sh b/test/TEST-36-NUMAPOLICY/test.sh index a586f9dc90..14cbe5f386 100755 --- a/test/TEST-36-NUMAPOLICY/test.sh +++ b/test/TEST-36-NUMAPOLICY/test.sh @@ -33,9 +33,6 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty -NotifyAccess=all EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-37-RUNTIMEDIRECTORYPRESERVE/test.sh b/test/TEST-37-RUNTIMEDIRECTORYPRESERVE/test.sh index 9e87e61dcd..b7a3ab8ce4 100755 --- a/test/TEST-37-RUNTIMEDIRECTORYPRESERVE/test.sh +++ b/test/TEST-37-RUNTIMEDIRECTORYPRESERVE/test.sh @@ -31,8 +31,6 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-39-EXECRELOAD/test.sh b/test/TEST-39-EXECRELOAD/test.sh index 7eb9db415a..e6bb7baedf 100755 --- a/test/TEST-39-EXECRELOAD/test.sh +++ b/test/TEST-39-EXECRELOAD/test.sh @@ -31,9 +31,6 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty -NotifyAccess=all EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-40-EXEC-COMMAND-EX/test.sh b/test/TEST-40-EXEC-COMMAND-EX/test.sh index 723c9ccd4b..4e73fbaee9 100755 --- a/test/TEST-40-EXEC-COMMAND-EX/test.sh +++ b/test/TEST-40-EXEC-COMMAND-EX/test.sh @@ -29,9 +29,6 @@ Description=Testsuite service [Service] ExecStart=/testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty -NotifyAccess=all EOF cp testsuite.sh $initdir/ From 51fa85913c4d1826414c6fa5a2e235f65425d91a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 8 Oct 2019 09:10:12 +0200 Subject: [PATCH 2/3] 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. --- test/TEST-02-CRYPTSETUP/test.sh | 9 +-------- test/TEST-03-JOBS/test.sh | 9 +-------- test/TEST-04-JOURNAL/test.sh | 9 +-------- test/TEST-05-RLIMITS/test.sh | 9 +-------- test/TEST-06-SELINUX/test.sh | 8 +------- test/TEST-07-ISSUE-1981/test.sh | 9 +-------- test/TEST-08-ISSUE-2730/test.sh | 7 +------ test/TEST-09-ISSUE-2691/test.sh | 8 +------- test/TEST-10-ISSUE-2467/test.sh | 8 +------- test/TEST-11-ISSUE-3166/test.sh | 9 +-------- test/TEST-12-ISSUE-3171/test.sh | 9 +-------- test/TEST-13-NSPAWN-SMOKE/test.sh | 9 +-------- test/TEST-14-MACHINE-ID/test.sh | 8 +------- test/TEST-15-DROPIN/test.sh | 8 +------- test/TEST-16-EXTEND-TIMEOUT/test.sh | 7 +------ test/TEST-17-UDEV-WANTS/test.sh | 8 +------- test/TEST-18-FAILUREACTION/test.sh | 9 ++------- test/TEST-19-DELEGATE/test.sh | 9 +-------- test/TEST-20-MAINPIDGAMES/test.sh | 10 ++-------- test/TEST-22-TMPFILES/test.sh | 9 +-------- test/TEST-23-TYPE-EXEC/test.sh | 9 +-------- test/TEST-27-STDOUTFILE/test.sh | 12 ++---------- test/TEST-28-PERCENTJ-WANTEDBY/test.sh | 9 ++------- test/TEST-29-UDEV-ID_RENAMING/test.sh | 8 +------- test/TEST-30-ONCLOCKCHANGE/test.sh | 9 +-------- test/TEST-31-DEVICE-ENUMERATION/test.sh | 8 +------- test/TEST-32-OOMPOLICY/test.sh | 9 +-------- test/TEST-33-CLEAN-UNIT/test.sh | 9 +-------- test/TEST-34-DYNAMICUSERMIGRATE/test.sh | 9 +-------- test/TEST-36-NUMAPOLICY/test.sh | 9 +-------- test/TEST-37-RUNTIMEDIRECTORYPRESERVE/test.sh | 9 +-------- test/TEST-39-EXECRELOAD/test.sh | 9 +-------- test/TEST-40-EXEC-COMMAND-EX/test.sh | 9 +-------- test/test-functions | 9 +++++++++ 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 <$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 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 <$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 <$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 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 <$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 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 <$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 < Date: Tue, 8 Oct 2019 11:11:49 +0200 Subject: [PATCH 3/3] test/TEST-31-DEVICE-ENUMERATION: do not use -x to avoid grep loop https://github.com/systemd/systemd/pull/13746#issuecomment-539410752: > [grep] now matches the grep command itself, as it's logged into journal as well, thanks to set -x. Also, use journalctl --grep and -t to make things a bit quicker. --- test/TEST-31-DEVICE-ENUMERATION/testsuite.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/TEST-31-DEVICE-ENUMERATION/testsuite.sh b/test/TEST-31-DEVICE-ENUMERATION/testsuite.sh index aa94d59bd3..047c1be06f 100755 --- a/test/TEST-31-DEVICE-ENUMERATION/testsuite.sh +++ b/test/TEST-31-DEVICE-ENUMERATION/testsuite.sh @@ -1,8 +1,8 @@ #!/bin/bash -set -ex +set -e set -o pipefail -if journalctl -b | grep -e '\.device: Changed plugged -> dead'; then +if journalctl -b -t systemd --grep '\.device: Changed plugged -> dead'; then exit 1 fi