glcpp: Make test suite test for valgrind cleanliness.
authorCarl Worth <cworth@cworth.org>
Tue, 20 Jul 2010 00:49:23 +0000 (17:49 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 21 Jul 2010 00:01:11 +0000 (17:01 -0700)
As it turns out, 4 of our current tests are not valgrind clean,
(use after free errors or so), so this will be helpful for
investigating and fixing those.

src/glsl/glcpp/tests/glcpp-test

index 82777197150d5f4ff521b1f4acbf3906207d59d7..cfe7e9787863f7150918ec4a7af681aaa857f8a6 100755 (executable)
@@ -2,7 +2,9 @@
 
 total=0
 pass=0
+clean=0
 
+echo "====== Testing for correctness ======"
 for test in *.c; do
     echo -n "Testing $test..."
     ../glcpp < $test > $test.out
@@ -16,10 +18,28 @@ for test in *.c; do
     fi
 done
 
+echo ""
 echo "$pass/$total tests returned correct results"
 echo ""
 
-if [ "$pass" = "$total" ] ; then
+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