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
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.
30 from framework
import grouptools
, exceptions
, core
31 from framework
.profile
import TestProfile
32 from framework
.test
.base
import Test
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
))
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.
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
])
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
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'
78 self
.result
.result
= 'fail'
80 super(OGLCTest
, self
).interpret_result()
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
],
94 for l
in f
.readlines():
96 category
, test
= l
.split()
100 group
= grouptools
.join('oglconform', category
, test
)
101 profile_
.test_list
[group
] = OGLCTest(category
, test
)
106 profile
= _make_profile() # pylint: disable=invalid-name