glcpp: Fix test suite to avoid flagging failed tests as valgrind errors.
authorCarl Worth <cworth@cworth.org>
Mon, 23 Aug 2010 17:41:30 +0000 (10:41 -0700)
committerCarl Worth <cworth@cworth.org>
Mon, 23 Aug 2010 17:48:10 +0000 (10:48 -0700)
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.

src/glsl/glcpp/tests/glcpp-test

index 6494d0c0e779d63fbcc822774eea42a04c491949..5dc08ea6acbef7bb3427e0377f5425c8a4a81020 100755 (executable)
@@ -27,13 +27,14 @@ 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
+    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
-    else
-       echo "ERRORS"
-       cat $test.valgrind-errors
     fi
 done