fix: fixed testsuite reporting false failures

This commit is contained in:
Gu://em_ 2026-01-25 16:50:22 +01:00
parent 668bba5b02
commit 69bdecbb62

View file

@ -125,7 +125,7 @@ check_result() {
echo -e ' ' "Expected code $ref_code but got $actual_code" echo -e ' ' "Expected code $ref_code but got $actual_code"
test_failed=1 test_failed=1
# Check output # 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 $BRed "FAILED" $Color_Off
echo -e ' ' "on '$command'" echo -e ' ' "on '$command'"
echo -e ' ' "Output is not the one expected" echo -e ' ' "Output is not the one expected"
@ -226,9 +226,13 @@ test_script() {
summarize() { summarize() {
# Compute statistics
(( passed_tests = $total_tests - $errors_count )) (( passed_tests = $total_tests - $errors_count ))
(( tests_percentage = 100 * $passed_tests / $total_tests )) (( tests_percentage = 100 * $passed_tests / $total_tests ))
# Adapt color depending on results
# Percentage
if [[ tests_percentage -gt 80 ]]; then if [[ tests_percentage -gt 80 ]]; then
coverage_color=$BGreen coverage_color=$BGreen
elif [[ tests_percentage -gt 50 ]]; then elif [[ tests_percentage -gt 50 ]]; then
@ -238,12 +242,19 @@ summarize() {
else else
coverage_color=$BRed coverage_color=$BRed
fi 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 $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 " 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" echo -e " Got $timeouts_color$timeouts_count timeout(s)$Color_Off"
if [ "$OUTPUT_FILE" != "" ]; if [ "$OUTPUT_FILE" != "" ]; then
then echo $tests_percentage > "$OUTPUT_FILE"; echo $tests_percentage > "$OUTPUT_FILE";
fi fi
echo echo