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] 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/