From 17fbf25676fd2fd0713b599518fe35cb36366a51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Wed, 26 Jan 2022 15:18:43 +0100 Subject: [PATCH] Do not strip leading whitespace from test output 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. (cherry picked from commit fb8702211532c4f68f2d180aac23d983d5e17fc7) --- bin/tests/system/conf.sh.common | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/tests/system/conf.sh.common b/bin/tests/system/conf.sh.common index 3809d74aa8..ce7b923b23 100644 --- a/bin/tests/system/conf.sh.common +++ b/bin/tests/system/conf.sh.common @@ -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 }