From: Richard Hansen Date: Mon, 3 Feb 2025 23:26:54 +0000 (-0500) Subject: tests: support getting `diag_' message from stdin X-Git-Tag: v1.17.90~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=27a604f805a5ff45289421b01888d9beb8ca73f0;p=thirdparty%2Fautomake.git tests: support getting `diag_' message from stdin * t/ax/tap-functions.sh (diag_): Read the diagnostic message from stdin if no arguments are given. --- diff --git a/t/ax/tap-functions.sh b/t/ax/tap-functions.sh index a458b773e..3e0cb50fe 100644 --- a/t/ax/tap-functions.sh +++ b/t/ax/tap-functions.sh @@ -69,18 +69,17 @@ planned_=none # diag_ [EXPLANATION] # ------------------ -# Report the given text as TAP diagnostic. Assumes the string denoting -# TAP diagnostic lines is stored in the '$diag_string_' variable; this is -# done to allow better interplay with TAP drivers that allow such a string -# to be configured. +# Report the given text, or stdin if no arguments, as TAP diagnostic. +# Assumes the string denoting TAP diagnostic lines is stored in the +# '$diag_string_' variable; this is done to allow better interplay +# with TAP drivers that allow such a string to be configured. diag_ () ( set +x - test $# -eq 0 || while IFS= read -r line; do + test $# -eq 0 || { printf %s\\n "$*" | diag_; return; } + while IFS= read -r line || test -n "$line"; do printf %s\\n "$diag_string_ $line" - done <