From: Zbigniew Jędrzejewski-Szmek Date: Tue, 8 Oct 2019 06:45:12 +0000 (+0200) Subject: test: drop redirection to tty in integration tests X-Git-Tag: v244-rc1~211^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0f714a34c4a1149e2d368c4cc359a50f19b7cd9e;p=thirdparty%2Fsystemd.git 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. --- diff --git a/test/TEST-03-JOBS/test.sh b/test/TEST-03-JOBS/test.sh index b815e7cb672..3359ee68400 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 e0e78b11003..80b2fd923f9 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 f89bdca99ff..4f14bf12e33 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 8727432e30c..36032348b89 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 503c5ca551d..18b0be82e8e 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 348c697f633..bdd6562a337 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 457ef6ae745..0f6aef74536 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 9163f88c822..2b10b9ad703 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 026c38a264f..c0f51f3b897 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 fc216ee5bf1..065a8e461c8 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 d481f1b8bfe..a796dcd79e4 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 67641746d88..2a483bbc3dd 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 98a9db80072..67e074af4c8 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 064daf92358..855ec42266c 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 17610af21d7..4578916762d 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 aeda69baae4..90dd495c0a5 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 7339d3b656c..0bff59fcb7f 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 a586f9dc904..14cbe5f3860 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 9e87e61dcd5..b7a3ab8ce49 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 7eb9db415a5..e6bb7baedfd 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 723c9ccd4b1..4e73fbaee93 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/