21560c40e8
We recently added several tests that intentionally trigger preprocessor errors. During valgrind-based testing, our test script was noticing the non-zero return value from the preprocessor and incorrectly flagging the valgrind-based test as failing. To fix this, we make valgrind return an error code that is otherwise unused by the preprocessor.
51 lines
1.0 KiB
Bash
Executable File
51 lines
1.0 KiB
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 2>&1
|
|
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..."
|
|
valgrind --error-exitcode=31 --log-file=$test.valgrind-errors ../glcpp < $test >/dev/null 2>&1
|
|
if [ "$?" = "31" ]; then
|
|
echo "ERRORS"
|
|
cat $test.valgrind-errors
|
|
else
|
|
echo "CLEAN"
|
|
clean=$((clean+1))
|
|
rm $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
|
|
|