From 69bdecbb6227d7590468fbcfe1d6a3e2fb7edeef Mon Sep 17 00:00:00 2001 From: "Gu://em_" Date: Sun, 25 Jan 2026 16:50:22 +0100 Subject: [PATCH] fix: fixed testsuite reporting false failures --- tests/functional/run-tests.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/functional/run-tests.sh b/tests/functional/run-tests.sh index f2cbda1..93b1bf3 100755 --- a/tests/functional/run-tests.sh +++ b/tests/functional/run-tests.sh @@ -125,7 +125,7 @@ check_result() { echo -e ' ' "Expected code $ref_code but got $actual_code" test_failed=1 # Check output - elif diff $output $ref_output > /dev/null; then + elif [[ $(diff $output $ref_output > /dev/null) -ne 0 ]]; then echo -e $BRed "FAILED" $Color_Off echo -e ' ' "on '$command'" echo -e ' ' "Output is not the one expected" @@ -226,9 +226,13 @@ test_script() { summarize() { + # Compute statistics (( passed_tests = $total_tests - $errors_count )) (( tests_percentage = 100 * $passed_tests / $total_tests )) + # Adapt color depending on results + + # Percentage if [[ tests_percentage -gt 80 ]]; then coverage_color=$BGreen elif [[ tests_percentage -gt 50 ]]; then @@ -238,12 +242,19 @@ summarize() { else coverage_color=$BRed fi + # Timeouts + if [[ $timeouts_count -eq 0 ]]; then + timeouts_color=$BGreen + else + timeouts_color=$BRed + fi + # Print echo -e $BWhite "\n\n""===========" $UWhite"Summary"$Color_Off "\n" echo -e " Passed $coverage_color$passed_tests/$total_tests$Color_Off tests ($coverage_color$tests_percentage$Color_Off%)" - echo -e " Got $BRed$timeouts_count timeout(s)$Color_Off" - if [ "$OUTPUT_FILE" != "" ]; - then echo $tests_percentage > "$OUTPUT_FILE"; + echo -e " Got $timeouts_color$timeouts_count timeout(s)$Color_Off" + if [ "$OUTPUT_FILE" != "" ]; then + echo $tests_percentage > "$OUTPUT_FILE"; fi echo