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.
This commit is contained in:
George Koehler 2017-11-08 14:08:43 -05:00
parent 0fc0faef08
commit 96e23b3a0f
3 changed files with 22 additions and 12 deletions

View file

@ -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)"

View file

@ -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

View file

@ -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
}
'