From 9e9b3d263fede7eba42a3c497208307c06df8767 Mon Sep 17 00:00:00 2001 From: Francisco Casas Date: Tue, 20 Feb 2024 15:34:19 -0300 Subject: [PATCH] tests: Get detailed information on failing tests. --- tests/test-driver.sh | 102 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 85 insertions(+), 17 deletions(-) diff --git a/tests/test-driver.sh b/tests/test-driver.sh index 97b6ea3e..39a3e427 100755 --- a/tests/test-driver.sh +++ b/tests/test-driver.sh @@ -1,8 +1,11 @@ #! /bin/sh -# test-driver - basic testsuite driver script. +# test-driver - basic testsuite driver script. Modified for vkd3d tests. -scriptversion=2022-02-13.00; # UTC +scriptversion=2022-02-20.01; # UTC +# This is a modified version of the test_driver script provided by +# auto-tools, whose licence is as follows: +# # Copyright (C) 2011-2021 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify @@ -88,15 +91,25 @@ if test $# -eq 0; then fi if test $color_tests = yes; then - # Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'. - red='' # Red. - grn='' # Green. - lgn='' # Light green. - blu='' # Blue. - mgn='' # Magenta. - std='' # No color. + color_reset='' + color_dark_red='' + color_dark_purple='' + color_green='' + color_yellow='' + color_blue='' + color_bright_red='' + color_bright_purple='' + color_fade='' else - red= grn= lgn= blu= mgn= std= + color_reset= + color_dark_red= + color_dark_purple= + color_green= + color_yellow= + color_blue= + color_bright_red= + color_bright_purple= + color_fade= fi do_exit='rm -f $log_file $trs_file; (exit $st); exit $st' @@ -119,12 +132,12 @@ else fi case $tweaked_estatus:$expect_failure in - 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; - 0:*) col=$grn res=PASS recheck=no gcopy=no;; - 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; - 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; - *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; - *:*) col=$red res=FAIL recheck=yes gcopy=yes;; + 0:yes) col=$color_dark_red res=XPASS recheck=yes gcopy=yes;; + 0:*) col=$color_green res=PASS recheck=no gcopy=no;; + 77:*) col=$color_blue res=SKIP recheck=no gcopy=yes;; + 99:*) col=$color_bright_purple res=ERROR recheck=yes gcopy=yes;; + *:yes) col=$color_yellow res=XFAIL recheck=no gcopy=yes;; + *:*) col=$color_bright_red res=FAIL recheck=yes gcopy=yes;; esac # Report the test outcome and exit status in the logs, so that one can @@ -133,8 +146,63 @@ esac # file (automake bug#11814). echo "$res $test_name (exit status: $estatus)" >>"$log_file" +# Give detailed report +awk_program=$(cat <<'EOF' +BEGIN { + FS = ":" +} + +/: Compiling [^[:space:]]+ shaders with [^[:space:]]+ and executing with [^[:space:]]+/ { + n = split($3, arr, " ") + shader_models = arr[2] + backend = arr[n] + gsub(/\./, "", backend) + str = "(" shader_models ")" backend "" + printf("# %-20s\n", str) +} + +/: Test failed:/ { + print "" $4 "" "[F]" +} + +/: Todo:/ { + print "" $4 "" "[XF]" +} + +/: Todo succeeded:/ { + print "" $4 "" "[XP]" +} + +/: Assertion .* failed\./ { + print "[AF]" $0 +} + +EOF +) + +details=$(awk "$awk_program" "$log_file") + +# Count number of [XF] tags. +xfcount=$(echo "$details" | awk '/\[XF\]/{count++} END{print count}') + +details=$(echo "$details" |\ + sed "s/\[F\]/$color_bright_red[F]$color_reset/g" |\ + sed "s/\[XF\]/$color_yellow[XF]$color_reset/g" |\ + sed "s/\[XP\]/$color_dark_red[XP]$color_reset/g" |\ + sed "s/\[AF\]/$color_bright_purple[AF]$color_reset/g" |\ + sed "s//$color_fade/g" |\ + sed "s//$color_reset/g" |\ + tr '\n' ' ' |\ + tr '#' '\n' |\ + 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 + details="$color_yellow($xfcount XF)$color_reset" +fi + # Report outcome to console. -echo "${col}${res}${std}: $test_name" +echo "${col}${res}${color_reset}: $test_name $details" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file