From 96e23b3a0f539f05b70431a7f8fd9cbce3a6e299 Mon Sep 17 00:00:00 2001 From: George Koehler Date: Wed, 8 Nov 2017 14:08:43 -0500 Subject: [PATCH] Show tests that @@TIMEDOUT. A `set -e` in testdriver.sh caused it to exit early and hide the output of a @@TIMEDOUT test, so I never saw the @@TIMEDOUT marker. Then build.lua added a @@FAIL marker. --- first/testsummary.sh | 7 ++++++- tests/plat/build.lua | 2 +- tests/plat/testdriver.sh | 25 +++++++++++++++---------- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/first/testsummary.sh b/first/testsummary.sh index 9ab5daa2f..2aca1d225 100755 --- a/first/testsummary.sh +++ b/first/testsummary.sh @@ -31,7 +31,12 @@ if [ "$failed" != "" ]; then for t in $failed; do echo $t done - exit 1 +fi +if [ "$timedout" != "" ]; then + echo "Timed-out test logs:" + for t in $timedout; do + echo $t + done fi if [ "$failed" != "" -o "$timedout" != "" ]; then echo "Test status: SAD FACE (tests are failing)" diff --git a/tests/plat/build.lua b/tests/plat/build.lua index 12611711a..60a3f8d0b 100644 --- a/tests/plat/build.lua +++ b/tests/plat/build.lua @@ -58,7 +58,7 @@ definerule("plat_testsuite", "util/build+testrunner" }, commands = { - "(%{ins[2]} "..e.method.." %{ins[1]} 5 %{ins[3]} || echo @@FAIL) > %{outs}", + "%{ins[2]} "..e.method.." %{ins[1]} 5 %{ins[3]} > %{outs}; true", } } end diff --git a/tests/plat/testdriver.sh b/tests/plat/testdriver.sh index 384c83b47..07f206a5e 100755 --- a/tests/plat/testdriver.sh +++ b/tests/plat/testdriver.sh @@ -4,11 +4,6 @@ img=$2 timeout=$3 timeoutprog=$4 -set -e - -result=/tmp/$$.testdriver.result -trap "rm -f $result" EXIT - errcho() { >&2 echo "$*" } @@ -27,7 +22,7 @@ get_test_output() { qemu-system-ppc) img="-kernel $img" ;; esac - $timeoutprog -t $timeout -- $method -nographic $img > $result 2>&1 + $timeoutprog -t $timeout -- $method -nographic $img 2>&1 ;; qemu-*) @@ -37,7 +32,7 @@ get_test_output() { exit 0 fi - $method $img > $result 2>&1 + $method $img 2>&1 ;; *) @@ -47,6 +42,16 @@ get_test_output() { esac } -get_test_output -( grep -q '@@FAIL\|@@SKIPPED' $result || ! grep -q @@FINISHED $result ) && cat $result && exit 1 -exit 0 +# Hide output if the test passed. +# Show output if it failed, skipped, or timed out. +get_test_output | awk ' + { lines[count++] = $0 } + /@@FAIL|@@SKIPPED|@@TIMEDOUT/ { bad = 1 } + /@@FINISHED/ { finished = 1 } + END { + if (finished && !bad) exit 0 + for (i = 0; i < count; i++) print lines[i] + if (!bad) print "@@FAIL by testdriver.sh" + exit 1 + } +'