Mesa (master): glcpp: wire up glcpp-test to make check

Matt Turner mattst88 at kemper.freedesktop.org
Fri Nov 9 22:31:37 UTC 2012


Module: Mesa
Branch: master
Commit: c6f426c02d14fcdfdbdd03473d098d4c9b81a8b2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c6f426c02d14fcdfdbdd03473d098d4c9b81a8b2

Author: Matt Turner <mattst88 at gmail.com>
Date:   Wed Nov  7 13:58:14 2012 -0800

glcpp: wire up glcpp-test to make check

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/glsl/glcpp/Makefile.am      |    2 ++
 src/glsl/glcpp/tests/glcpp-test |   16 ++++++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/glsl/glcpp/Makefile.am b/src/glsl/glcpp/Makefile.am
index 87affce..04d8cda 100644
--- a/src/glsl/glcpp/Makefile.am
+++ b/src/glsl/glcpp/Makefile.am
@@ -22,6 +22,8 @@
 
 include ../Makefile.sources
 
+TESTS = tests/glcpp-test
+
 AM_CFLAGS = \
 	-I$(top_srcdir)/include \
 	-I$(top_srcdir)/src/mapi \
diff --git a/src/glsl/glcpp/tests/glcpp-test b/src/glsl/glcpp/tests/glcpp-test
index 1db7523..ac89191 100755
--- a/src/glsl/glcpp/tests/glcpp-test
+++ b/src/glsl/glcpp/tests/glcpp-test
@@ -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




More information about the mesa-commit mailing list