From b831ffe96c3e546fc9038c9308862d07b9aa267c Mon Sep 17 00:00:00 2001 From: Francisco Casas Date: Mon, 11 Mar 2024 22:02:30 -0300 Subject: [PATCH] tests: Avoid creating a file named "0" when calling "make check". We use "printf" instead of "print" in awk in order to avoid a newline in the value of $xfcount, and use "-gt" instead of ">", which creates the spurious file, in the comparison. --- tests/test-driver.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test-driver.sh b/tests/test-driver.sh index 39a3e427..221a963e 100755 --- a/tests/test-driver.sh +++ b/tests/test-driver.sh @@ -183,7 +183,7 @@ EOF details=$(awk "$awk_program" "$log_file") # Count number of [XF] tags. -xfcount=$(echo "$details" | awk '/\[XF\]/{count++} END{print count}') +xfcount=$(echo "$details" | awk '/\[XF\]/{count++} END{printf "%d", count}') details=$(echo "$details" |\ sed "s/\[F\]/$color_bright_red[F]$color_reset/g" |\ @@ -197,7 +197,7 @@ details=$(echo "$details" |\ awk 'NF != 1' ) # If the test passes but has [XF], we will omit details but report number of [XF] -if [ "$res" = "PASS" ] && [ $xfcount > 0 ]; then +if [ "$res" = "PASS" ] && [ "$xfcount" -gt 0 ]; then details="$color_yellow($xfcount XF)$color_reset" fi