2010-05-10 16:21:10 -07:00
|
|
|
#!/bin/sh
|
2010-05-25 13:09:03 -07:00
|
|
|
|
2010-08-11 12:46:16 -07:00
|
|
|
trap 'rm $test.valgrind-errors; exit 1' INT QUIT
|
|
|
|
|
|
2010-07-19 17:48:17 -07:00
|
|
|
total=0
|
|
|
|
|
pass=0
|
2010-07-19 17:49:23 -07:00
|
|
|
clean=0
|
2010-07-19 17:48:17 -07:00
|
|
|
|
2010-07-19 17:49:23 -07:00
|
|
|
echo "====== Testing for correctness ======"
|
2010-05-10 16:21:10 -07:00
|
|
|
for test in *.c; do
|
2010-07-19 17:48:17 -07:00
|
|
|
echo -n "Testing $test..."
|
2010-08-11 13:06:36 -07:00
|
|
|
../glcpp < $test > $test.out 2>&1
|
2010-07-19 17:48:17 -07:00
|
|
|
total=$((total+1))
|
2010-08-10 18:27:31 -07:00
|
|
|
if cmp $test.expected $test.out >/dev/null 2>&1; then
|
2010-07-19 17:48:17 -07:00
|
|
|
echo "PASS"
|
|
|
|
|
pass=$((pass+1))
|
|
|
|
|
else
|
|
|
|
|
echo "FAIL"
|
|
|
|
|
diff -u $test.expected $test.out
|
|
|
|
|
fi
|
2010-05-10 16:21:10 -07:00
|
|
|
done
|
2010-07-19 17:48:17 -07:00
|
|
|
|
2010-07-19 17:49:23 -07:00
|
|
|
echo ""
|
2010-07-19 17:48:17 -07:00
|
|
|
echo "$pass/$total tests returned correct results"
|
|
|
|
|
echo ""
|
|
|
|
|
|
2010-07-19 17:49:23 -07:00
|
|
|
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
|
2010-07-19 17:48:17 -07:00
|
|
|
exit 0
|
|
|
|
|
else
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|