glsl-1.10: test mesa bug with forward declaration
[piglit.git] / tests / glslparser.py
bloba56981ef7f4ee2a000813d40fcb01ecd2c31f337
1 # coding=utf-8
2 """A profile that runs only GLSLParserTest instances."""
4 import os
6 from framework import grouptools
7 from framework.profile import TestProfile
8 from framework.test.glsl_parser_test import GLSLParserTest, GLSLParserNoConfigError
9 from framework.test.piglit_test import ASMParserTest, ROOT_DIR
10 from .py_modules.constants import GENERATED_TESTS_DIR, TESTS_DIR
12 __all__ = ['profile']
14 profile = TestProfile()
16 # Find and add all shader tests.
17 basepath = os.path.normpath(os.path.join(TESTS_DIR, '..'))
18 gen_basepath = os.path.relpath(os.path.join(GENERATED_TESTS_DIR, '..'), basepath)
20 for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
21 isgenerated = basedir == GENERATED_TESTS_DIR
22 for dirpath, _, filenames in os.walk(basedir):
23 groupname = grouptools.from_path(os.path.relpath(dirpath, basedir))
24 for filename in filenames:
25 testname, ext = os.path.splitext(filename)
26 if ext in ['.vert', '.tesc', '.tese', '.geom', '.frag', '.comp']:
27 dirname = os.path.relpath(dirpath, basepath)
28 filepath = os.path.join(dirname, filename)
29 if isgenerated:
30 installpath = os.path.relpath(filepath, gen_basepath)
31 else:
32 installpath = None
34 try:
35 test = GLSLParserTest.new(filepath, installpath)
36 except GLSLParserNoConfigError:
37 # In the event that there is no config assume that it is a
38 # legacy test, and continue
39 continue
41 # For glslparser tests you can have multiple tests with the
42 # same name, but a different stage, so keep the extension.
43 testname = filename
44 else:
45 continue
47 group = grouptools.join(groupname, testname)
48 assert group not in profile.test_list, group
50 profile.test_list[group] = test
52 # Collect and add all asmparsertests
53 for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
54 _basedir = os.path.join(basedir, 'asmparsertest', 'shaders')
55 for dirpath, _, filenames in os.walk(_basedir):
56 base_group = grouptools.from_path(os.path.join(
57 'asmparsertest', os.path.relpath(dirpath, _basedir)))
58 type_ = os.path.basename(dirpath)
60 dirname = os.path.relpath(dirpath, os.path.join(basedir, '..'))
61 for filename in filenames:
62 if not os.path.splitext(filename)[1] == '.txt':
63 continue
65 group = grouptools.join(base_group, filename)
66 profile.test_list[group] = ASMParserTest(
67 type_, os.path.join(dirname, filename))