[Piglit] [Patch V2 2/6] Replace testBinDir with pep8 compliant TEST_BIN_DIR
Dylan Baker
baker.dylan.c at gmail.com
Mon Jan 13 15:09:33 PST 2014
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 | 6 +++---
framework/exectest.py | 6 +++---
framework/gleantest.py | 4 ++--
framework/glsl_parser_test.py | 4 ++--
framework/shader_test.py | 4 ++--
tests/es3conform.py | 8 ++++----
tests/igt.py | 6 +++---
tests/oglconfirm.py | 4 ++--
8 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/framework/environment.py b/framework/environment.py
index e46a6cb..d795de6 100644
--- a/framework/environment.py
+++ b/framework/environment.py
@@ -23,12 +23,12 @@ import subprocess
import platform
__all__ = ['Environment',
- 'testBinDir']
+ 'TEST_BIN_DIR']
if 'PIGLIT_BUILD_DIR' in os.environ:
- testBinDir = path.join(environ['PIGLIT_BUILD_DIR'], 'bin')
+ TEST_BIN_DIR = path.join(environ['PIGLIT_BUILD_DIR'], 'bin')
else:
- testBinDir = path.normpath(path.join(path.dirname(__file__), '../bin'))
+ TEST_BIN_DIR = path.normpath(path.join(path.dirname(__file__), '../bin'))
if 'PIGLIT_SOURCE_DIR' not in os.environ:
os.environ['PIGLIT_SOURCE_DIR'] = path.abspath(
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 e51f2f8..0f7d5cc 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.py b/tests/es3conform.py
index 307a3aa..1e7a238 100644
--- a/tests/es3conform.py
+++ b/tests/es3conform.py
@@ -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
__all__ = ['profile']
@@ -40,19 +40,19 @@ __all__ = ['profile']
##### 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.py b/tests/igt.py
index c76b242..f9369b1 100644
--- a/tests/igt.py
+++ b/tests/igt.py
@@ -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
__all__ = ['profile']
@@ -60,12 +60,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/oglconfirm.py b/tests/oglconfirm.py
index 82c6963..d500e39 100644
--- a/tests/oglconfirm.py
+++ b/tests/oglconfirm.py
@@ -27,13 +27,13 @@ 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
__all__ = ['profile']
-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.2
More information about the Piglit
mailing list