[Piglit] [PATCH 3/3] framework: fix loading JUnit results
Dylan Baker
dylan at pnwbakers.com
Tue Oct 25 19:54:03 UTC 2016
The JUnit loader was never updated to handle PID's as lists rather than
a single int. This patch corrects that and allows JUnit results to be
loaded again.
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
framework/backends/junit.py | 6 +++++-
unittests/framework/backends/test_junit.py | 6 +++---
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/framework/backends/junit.py b/framework/backends/junit.py
index 4c9b7af..018cecd 100644
--- a/framework/backends/junit.py
+++ b/framework/backends/junit.py
@@ -29,6 +29,10 @@ try:
from lxml import etree
except ImportError:
import xml.etree.cElementTree as etree
+try:
+ import simplejson as json
+except ImportError:
+ import json
import six
@@ -396,7 +400,7 @@ def _load(results_file):
result.time.end = float(line[len('time end: '):])
continue
elif line.startswith('pid:'):
- result.pid = int(line[len('pid: '):])
+ result.pid = json.loads(line[len('pid: '):])
continue
diff --git a/unittests/framework/backends/test_junit.py b/unittests/framework/backends/test_junit.py
index 6bc9e6a..06892ca 100644
--- a/unittests/framework/backends/test_junit.py
+++ b/unittests/framework/backends/test_junit.py
@@ -56,7 +56,7 @@ _XML = """\
<system-out>this/is/a/command\nThis is stdout</system-out>
<system-err>this is stderr
-pid: 1934
+pid: [1934]
time start: 1.0
time end: 4.5
</system-err>
@@ -152,7 +152,7 @@ class TestProtectedLoad(object):
expected = textwrap.dedent("""\
this is stderr
- pid: 1934
+ pid: [1934]
time start: 1.0
time end: 4.5""")
assert result.tests[self.testname].err.strip() == expected
@@ -163,7 +163,7 @@ class TestProtectedLoad(object):
def test_pid(self, result):
"""backends.junit._load: pid is loaded correctly."""
- assert result.tests[self.testname].pid == 1934
+ assert result.tests[self.testname].pid == [1934]
class TestJUnitBackend(object):
--
2.10.1
More information about the Piglit
mailing list