[Piglit] [PATCH 2/6] Replace testBinDir with pep8 compliant TEST_BIN_DIR

Dylan Baker baker.dylan.c at gmail.com
Wed Dec 18 13:58:17 PST 2013


This is really a constant, not just a variable, since changing it will
cause undefined behavior. Behond that lower cammelCase is not allowed
for variable names in pep8, so this should be changed.

This was implemented with the following command:
find . -name '*.py' | xargs -n sed -i -e 's!testBinDir!TEST_BIN_DIR!g'
find . -name '*.tests' | xargs -n sed -i -e 's!testBinDir!TEST_BIN_DIR!g'

Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
 framework/environment.py      | 9 ++++-----
 framework/exectest.py         | 6 +++---
 framework/gleantest.py        | 4 ++--
 framework/glsl_parser_test.py | 4 ++--
 framework/shader_test.py      | 4 ++--
 tests/es3conform.tests        | 8 ++++----
 tests/igt.tests               | 6 +++---
 tests/oglconform.tests        | 4 ++--
 8 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/framework/environment.py b/framework/environment.py
index a28992b..d26c54a 100644
--- a/framework/environment.py
+++ b/framework/environment.py
@@ -1,4 +1,3 @@
-
 # Permission is hereby granted, free of charge, to any person
 # obtaining a copy of this software and associated documentation
 # files (the "Software"), to deal in the Software without
@@ -27,13 +26,13 @@ import subprocess
 import platform
 
 __all__ = ['Environment',
-           'testBinDir']
+           'TEST_BIN_DIR']
 
 if 'PIGLIT_BUILD_DIR' in os.environ:
-    testBinDir = os.path.join(os.environ['PIGLIT_BUILD_DIR'], 'bin')
+    TEST_BIN_DIR = os.path.join(os.environ['PIGLIT_BUILD_DIR'], 'bin')
 else:
-    testBinDir = os.path.normpath(os.path.join(os.path.dirname(__file__),
-                                               '../bin'))
+    TEST_BIN_DIR = os.path.normpath(os.path.join(os.path.dirname(__file__),
+                                                 '../bin'))
 
 if 'PIGLIT_SOURCE_DIR' not in os.environ:
     os.environ['PIGLIT_SOURCE_DIR'] = \
diff --git a/framework/exectest.py b/framework/exectest.py
index 06e2af7..28f0ea4 100644
--- a/framework/exectest.py
+++ b/framework/exectest.py
@@ -29,7 +29,7 @@ import types
 import re
 
 from core import Test, TestResult
-from framework.environment import testBinDir
+from framework.environment import TEST_BIN_DIR
 
 
 # Platform global variables
@@ -270,8 +270,8 @@ class PlainExecTest(ExecTest):
     """
     def __init__(self, command):
         ExecTest.__init__(self, command)
-        # Prepend testBinDir to the path.
-        self.command[0] = os.path.join(testBinDir, self.command[0])
+        # Prepend TEST_BIN_DIR to the path.
+        self.command[0] = os.path.join(TEST_BIN_DIR, self.command[0])
 
     def interpretResult(self, out, returncode, results, dmesg):
         outlines = out.split('\n')
diff --git a/framework/gleantest.py b/framework/gleantest.py
index bddc0ca..ace9e36 100644
--- a/framework/gleantest.py
+++ b/framework/gleantest.py
@@ -25,10 +25,10 @@ import os
 import subprocess
 
 from core import checkDir, Test, TestResult
-from framework.environment import testBinDir
+from framework.environment import TEST_BIN_DIR
 from exectest import ExecTest
 
-glean_executable = os.path.join(testBinDir, "glean")
+glean_executable = os.path.join(TEST_BIN_DIR, "glean")
 
 # GleanTest: Execute a sub-test of Glean
 class GleanTest(ExecTest):
diff --git a/framework/glsl_parser_test.py b/framework/glsl_parser_test.py
index fe9ae59..26c8063 100755
--- a/framework/glsl_parser_test.py
+++ b/framework/glsl_parser_test.py
@@ -40,7 +40,7 @@ import sys
 
 from ConfigParser import SafeConfigParser
 from core import Test, TestResult
-from framework.environment import testBinDir
+from framework.environment import TEST_BIN_DIR
 from cStringIO import StringIO
 from exectest import PlainExecTest
 
@@ -382,7 +382,7 @@ class GLSLParserTest(PlainExecTest):
             return None
 
         assert(self.config is not None)
-        command = [path.join(testBinDir, 'glslparsertest'),
+        command = [path.join(TEST_BIN_DIR, 'glslparsertest'),
                    self.__filepath,
                    self.config.get('config', 'expect_result'),
                    self.config.get('config', 'glsl_version')
diff --git a/framework/shader_test.py b/framework/shader_test.py
index ccec613..7871cc2 100755
--- a/framework/shader_test.py
+++ b/framework/shader_test.py
@@ -36,7 +36,7 @@ import textwrap
 
 from core import Group, Test, TestResult
 from exectest import PlainExecTest
-from framework.environment import testBinDir, Environment
+from framework.environment import TEST_BIN_DIR, Environment
 
 """This module enables running shader tests.
 
@@ -244,7 +244,7 @@ class ShaderTest(PlainExecTest):
         else:
             assert(False)
 
-        runner = os.path.join(testBinDir, runner)
+        runner = os.path.join(TEST_BIN_DIR, runner)
         self.__command = [runner] + self.__shader_runner_args
         return self.__command
 
diff --git a/tests/es3conform.tests b/tests/es3conform.tests
index 177d599..52b92cd 100644
--- a/tests/es3conform.tests
+++ b/tests/es3conform.tests
@@ -27,7 +27,7 @@ import sys
 from os import path
 from glob import glob
 from framework.core import TestProfile
-from framework.environment import testBinDir
+from framework.environment import TEST_BIN_DIR
 from framework.exectest import ExecTest
 
 #############################################################################
@@ -38,19 +38,19 @@ from framework.exectest import ExecTest
 ##### files into the 'gtf' category.
 #############################################################################
 
-if not path.exists(path.join(testBinDir, 'GTF3')):
+if not path.exists(path.join(TEST_BIN_DIR, 'GTF3')):
     sys.exit(0)
 
 profile = TestProfile()
 
 # Chase the piglit/bin/GTF symlink to find where the tests really live.
-gtfroot = path.dirname(path.realpath(path.join(testBinDir, 'GTF3')))
+gtfroot = path.dirname(path.realpath(path.join(TEST_BIN_DIR, 'GTF3')))
 
 class GTFTest(ExecTest):
     pass_re = re.compile(r'(Conformance|Regression) PASSED all (?P<passed>\d+) tests')
 
     def __init__(self, testpath):
-        ExecTest.__init__(self, [path.join(testBinDir, 'GTF3'), '-minfmt', '-width=113', '-height=47', '-run=' + testpath])
+        ExecTest.__init__(self, [path.join(TEST_BIN_DIR, 'GTF3'), '-minfmt', '-width=113', '-height=47', '-run=' + testpath])
 
     def interpretResult(self, out, returncode, results, dmesg):
         mo = self.pass_re.search(out)
diff --git a/tests/igt.tests b/tests/igt.tests
index cbd28ba..8bd6918 100644
--- a/tests/igt.tests
+++ b/tests/igt.tests
@@ -29,7 +29,7 @@ import subprocess
 
 from os import path
 from framework.core import TestProfile, TestResult
-from framework.environment import testBinDir
+from framework.environment import TEST_BIN_DIR
 from framework.exectest import ExecTest
 
 #############################################################################
@@ -58,12 +58,12 @@ def checkEnvironment():
     print "Test Environment check: Succeeded."
     return True
 
-if not os.path.exists(os.path.join(testBinDir, 'igt')):
+if not os.path.exists(os.path.join(TEST_BIN_DIR, 'igt')):
     print "igt symlink not found!"
     sys.exit(0)
 
 # Chase the piglit/bin/igt symlink to find where the tests really live.
-igtTestRoot = path.join(path.realpath(path.join(testBinDir, 'igt')), 'tests')
+igtTestRoot = path.join(path.realpath(path.join(TEST_BIN_DIR, 'igt')), 'tests')
 
 igtEnvironmentOk = checkEnvironment()
 
diff --git a/tests/oglconform.tests b/tests/oglconform.tests
index 9233d20..4265188 100644
--- a/tests/oglconform.tests
+++ b/tests/oglconform.tests
@@ -27,11 +27,11 @@ import sys
 import subprocess
 
 from framework.core import TestProfile
-from framework.environment import testBinDir
+from framework.environment import TEST_BIN_DIR
 from framework.exectest import ExecTest
 from os import path
 
-bin_oglconform = path.join(testBinDir, 'oglconform')
+bin_oglconform = path.join(TEST_BIN_DIR, 'oglconform')
 
 if not os.path.exists(bin_oglconform):
     sys.exit(0)
-- 
1.8.5.1



More information about the Piglit mailing list