From 88a07457c7e6dbe0c170a75110f84bad39f156c6 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Thu, 8 Jul 2021 19:03:50 +0200 Subject: [PATCH] Remove barely-used redirect functions redirect_out was no longer used and redirect_err was only used to quiet dd. Change the dd invocation to only print diagnostics on error (on platforms where this is possible). Signed-off-by: Gilles Peskine --- tests/scripts/all.sh | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh index afc1a49185..4614029ad0 100755 --- a/tests/scripts/all.sh +++ b/tests/scripts/all.sh @@ -607,24 +607,6 @@ not () { fi } -pre_setup_quiet_redirect () { - if [ $QUIET -ne 1 ]; then - redirect_out () { - "$@" - } - redirect_err () { - "$@" - } - else - redirect_out () { - "$@" >/dev/null - } - redirect_err () { - "$@" 2>/dev/null - } - fi -} - pre_prepare_outcome_file () { case "$MBEDTLS_TEST_OUTCOME_FILE" in [!/]*) MBEDTLS_TEST_OUTCOME_FILE="$PWD/$MBEDTLS_TEST_OUTCOME_FILE";; @@ -2726,7 +2708,12 @@ 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. - redirect_err dd if=/dev/urandom of=./tests/seedfile bs=64 count=1 + local dd_cmd + dd_cmd=(dd if=/dev/urandom of=./tests/seedfile bs=64 count=1) + case $OSTYPE in + linux*|freebsd*|openbsd*|darwin*) dd_cmd+=(status=none) + esac + "${dd_cmd[@]}" # Run the component in a subshell if [ $KEEP_GOING -eq 1 ]; then @@ -2774,7 +2761,6 @@ build_status=0 if [ $KEEP_GOING -eq 1 ]; then pre_setup_keep_going fi -pre_setup_quiet_redirect pre_prepare_outcome_file pre_print_configuration pre_check_tools