Commit 5fa0abc6 authored by Dylan Baker's avatar Dylan Baker

framework/test: use relative paths for GLSLParser tests

Tested-by: Rafael Antognolli's avatarRafael Antognolli <rafael.antognolli@intel.com>
parent 229b3b3d
......@@ -33,7 +33,7 @@ import six
from framework import exceptions
from .base import TestIsSkip
from .opengl import FastSkipMixin
from .piglit_test import PiglitBaseTest, TEST_BIN_DIR
from .piglit_test import PiglitBaseTest, TEST_BIN_DIR, ROOT_DIR
__all__ = [
'GLSLParserTest',
......@@ -95,11 +95,12 @@ class Parser(object):
self.gl_required = set()
self.glsl_es_version = None
self.glsl_version = None
abs_filepath = os.path.join(ROOT_DIR, filepath)
try:
with io.open(filepath, mode='r', encoding='utf-8') as testfile:
with io.open(abs_filepath, mode='r', encoding='utf-8') as testfile:
testfile = testfile.read()
self.config = self.parse(testfile, filepath)
self.config = self.parse(testfile, abs_filepath)
self.command = self.get_command(filepath)
except GLSLParserInternalError as e:
raise exceptions.PiglitFatalError(
......@@ -278,6 +279,12 @@ class GLSLParserTest(FastSkipMixin, PiglitBaseTest):
command, run_concurrent=True, gl_required=gl_required,
glsl_version=glsl_version, glsl_es_version=glsl_es_version)
@PiglitBaseTest.command.getter
def command(self):
command = super(GLSLParserTest, self).command
glslfile = os.path.join(ROOT_DIR, command[1])
return [command[0], glslfile] + command[2:]
@classmethod
def new(cls, filepath):
parsed = Parser(filepath)
......
......@@ -305,8 +305,8 @@ for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
groupname = grouptools.from_path(os.path.relpath(dirpath, basedir))
for filename in filenames:
testname, ext = os.path.splitext(filename)
dirname = os.path.relpath(dirpath, ROOT_DIR)
if ext == '.shader_test':
dirname = os.path.relpath(dirpath, ROOT_DIR)
if PROCESS_ISOLATION:
test = ShaderTest.new(os.path.join(dirname, filename))
else:
......@@ -314,7 +314,7 @@ for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
continue
elif ext in ['.vert', '.tesc', '.tese', '.geom', '.frag', '.comp']:
try:
test = GLSLParserTest.new(os.path.join(dirpath, filename))
test = GLSLParserTest.new(os.path.join(dirname, filename))
except GLSLParserNoConfigError:
# In the event that there is no config assume that it is a
# legacy test, and continue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment