glcpp: wire up glcpp-test to make check
authorMatt Turner <mattst88@gmail.com>
Wed, 7 Nov 2012 21:58:14 +0000 (13:58 -0800)
committerMatt Turner <mattst88@gmail.com>
Fri, 9 Nov 2012 22:33:08 +0000 (14:33 -0800)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/glcpp/Makefile.am
src/glsl/glcpp/tests/glcpp-test

index 87affce1c18639b7794acc56c09a9a0c815aaa82..04d8cda01941a1868d971ee5b65c8fcd2223654e 100644 (file)
@@ -22,6 +22,8 @@
 
 include ../Makefile.sources
 
+TESTS = tests/glcpp-test
+
 AM_CFLAGS = \
        -I$(top_srcdir)/include \
        -I$(top_srcdir)/src/mapi \
index 1db752375673593a657672aa75fe3b917704e55d..ac8919147866ab45a19aef45f187901cdf7e1c8b 100755 (executable)
@@ -1,5 +1,13 @@
 #!/bin/sh
 
+if [ ! -z "$srcdir" ]; then
+   testdir=$srcdir/tests
+   glcpp=`pwd`/glcpp
+else
+   testdir=.
+   glcpp=../glcpp
+fi
+
 trap 'rm $test.valgrind-errors; exit 1' INT QUIT
 
 usage ()
@@ -35,9 +43,9 @@ pass=0
 clean=0
 
 echo "====== Testing for correctness ======"
-for test in *.c; do
+for test in $testdir/*.c; do
     echo -n "Testing $test..."
-    ../glcpp < $test > $test.out 2>&1
+    $glcpp < $test > $test.out 2>&1
     total=$((total+1))
     if cmp $test.expected $test.out >/dev/null 2>&1; then
        echo "PASS"
@@ -54,9 +62,9 @@ echo ""
 
 if [ "$do_valgrind" = "yes" ]; then
     echo "====== Testing for valgrind cleanliness ======"
-    for test in *.c; do
+    for test in $testdir/*.c; do
        echo -n "Testing $test with valgrind..."
-       valgrind --error-exitcode=31 --log-file=$test.valgrind-errors ../glcpp < $test >/dev/null 2>&1
+       valgrind --error-exitcode=31 --log-file=$test.valgrind-errors $glcpp < $test >/dev/null 2>&1
        if [ "$?" = "31" ]; then
            echo "ERRORS"
            cat $test.valgrind-errors