[Piglit] [Patch v2 09/11] framework: move testBinDir to exectest

Dylan Baker baker.dylan.c at gmail.com
Thu Mar 27 15:34:02 PDT 2014


This is mostly consumed by Test's children, so putting it in the same
module makes sense. This should reduce the number of imports from core
as well, since most consumers of testBinDir also make use of ExecTest or
PlainExecTest.

Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
 framework/core.py                         |  9 +--------
 framework/exectest.py                     | 13 ++++++++++++-
 framework/gleantest.py                    |  3 +--
 framework/glsl_parser_test.py             |  3 +--
 framework/shader_test.py                  |  4 ++--
 framework/tests/glsl_parser_test_tests.py |  2 +-
 tests/es3conform.py                       |  4 ++--
 tests/igt.py                              |  4 ++--
 tests/oglconform.py                       |  4 ++--
 9 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/framework/core.py b/framework/core.py
index 86ed993..14ec49d 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -52,8 +52,7 @@ __all__ = ['PIGLIT_CONFIG',
            'TestrunResult',
            'TestResult',
            'TestProfile',
-           'Group',
-           'testBinDir']
+           'Group']
 
 
 PIGLIT_CONFIG = ConfigParser.SafeConfigParser()
@@ -212,12 +211,6 @@ def checkDir(dirname, failifexists):
         if e.errno != errno.EEXIST:
             raise
 
-if 'PIGLIT_BUILD_DIR' in os.environ:
-    testBinDir = os.path.join(os.environ['PIGLIT_BUILD_DIR'], 'bin')
-else:
-    testBinDir = os.path.normpath(os.path.join(os.path.dirname(__file__),
-                                               '../bin'))
-
 if 'PIGLIT_SOURCE_DIR' not in os.environ:
     p = os.path
     os.environ['PIGLIT_SOURCE_DIR'] = p.abspath(p.join(p.dirname(__file__),
diff --git a/framework/exectest.py b/framework/exectest.py
index aef4197..3028722 100644
--- a/framework/exectest.py
+++ b/framework/exectest.py
@@ -28,15 +28,26 @@ import time
 import sys
 import traceback
 
-from .core import testBinDir, TestResult
+from .core import TestResult
 
 
+__all__ = ['Test',
+           'ExecTest',
+           'PlainExecTest',
+           'testBinDir']
+
 # Platform global variables
 if 'PIGLIT_PLATFORM' in os.environ:
     PIGLIT_PLATFORM = os.environ['PIGLIT_PLATFORM']
 else:
     PIGLIT_PLATFORM = ''
 
+if 'PIGLIT_BUILD_DIR' in os.environ:
+    testBinDir = os.path.join(os.environ['PIGLIT_BUILD_DIR'], 'bin')
+else:
+    testBinDir = os.path.normpath(os.path.join(os.path.dirname(__file__),
+                                               '../bin'))
+
 
 class Test(object):
     def __init__(self, runConcurrent=False):
diff --git a/framework/gleantest.py b/framework/gleantest.py
index 30d4aff..637d3db 100644
--- a/framework/gleantest.py
+++ b/framework/gleantest.py
@@ -23,8 +23,7 @@
 
 import os
 
-from .core import testBinDir
-from .exectest import ExecTest
+from .exectest import ExecTest, testBinDir
 
 glean_executable = os.path.join(testBinDir, "glean")
 
diff --git a/framework/glsl_parser_test.py b/framework/glsl_parser_test.py
index e750d59..af030c1 100644
--- a/framework/glsl_parser_test.py
+++ b/framework/glsl_parser_test.py
@@ -27,8 +27,7 @@ import os.path as path
 import re
 from cStringIO import StringIO
 
-from .core import testBinDir
-from .exectest import PlainExecTest
+from .exectest import PlainExecTest, testBinDir
 
 
 def add_glsl_parser_test(group, filepath, test_name):
diff --git a/framework/shader_test.py b/framework/shader_test.py
index f257b56..4440563 100644
--- a/framework/shader_test.py
+++ b/framework/shader_test.py
@@ -27,8 +27,8 @@ import os
 import os.path as path
 import re
 
-from .core import testBinDir, Group
-from .exectest import PlainExecTest
+from .core import Group
+from .exectest import PlainExecTest, testBinDir
 
 __all__ = ['add_shader_test', 'add_shader_test_dir']
 
diff --git a/framework/tests/glsl_parser_test_tests.py b/framework/tests/glsl_parser_test_tests.py
index f1cea00..090308e 100644
--- a/framework/tests/glsl_parser_test_tests.py
+++ b/framework/tests/glsl_parser_test_tests.py
@@ -24,7 +24,7 @@ import os
 import nose.tools as nt
 import framework.glsl_parser_test as glsl
 import framework.tests.utils as utils
-from framework.core import testBinDir
+from framework.exectest import testBinDir
 
 
 def _check_config(content):
diff --git a/tests/es3conform.py b/tests/es3conform.py
index dadebb9..d5d6a12 100644
--- a/tests/es3conform.py
+++ b/tests/es3conform.py
@@ -26,8 +26,8 @@ import sys
 
 from os import path
 from glob import glob
-from framework.core import TestProfile, testBinDir
-from framework.exectest import ExecTest
+from framework.core import TestProfile
+from framework.exectest import ExecTest, testBinDir
 
 __all__ = ['profile']
 
diff --git a/tests/igt.py b/tests/igt.py
index f80a6c4..7416b4e 100644
--- a/tests/igt.py
+++ b/tests/igt.py
@@ -28,8 +28,8 @@ import sys
 import subprocess
 
 from os import path
-from framework.core import testBinDir, TestProfile, TestResult
-from framework.exectest import ExecTest
+from framework.core import TestProfile, TestResult
+from framework.exectest import ExecTest, testBinDir
 
 __all__ = ['profile']
 
diff --git a/tests/oglconform.py b/tests/oglconform.py
index 857d0cd..c2273dc 100644
--- a/tests/oglconform.py
+++ b/tests/oglconform.py
@@ -26,8 +26,8 @@ import re
 import sys
 import subprocess
 
-from framework.core import TestProfile, testBinDir
-from framework.exectest import ExecTest
+from framework.core import TestProfile
+from framework.exectest import ExecTest, testBinDir
 from os import path
 
 __all__ = ['profile']
-- 
1.9.1



More information about the Piglit mailing list