Files
mesa/src/glsl/glcpp/tests/glcpp-test
T
Carl Worth 8485f4d9aa glcpp: Clean up intermediate file when test suite is interrupted.
The glcpp-test script was leaving around bogus *.valgrind-errors files if
a valgrind test was interrupted.
2010-08-11 12:46:16 -07:00

50 lines
1004 B
Bash
Executable File

#!/bin/sh
trap 'rm $test.valgrind-errors; exit 1' INT QUIT
total=0
pass=0
clean=0
echo "====== Testing for correctness ======"
for test in *.c; do
echo -n "Testing $test..."
../glcpp < $test > $test.out
total=$((total+1))
if cmp $test.expected $test.out >/dev/null 2>&1; then
echo "PASS"
pass=$((pass+1))
else
echo "FAIL"
diff -u $test.expected $test.out
fi
done
echo ""
echo "$pass/$total tests returned correct results"
echo ""
echo "====== Testing for valgrind cleanliness ======"
for test in *.c; do
echo -n "Testing $test with valgrind..."
if valgrind --error-exitcode=1 --log-file=$test.valgrind-errors ../glcpp < $test >/dev/null; then
echo "CLEAN"
clean=$((clean+1))
rm $test.valgrind-errors
else
echo "ERRORS"
cat $test.valgrind-errors
fi
done
echo ""
echo "$pass/$total tests returned correct results"
echo "$clean/$total tests are valgrind-clean"
if [ "$pass" = "$total" ] && [ "$clean" = "$total" ]; then
exit 0
else
exit 1
fi