diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2016-05-31 14:06:58 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2016-06-30 12:21:45 -0700 |
commit | 5123f2ee3eae75c4ec270d79f7ccdb050763cbfe (patch) | |
tree | 98ee3aea3c64816d2f95c87a6d3feab76c2e5f07 /framework/test | |
parent | c60f2172be9e7ed6239c1c07f86b9ef400548647 (diff) |
framework: make the interpret_result method for native tests faster
This reimplements the interpret_result method of PiglitBaseTest (which
is used by all native piglit tests) to loop once rather than twice.
There is a speedup of about 3 seconds for 10,000 iterations. Being that
piglit runs about 30,000 tests that is something, for a pretty
reasonable patch.
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Diffstat (limited to 'framework/test')
-rw-r--r-- | framework/test/piglit_test.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py index 32a991b1a..73bf65344 100644 --- a/framework/test/piglit_test.py +++ b/framework/test/piglit_test.py @@ -25,9 +25,9 @@ from __future__ import ( absolute_import, division, print_function, unicode_literals ) +import glob import os import sys -import glob try: import simplejson as json except ImportError: @@ -68,14 +68,15 @@ class PiglitBaseTest(ValgrindMixin, Test): self._command[0] = os.path.join(TEST_BIN_DIR, self._command[0]) def interpret_result(self): - outlines = self.result.out.split('\n') - outpiglit = (s[7:] for s in outlines if s.startswith('PIGLIT:')) - - # FIXME: handle this properly. It needs a method in TestResult probably - for piglit in outpiglit: - self.result.update(json.loads(piglit)) - self.result.out = '\n'.join( - s for s in outlines if not s.startswith('PIGLIT:')) + out = [] + + for each in self.result.out.split('\n'): + if each.startswith('PIGLIT:'): + self.result.update(json.loads(each[8:])) + else: + out.append(each) + + self.result.out = '\n'.join(out) super(PiglitBaseTest, self).interpret_result() |