From f1f180a6a19408023b04fdb2361c404c378006fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Mon, 8 Jun 2020 10:46:35 +0200 Subject: [PATCH] all.sh: keep dd output in non-quiet mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since dd prints everything on stderr, both normal status update and actual errors when they occur, redirecting that to /dev/null is a trade-off that's acceptable in quiet mode (typically used on a developer's machine and the developer will re-run in non-quiet mode if anything fails without sufficient detail in the output), but not that much in non-quiet mode. For example, if our dd invocation fails because the disk in full on a CI machine, we want the error to be reported at the time we invoke dd, and not later when a seemingly unrelated test fails due to an incorrect seedfile. Signed-off-by: Manuel Pégourié-Gonnard --- tests/scripts/all.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh index 1640dbe48..f2b346359 100755 --- a/tests/scripts/all.sh +++ b/tests/scripts/all.sh @@ -510,10 +510,16 @@ pre_setup_quiet_redirect () { redirect_out () { "$@" } + redirect_err () { + "$@" + } else redirect_out () { "$@" >/dev/null } + redirect_err () { + "$@" 2>/dev/null + } fi } @@ -1925,7 +1931,7 @@ run_component () { # Unconditionally create a seedfile that's sufficiently long. # Do this before each component, because a previous component may # have messed it up or shortened it. - dd if=/dev/urandom of=./tests/seedfile bs=64 count=1 >/dev/null 2>&1 + redirect_err dd if=/dev/urandom of=./tests/seedfile bs=64 count=1 # Run the component code. if [ $QUIET -eq 1 ]; then