summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-04-03 10:40:08 -0700
committerDylan Baker <dylan@pnwbakers.com>2018-05-01 14:31:40 -0700
commit2f2c0cbd2e0515fbd23828d5727fe4def4e40b7d (patch)
tree7c1d56f199231924991788da68f906d2214b4d55
parent8786e15481e658a91c99a5bb7c3b81f239bb7a96 (diff)
fix glslparser test for out of tree builds
Tested-by: Rafael Antognolli <rafael.antognolli@intel.com>
-rw-r--r--framework/test/glsl_parser_test.py19
-rw-r--r--tests/glslparser.py13
2 files changed, 24 insertions, 8 deletions
diff --git a/framework/test/glsl_parser_test.py b/framework/test/glsl_parser_test.py
index 88646c97f..8840c2de8 100644
--- a/framework/test/glsl_parser_test.py
+++ b/framework/test/glsl_parser_test.py
@@ -89,7 +89,7 @@ class Parser(object):
_CONFIG_KEYS = frozenset(['expect_result', 'glsl_version',
'require_extensions', 'check_link'])
- def __init__(self, filepath):
+ def __init__(self, filepath, installpath=None):
# a set that stores a list of keys that have been found already
self.__found_keys = set()
self.gl_required = set()
@@ -101,7 +101,7 @@ class Parser(object):
with io.open(abs_filepath, mode='r', encoding='utf-8') as testfile:
testfile = testfile.read()
self.config = self.parse(testfile, abs_filepath)
- self.command = self.get_command(filepath)
+ self.command = self.get_command(filepath, installpath)
except GLSLParserInternalError as e:
raise exceptions.PiglitFatalError(
'In file "{}":\n{}'.format(filepath, six.text_type(e)))
@@ -153,7 +153,7 @@ class Parser(object):
else:
return 'glslparsertest'
- def get_command(self, filepath):
+ def get_command(self, filepath, installpath):
""" Create the command argument to pass to super()
This private helper creates a configparser object, then reads in the
@@ -172,7 +172,7 @@ class Parser(object):
glsl = self.config['glsl_version']
command = [
self.pick_binary(glsl),
- filepath,
+ installpath or filepath,
self.config['expect_result'],
self.config['glsl_version']
]
@@ -282,8 +282,15 @@ class GLSLParserTest(FastSkipMixin, PiglitBaseTest):
return [command[0], glslfile] + command[2:]
@classmethod
- def new(cls, filepath):
- parsed = Parser(filepath)
+ def new(cls, filepath, installpath=None):
+ """Parse a file and create an instance.
+
+ :param str filepath: the file to parse
+ :param Optional[str] installpath:
+ The relative path the file will be isntalled to if different than
+ filepath
+ """
+ parsed = Parser(filepath, installpath)
return cls(
parsed.command,
gl_required=parsed.gl_required,
diff --git a/tests/glslparser.py b/tests/glslparser.py
index 9d50dabdf..b7de9f699 100644
--- a/tests/glslparser.py
+++ b/tests/glslparser.py
@@ -17,15 +17,24 @@ profile = TestProfile()
# Find and add all shader tests.
basepath = os.path.normpath(os.path.join(TESTS_DIR, '..'))
+gen_basepath = os.path.relpath(os.path.join(GENERATED_TESTS_DIR, '..'), basepath)
+
for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
+ isgenerated = basedir == GENERATED_TESTS_DIR
for dirpath, _, filenames in os.walk(basedir):
groupname = grouptools.from_path(os.path.relpath(dirpath, basedir))
for filename in filenames:
testname, ext = os.path.splitext(filename)
if ext in ['.vert', '.tesc', '.tese', '.geom', '.frag', '.comp']:
+ dirname = os.path.relpath(dirpath, basepath)
+ filepath = os.path.join(dirname, filename)
+ if isgenerated:
+ installpath = os.path.relpath(filepath, gen_basepath)
+ else:
+ installpath = None
+
try:
- test = GLSLParserTest.new(
- os.path.join(os.path.relpath(dirpath, basepath), filename))
+ test = GLSLParserTest.new(filepath, installpath)
except GLSLParserNoConfigError:
# In the event that there is no config assume that it is a
# legacy test, and continue