Fix shaders in arb_indirect_parameters/tf-count* tests to use piglit_vertex
[piglit.git] / tests / oglconform.py
blob36adbabdcf8e251064cce835c6c4541398aa06c6
1 #!/usr/bin/env python
2 # coding=utf-8
4 # Permission is hereby granted, free of charge, to any person
5 # obtaining a copy of this software and associated documentation
6 # files (the "Software"), to deal in the Software without
7 # restriction, including without limitation the rights to use,
8 # copy, modify, merge, publish, distribute, sublicense, and/or
9 # sell copies of the Software, and to permit persons to whom the
10 # Software is furnished to do so, subject to the following
11 # conditions:
13 # This permission notice shall be included in all copies or
14 # substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
19 # PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR(S) BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
22 # OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 # DEALINGS IN THE SOFTWARE.
25 import os
26 import re
27 import subprocess
28 import tempfile
30 from framework import grouptools, exceptions, core
31 from framework.profile import TestProfile
32 from framework.test.base import Test
34 __all__ = ['profile']
36 BIN = core.PIGLIT_CONFIG.required_get('oglconform', 'path')
38 if not os.path.exists(BIN):
39 raise exceptions.PiglitFatalError(
40 'Cannot find binary {}'.format(BIN))
43 class OGLCTest(Test):
44 """OGLCTest: Execute a sub-test of the Intel oglconform test suite.
46 To use this, create an 'oglconform' symlink in piglit/bin. Piglit
47 will obtain a list of tests from oglconform and add them all.
49 """
50 skip_re = re.compile(
51 r'no test in schedule is compat|'
52 r'GLSL [13].[345]0 is not supported|'
53 r'wont be scheduled due to lack of compatible fbconfig')
55 def __init__(self, category, subtest):
56 super(OGLCTest, self).__init__([category, subtest])
58 @Test.command.getter
59 def command(self):
60 return [BIN, '-minFmt', '-v', '4', '-test'] + \
61 super(OGLCTest, self).command
63 def interpret_result(self):
64 # Most of what we want to search for is in the last three lines of the
65 # the output
66 split = self.result.out.rsplit('\n', 4)[1:]
67 if 'Total Passed : 1' in split:
68 self.result.result = 'pass'
69 elif 'Total Failed : 1' in split:
70 # This is a fast path to avoid the regular expression.
71 self.result.result = 'fail'
72 elif ('Total Not run: 1' in split or
73 self.skip_re.search(self.result.out) is not None):
74 # Lazy evaluation means that the re (which is slow) is only tried if
75 # the more obvious case is not true
76 self.result.result = 'skip'
77 else:
78 self.result.result = 'fail'
80 super(OGLCTest, self).interpret_result()
83 def _make_profile():
84 """Create and populate a TestProfile instance."""
85 profile_ = TestProfile()
87 with tempfile.NamedTemporaryFile() as f:
88 with open(os.devnull, "w") as d:
89 subprocess.call([BIN, '-generateTestList', f.name],
90 stdout=d, stderr=d)
92 f.seek(0)
94 for l in f.readlines():
95 try:
96 category, test = l.split()
97 except ValueError:
98 continue
100 group = grouptools.join('oglconform', category, test)
101 profile_.test_list[group] = OGLCTest(category, test)
103 return profile_
106 profile = _make_profile() # pylint: disable=invalid-name