]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Do not strip leading whitespace from test output
authorMichał Kępień <michal@isc.org>
Wed, 26 Jan 2022 14:18:43 +0000 (15:18 +0100)
committerMichał Kępień <michal@isc.org>
Wed, 26 Jan 2022 14:18:43 +0000 (15:18 +0100)
The echo_*() and cat_*() functions in bin/tests/system/conf.sh.common
call the "read" builtin command without specifying the field separator
to use.  This results in leading whitespace getting stripped from each
line of the texts passed to those functions, which mangles e.g. pytest
output, hindering test failure troubleshooting.

Address by setting IFS to an empty value for the "read" calls used in
the aforementioned helper functions.

bin/tests/system/conf.sh.common

index 3809d74aa8d0c976844fb84e6868bc2a18bf95be..ce7b923b23f21dbd576c2a87df5b014fa8a050ee 100644 (file)
@@ -181,19 +181,19 @@ then
                printf "${COLOR_END}%s${COLOR_NONE}\n" "$*"
        }
        echo_i() {
-           printf '%s\n' "$*" | while read -r __LINE ; do
+           printf '%s\n' "$*" | while IFS= read -r __LINE ; do
               echoinfo "I:$SYSTESTDIR:$__LINE"
            done
        }
 
        echo_ic() {
-           printf '%s\n' "$*" | while read -r __LINE ; do
+           printf '%s\n' "$*" | while IFS= read -r __LINE ; do
               echoinfo "I:$SYSTESTDIR:  $__LINE"
            done
        }
 
        echo_d() {
-           printf '%s\n' "$*" | while read -r __LINE ; do
+           printf '%s\n' "$*" | while IFS= read -r __LINE ; do
               echoinfo "D:$SYSTESTDIR:$__LINE"
            done
        }
@@ -218,32 +218,32 @@ else
        }
 
        echo_i() {
-           echo "$@" | while read -r __LINE ; do
+           echo "$@" | while IFS= read -r __LINE ; do
               echoinfo "I:$SYSTESTDIR:$__LINE"
            done
        }
 
        echo_ic() {
-           echo "$@" | while read -r __LINE ; do
+           echo "$@" | while IFS= read -r __LINE ; do
               echoinfo "I:$SYSTESTDIR:  $__LINE"
            done
        }
 
        echo_d() {
-           echo "$@" | while read -r __LINE ; do
+           echo "$@" | while IFS= read -r __LINE ; do
               echoinfo "D:$SYSTESTDIR:$__LINE"
            done
        }
 fi
 
 cat_i() {
-    while read -r __LINE ; do
+    while IFS= read -r __LINE ; do
        echoinfo "I:$SYSTESTDIR:$__LINE"
     done
 }
 
 cat_d() {
-    while read -r __LINE ; do
+    while IFS= read -r __LINE ; do
        echoinfo "D:$SYSTESTDIR:$__LINE"
     done
 }