diff options
Diffstat (limited to 'src/glsl/glcpp/tests/glcpp-test')
-rwxr-xr-x | src/glsl/glcpp/tests/glcpp-test | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/glsl/glcpp/tests/glcpp-test b/src/glsl/glcpp/tests/glcpp-test new file mode 100755 index 0000000000..cfe7e97878 --- /dev/null +++ b/src/glsl/glcpp/tests/glcpp-test @@ -0,0 +1,47 @@ +#!/bin/sh + +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; 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 + |