1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
#!/bin/sh
# This is a shell wrapper which executes test.pl with a given
# testfile and specified arguments. It logs the output, counts the
# errors, and returns either true or false, depending on whether
# any tests failed.
#
# It might be better in the long run to replace this with something
# using Test::Harness, which produces a far better error format.
#
# Shevek wrote this from Wayne's original code.
TESTFILE=$1
shift
echo "Running tests from $TESTFILE.txt (with args '$@')..."
perl test.pl \
--impl=libspf2 \
--data=$TESTFILE.txt \
"$@" \
2>&1 | grep -v "^ok [0-9][0-9]*" > $TESTFILE.out
# 2>&1 | grep -v "^ok [0-9][0-9]*" | tee $TESTFILE.out
num_errors=$(grep "^not ok [0-9][0-9]*" $TESTFILE.out |\
sed /TODO/d |\
wc -l)
num_errors=$(expr $num_errors + 0)
if [ "$num_errors" -ne 0 ]
then
echo "Error: $num_errors tests failed"
else
echo "All regression tests passed"
fi
if [ "$1" = "-val" ]
then
sleep 1
grep -n "== ERROR SUMMARY: " .valgrind/log* | grep -v "0 errors from 0 contexts" | head
fi
[ $num_errors -ne 0 ] && exit 1
exit 0
|