Mesa (master): glsl/tests: Plumb $(PYTHON2) and $(PYTHON_FLAGS) into optimization-test.

Kenneth Graunke kwg at kemper.freedesktop.org
Thu May 31 05:02:48 UTC 2012


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue May 29 11:16:34 2012 -0700

glsl/tests: Plumb $(PYTHON2) and $(PYTHON_FLAGS) into optimization-test.

Some distributions (like Arch Linux) make /usr/bin/python Python 3,
rather than Python 2.  Since compare_ir uses /usr/bin/env python,
such systems will fail to run optimization-test, causing 'make check' to
always fail.

Automake's TESTS_ENVIRONMENT variable provides a mechanism to run
programs or set environment variables in the test environment.
Ideally, I think we would want to use AM_TESTS_ENVIRONMENT, since
TESTS_ENVIRONMENT is supposed to be user-overridable.  However, it isn't
supported using the default/serial test runner.

Fixes 'make check' on Arch Linux and Gentoo.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Acked-by: Matt Turner <mattst88 at gmail.com>

---

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

diff --git a/src/glsl/tests/Makefile.am b/src/glsl/tests/Makefile.am
index c1c74e7..d2facba 100644
--- a/src/glsl/tests/Makefile.am
+++ b/src/glsl/tests/Makefile.am
@@ -7,6 +7,10 @@ INC = \
 AM_CFLAGS =  $(INC)
 AM_CXXFLAGS = $(INC)
 
+TESTS_ENVIRONMENT= \
+	export PYTHON2=$(PYTHON2); \
+	export PYTHON_FLAGS=$(PYTHON_FLAGS);
+
 TESTS = \
 	optimization-test \
 	ralloc-test \
diff --git a/src/glsl/tests/optimization-test b/src/glsl/tests/optimization-test
index 0c130be..363c6cc 100755
--- a/src/glsl/tests/optimization-test
+++ b/src/glsl/tests/optimization-test
@@ -8,12 +8,12 @@ for test in `find . -iname '*.opt_test'`; do
     echo -n "Testing $test..."
     (cd `dirname "$test"`; ./`basename "$test"`) > "$test.out" 2>&1
     total=$((total+1))
-    if ./compare_ir "$test.expected" "$test.out" >/dev/null 2>&1; then
+    if $PYTHON2 $PYTHON_FLAGS ./compare_ir "$test.expected" "$test.out" >/dev/null 2>&1; then
         echo "PASS"
         pass=$((pass+1))
     else
         echo "FAIL"
-        ./compare_ir "$test.expected" "$test.out"
+        $PYTHON2 $PYTHON_FLAGS ./compare_ir "$test.expected" "$test.out"
     fi
 done
 




More information about the mesa-commit mailing list