summaryrefslogtreecommitdiff
path: root/src/glsl/glcpp/tests/glcpp-test
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-08-16 19:08:53 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-08-16 19:08:53 -0700
commit6c03c576cc49bbb008de66d374f4302ff0fe0390 (patch)
tree7ddeb3ee88532d9aef8728b9aa256edf7c125247 /src/glsl/glcpp/tests/glcpp-test
parent15a3b42e135a3a2cb463ec3cff80a55dd8528051 (diff)
parenta433cd286c60eb9d4c2114f042709eda0f3de676 (diff)
Merge branch 'glsl2'
Conflicts: src/mesa/program/prog_optimize.c
Diffstat (limited to 'src/glsl/glcpp/tests/glcpp-test')
-rwxr-xr-xsrc/glsl/glcpp/tests/glcpp-test49
1 files changed, 49 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..6494d0c0e7
--- /dev/null
+++ b/src/glsl/glcpp/tests/glcpp-test
@@ -0,0 +1,49 @@
+#!/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..."
+ 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
+