[Piglit] [PATCH 1/9] python: replace testBinDir with TEST_BIN_DIR
Dylan Baker
baker.dylan.c at gmail.com
Wed Apr 9 18:27:19 PDT 2014
>From python's PEP8:
"Constants are usually defined on a module level and written in all
capital letters with underscores separating words. Examples include
MAX_OVERFLOW and TOTAL."
This patch generated with the following shell command:
'find . -name '*py' | xargs sed -i -e 's!testBinDir!TEST_BIN_DIR!g'
Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
framework/exectest.py | 10 +++++-----
framework/gleantest.py | 4 ++--
framework/glsl_parser_test.py | 4 ++--
framework/shader_test.py | 8 ++++----
framework/tests/glsl_parser_test_tests.py | 8 ++++----
tests/es3conform.py | 8 ++++----
tests/igt.py | 6 +++---
tests/oglconform.py | 4 ++--
8 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/framework/exectest.py b/framework/exectest.py
index 6608067..5280f6a 100644
--- a/framework/exectest.py
+++ b/framework/exectest.py
@@ -33,7 +33,7 @@ from .core import TestResult
__all__ = ['Test',
'PiglitTest',
- 'testBinDir']
+ 'TEST_BIN_DIR']
# Platform global variables
if 'PIGLIT_PLATFORM' in os.environ:
@@ -42,9 +42,9 @@ else:
PIGLIT_PLATFORM = ''
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__),
+ TEST_BIN_DIR = os.path.normpath(os.path.join(os.path.dirname(__file__),
'../bin'))
@@ -290,8 +290,8 @@ class PiglitTest(Test):
def __init__(self, *args, **kwargs):
super(PiglitTest, self).__init__(*args, **kwargs)
- # 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):
outlines = out.split('\n')
diff --git a/framework/gleantest.py b/framework/gleantest.py
index 3047e93..29ce324 100644
--- a/framework/gleantest.py
+++ b/framework/gleantest.py
@@ -23,9 +23,9 @@
import os
-from .exectest import Test, testBinDir
+from .exectest import Test, TEST_BIN_DIR
-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(Test):
diff --git a/framework/glsl_parser_test.py b/framework/glsl_parser_test.py
index ef64d50..e996643 100644
--- a/framework/glsl_parser_test.py
+++ b/framework/glsl_parser_test.py
@@ -27,7 +27,7 @@ import os.path as path
import re
from cStringIO import StringIO
-from .exectest import PiglitTest, testBinDir
+from .exectest import PiglitTest, TEST_BIN_DIR
def add_glsl_parser_test(group, filepath, test_name):
@@ -146,7 +146,7 @@ class GLSLParserTest(PiglitTest):
"from config".format(opt))
# Create the command and pass it into a PiglitTest()
- command = [path.join(testBinDir, 'glslparsertest'),
+ command = [path.join(TEST_BIN_DIR, 'glslparsertest'),
filepath,
config.get('config', 'expect_result'),
config.get('config', 'glsl_version')]
diff --git a/framework/shader_test.py b/framework/shader_test.py
index 80d4615..5728100 100644
--- a/framework/shader_test.py
+++ b/framework/shader_test.py
@@ -28,7 +28,7 @@ import os.path as path
import re
from .core import Group
-from .exectest import PiglitTest, testBinDir
+from .exectest import PiglitTest, TEST_BIN_DIR
__all__ = ['add_shader_test', 'add_shader_test_dir']
@@ -66,9 +66,9 @@ class ShaderTest(PiglitTest):
line = line.strip()
if line.startswith('GL ES'):
if line.endswith('3.0'):
- prog = path.join(testBinDir, 'shader_runner_gles3')
+ prog = path.join(TEST_BIN_DIR, 'shader_runner_gles3')
elif line.endswith('2.0'):
- prog = path.join(testBinDir, 'shader_runner_gles2')
+ prog = path.join(TEST_BIN_DIR, 'shader_runner_gles2')
# If we don't set gles2 or gles3 continue the loop,
# probably htting the exception in the for/else
else:
@@ -78,7 +78,7 @@ class ShaderTest(PiglitTest):
# In the event that we reach the end of the config black
# and an API hasn't been found, it's an old test and uses
# "GL"
- prog = path.join(testBinDir, 'shader_runner')
+ prog = path.join(TEST_BIN_DIR, 'shader_runner')
break
else:
raise ShaderTestParserException("No GL version set")
diff --git a/framework/tests/glsl_parser_test_tests.py b/framework/tests/glsl_parser_test_tests.py
index 090308e..5e083b8 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.exectest import testBinDir
+from framework.exectest import TEST_BIN_DIR
def _check_config(content):
@@ -105,7 +105,7 @@ def test_cpp_comments():
'// [end config]\n')
test, name = _check_config(content)
- nt.assert_equal(test.command, [os.path.join(testBinDir, 'glslparsertest'),
+ nt.assert_equal(test.command, [os.path.join(TEST_BIN_DIR, 'glslparsertest'),
name, 'pass', '1.00'],
msg="C++ style comments were not properly parsed")
@@ -120,7 +120,7 @@ def test_c_comments():
' */\n')
test, name = _check_config(content)
- nt.assert_equal(test.command, [os.path.join(testBinDir, 'glslparsertest'),
+ nt.assert_equal(test.command, [os.path.join(TEST_BIN_DIR, 'glslparsertest'),
name, 'pass', '1.00'],
msg="C style comments were not properly parsed")
@@ -135,7 +135,7 @@ def test_blank_in_config():
test, name = _check_config(content)
- nt.assert_equal(test.command, [os.path.join(testBinDir, 'glslparsertest'),
+ nt.assert_equal(test.command, [os.path.join(TEST_BIN_DIR, 'glslparsertest'),
name, 'pass', '1.00'],
msg="A newline in a C++ style comment was not properly "
"parsed.")
diff --git a/tests/es3conform.py b/tests/es3conform.py
index 8302a44..bae964e 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.exectest import Test, testBinDir
+from framework.exectest import Test, TEST_BIN_DIR
__all__ = ['profile']
@@ -39,19 +39,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(Test):
pass_re = re.compile(r'(Conformance|Regression) PASSED all (?P<passed>\d+) tests')
def __init__(self, testpath):
- super(GTFTest, self).__init__([path.join(testBinDir, 'GTF3'),
+ super(GTFTest, self).__init__([path.join(TEST_BIN_DIR, 'GTF3'),
'-minfmt', '-width=113', '-height=47',
'-run=' + testpath])
diff --git a/tests/igt.py b/tests/igt.py
index a8c8219..065ba0c 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.exectest import Test, testBinDir
+from framework.exectest import Test, TEST_BIN_DIR
__all__ = ['profile']
@@ -59,12 +59,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.py b/tests/oglconform.py
index ce3bac6..d0ac541 100644
--- a/tests/oglconform.py
+++ b/tests/oglconform.py
@@ -27,12 +27,12 @@ import sys
import subprocess
from framework.core import TestProfile
-from framework.exectest import Test, testBinDir
+from framework.exectest import Test, TEST_BIN_DIR
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.9.1
More information about the Piglit
mailing list