[Piglit] [PATCH 2/5] deqp: make single and multi mode have similar interpret results
Dylan Baker
baker.dylan.c at gmail.com
Thu Mar 24 18:43:02 UTC 2016
This allows more code sharing, and gives them consistent behavior.
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
framework/test/deqp.py | 55 ++++++++++++++++----------------------
unittests/deqp_tests.py | 70 +++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 91 insertions(+), 34 deletions(-)
diff --git a/framework/test/deqp.py b/framework/test/deqp.py
index e848aeb..1ed594a 100644
--- a/framework/test/deqp.py
+++ b/framework/test/deqp.py
@@ -164,14 +164,16 @@ def iter_deqp_test_cases(case_file):
@six.add_metaclass(abc.ABCMeta)
class DEQPBaseTest(Test):
- __RESULT_MAP = {
- "Pass": "pass",
- "Fail": "fail",
- "QualityWarning": "warn",
- "InternalError": "fail",
- "Crash": "crash",
- "NotSupported": "skip",
- "ResourceError": "crash",
+ # This a very hot path, a small speed optimization can be had by shortening
+ # this match to just one character
+ _RESULT_MAP = {
+ "P": status.PASS, # Pass
+ "F": status.FAIL, # Fail
+ "Q": status.WARN, # QualityWarnings
+ "I": status.FAIL, # InternalError
+ "C": status.CRASH, # Crash
+ "N": status.SKIP, # NotSupported
+ "R": status.CRASH, # ResourceError
}
@abc.abstractproperty
@@ -204,24 +206,25 @@ class DEQPBaseTest(Test):
command = super(DEQPBaseTest, self).command
return command + self.extra_args
- def __find_map(self):
- """Run over the lines and set the result."""
- # splitting this into a separate function allows us to return cleanly,
- # otherwise this requires some break/else/continue madness
- for line in self.result.out.split('\n'):
- line = line.lstrip()
- for k, v in six.iteritems(self.__RESULT_MAP):
- if line.startswith(k):
- self.result.result = v
- return
-
def interpret_result(self):
if is_crash_returncode(self.result.returncode):
self.result.result = 'crash'
elif self.result.returncode != 0:
self.result.result = 'fail'
else:
- self.__find_map()
+ # Strip the first 3 lines, which are useless
+ cur = ''
+ lines = (l for l in self.result.out.rstrip().split('\n')[3:-8])
+ for l in lines:
+ # If there is an info block fast forward through it by calling
+ # next on the generator until it is passed.
+ if l.startswith('INFO'):
+ while not (cur.startswith('INFO') and cur.endswith('----')):
+ cur = next(lines)
+ l = cur
+
+ if l.startswith(' '):
+ self.result.result = self._RESULT_MAP[l[2]]
# We failed to parse the test output. Fallback to 'fail'.
if self.result.result == 'notrun':
@@ -233,18 +236,6 @@ class DEQPGroupTest(DEQPBaseTest):
__name_slicer = slice(len("Test case '"), -len("'.."))
__finder = re.compile(r'^ (Warnings|Not supported|Failed|Passed):\s+\d/(?P<total>\d+).*')
- # This a very hot path, a small speed optimization can be had by shortening
- # this match to just one character
- _RESULT_MAP = {
- "P": status.PASS, # Pass
- "F": status.FAIL, # Fail
- "Q": status.WARN, # QualityWarnings
- "I": status.FAIL, # InternalError
- "C": status.CRASH, # Crash
- "N": status.SKIP, # NotSupported
- "R": status.CRASH, # ResourceError
- }
-
def __init__(self, case_name, **kwargs):
super(DEQPGroupTest, self).__init__(case_name + '*', **kwargs)
diff --git a/unittests/deqp_tests.py b/unittests/deqp_tests.py
index c7cc5e4..f3b243e 100644
--- a/unittests/deqp_tests.py
+++ b/unittests/deqp_tests.py
@@ -203,8 +203,8 @@ class TestDEQPBaseTestIntepretResultStatus(object):
self.inst = None
__OUT = textwrap.dedent("""\
- dEQP Core 2014.x (0xcafebabe) starting..
- target implementation = 'DRM'
+ dEQP Core unknown (0xcafebabe) starting..
+ target implementation = 'X11 GLX'
Test case 'dEQP-GLES2.functional.shaders.conversions.vector_to_vector.vec3_to_ivec3_fragment'..
Vertex shader compile time = 0.129000 ms
@@ -282,6 +282,72 @@ class TestDEQPBaseTestIntepretResultStatus(object):
nt.eq_(self.inst.result.result, 'crash')
+def test_DEQPBaseTest_interpret_result_cts():
+ """test.deqp.DEQPBaseTest.interpret_result: Handles CTS shader dumps."""
+ # The following is just something that looks kind of like a CTS shader, the
+ # point is that the layout doesn't trip up the intepret_result method
+ out = textwrap.dedent("""\
+ dEQP Core GL-CTS-2.0 (0x0052484b) starting..
+ target implementation = 'intel-gbm'
+
+ Test case 'A.Test.case'..
+ INFO:a test-------------------------------- BEGIN ---------------------------------
+ INFO:a test
+
+ [VERTEX SHADER]
+
+ #version foobar
+ #ifdef something
+ in something
+ INFO:mo stuff:
+
+ [FRAGMENT SHADER]
+
+ #version 300 es
+ precision highp int;
+
+ struct S {
+ vec4 foo;
+ vec2 fo[2];
+ };
+ layout(std140) uniform UB0 {
+ S x;
+ S y[2];
+ } ub0;
+ INFO:even more stuff:
+
+ [VERTEX SHADER]
+
+ #version 300 es
+ bool something () {
+ if (thing) { do! }
+ INFO:and even more stuff:
+
+ [FRAGMENT SHADER]
+
+ #version 300 es
+ precision highp int;
+
+ INFO:a test:OK
+ INFO:a test:--------------------------------- END ----------------------------------
+ Pass (Pass)
+
+ DONE!
+
+ Test run totals:
+ Passed: 1/1 (100.00%)
+ Failed: 0/1 (0.00%)
+ Not supported: 0/1 (0.00%)
+ Warnings: 0/1 (0.00%)
+ """)
+
+ test = _DEQPTestTest('foo')
+ test.result.out = out
+ test.result.returncode = 0
+ test.interpret_result()
+ nt.eq_(test.result.result, 'pass')
+
+
class TestDEQPGroupTest_interpret_result(object):
__out = textwrap.dedent("""
dEQP Core unknown (0xcafebabe) starting..
--
2.7.4
More information about the Piglit
mailing list