glsl/tests: Plumb $(PYTHON2) and $(PYTHON_FLAGS) into optimization-test.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 29 May 2012 18:16:34 +0000 (11:16 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 31 May 2012 04:49:41 +0000 (21:49 -0700)
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@whitecape.org>
Acked-by: Matt Turner <mattst88@gmail.com>
src/glsl/tests/Makefile.am
src/glsl/tests/optimization-test

index c1c74e75b571b94c24c5e10845329275a7824793..d2facbaabb8665a2fb9b72ee5f11da7ca5c99fe6 100644 (file)
@@ -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 \
index 0c130be1379edd85239ecee66931874b605164bc..363c6ccda564a316d18e2f0279407b2063ffa78a 100755 (executable)
@@ -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