summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-03-27 16:19:53 -0700
committerDylan Baker <dylan@pnwbakers.com>2018-05-01 14:28:41 -0700
commit229b3b3de75d1cb60589d40cedadbcca91235f73 (patch)
treeb5e7c71c38786a731569d055ba3c724d9b8c5e29
parent6fcec59a050da7b53b2507c739c923dc47749283 (diff)
framework/test: Make shader paths relative
Because they need to be relative at build time for serialization. Tested-by: Rafael Antognolli <rafael.antognolli@intel.com>
-rw-r--r--framework/test/shader_test.py16
-rw-r--r--tests/all.py7
2 files changed, 15 insertions, 8 deletions
diff --git a/framework/test/shader_test.py b/framework/test/shader_test.py
index 3dc2c3987..dbad16be6 100644
--- a/framework/test/shader_test.py
+++ b/framework/test/shader_test.py
@@ -34,7 +34,7 @@ from framework import exceptions
from framework import status
from .base import ReducedProcessMixin, TestIsSkip
from .opengl import FastSkipMixin, FastSkip
-from .piglit_test import PiglitBaseTest
+from .piglit_test import PiglitBaseTest, ROOT_DIR
__all__ = [
'ShaderTest',
@@ -67,7 +67,7 @@ class Parser(object):
# cost. The first one looks for the start of the config block or raises
# an exception. The second looks for the GL version or raises an
# exception
- with io.open(self.filename, mode='r', encoding='utf-8') as shader_file:
+ with io.open(os.path.join(ROOT_DIR, self.filename), 'r', encoding='utf-8') as shader_file:
# The mock in python 3.3 doesn't support readlines(), so use
# read().split() as a workaround
lines = (l for l in shader_file.read().split('\n'))
@@ -183,7 +183,9 @@ class ShaderTest(FastSkipMixin, PiglitBaseTest):
@PiglitBaseTest.command.getter
def command(self):
""" Add -auto and -fbo to the test command """
- return self._command + ['-auto', '-fbo']
+ command = super(ShaderTest, self).command
+ shaderfile = os.path.join(ROOT_DIR, command[1])
+ return [command[0]] + [shaderfile, '-auto', '-fbo']
@command.setter
def command(self, new):
@@ -283,10 +285,12 @@ class MultiShaderTest(ReducedProcessMixin, PiglitBaseTest):
self._process_skips()
super(MultiShaderTest, self).run()
- @PiglitBaseTest.command.getter # pylint: disable=no-member
+ @PiglitBaseTest.command.getter
def command(self):
- """Add -auto to the test command."""
- return self._command + ['-auto', '-report-subtests']
+ command = super(MultiShaderTest, self).command
+ shaderfiles = (x for x in command[1:] if not x.startswith('-'))
+ shaderfiles = [os.path.join(ROOT_DIR, s) for s in shaderfiles]
+ return [command[0]] + shaderfiles + ['-auto', '-report-subtests']
def _is_subtest(self, line):
return line.startswith('PIGLIT TEST:')
diff --git a/tests/all.py b/tests/all.py
index b9f34b8b7..5f1b63a57 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -21,7 +21,9 @@ from framework.driver_classifier import DriverClassifier
from framework.test import (PiglitGLTest, PiglitBaseTest,
GLSLParserTest, GLSLParserNoConfigError)
from framework.test.shader_test import ShaderTest, MultiShaderTest
-from framework.test.piglit_test import ASMParserTest, BuiltInConstantsTest
+from framework.test.piglit_test import (
+ ASMParserTest, BuiltInConstantsTest, ROOT_DIR
+)
from .py_modules.constants import TESTS_DIR, GENERATED_TESTS_DIR
__all__ = ['profile']
@@ -304,8 +306,9 @@ for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
for filename in filenames:
testname, ext = os.path.splitext(filename)
if ext == '.shader_test':
+ dirname = os.path.relpath(dirpath, ROOT_DIR)
if PROCESS_ISOLATION:
- test = ShaderTest.new(os.path.join(dirpath, filename))
+ test = ShaderTest.new(os.path.join(dirname, filename))
else:
shader_tests[groupname].append(os.path.join(dirpath, filename))
continue