Commit 229b3b3d authored by Dylan Baker's avatar Dylan Baker

framework/test: Make shader paths relative

Because they need to be relative at build time for serialization.
Tested-by: Rafael Antognolli's avatarRafael Antognolli <>
parent 6fcec59a
......@@ -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__ = [
......@@ -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, mode='r', encoding='utf-8') as shader_file:
with, 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'\n'))
......@@ -183,7 +183,9 @@ class ShaderTest(FastSkipMixin, PiglitBaseTest):
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']
def command(self, new):
......@@ -283,10 +285,12 @@ class MultiShaderTest(ReducedProcessMixin, PiglitBaseTest):
super(MultiShaderTest, self).run()
@PiglitBaseTest.command.getter # pylint: disable=no-member
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:')
......@@ -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)
test =, filename))
test =, filename))
shader_tests[groupname].append(os.path.join(dirpath, filename))
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment