[Piglit] [PATCH 2/3] junit.py: Add piglit failure to junit ouput

Dylan Baker baker.dylan.c at gmail.com
Thu Oct 2 17:00:00 PDT 2014


This makes use of the result type field in the junit to add the piglit
failure type (crash, warn, fail, etc)

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/backends/junit.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/framework/backends/junit.py b/framework/backends/junit.py
index 6115e34..5cc0c6d 100644
--- a/framework/backends/junit.py
+++ b/framework/backends/junit.py
@@ -122,6 +122,7 @@ class JUnitBackend(FileBackend):
             if lname in self._expected_crashes:
                 expected_result = "error"
 
+            res = None
             # Add relevant result value, if the result is pass then it doesn't
             # need one of these statuses
             if data['result'] == 'skip':
@@ -131,18 +132,22 @@ class JUnitBackend(FileBackend):
                 if expected_result == "failure":
                     err.text += "\n\nWARN: passing test as an expected failure"
                 else:
-                    etree.SubElement(element, 'failure')
+                    res = etree.SubElement(element, 'failure')
 
             elif data['result'] == 'crash':
                 if expected_result == "error":
                     err.text += "\n\nWARN: passing test as an expected crash"
                 else:
-                    etree.SubElement(element, 'error')
+                    res = etree.SubElement(element, 'error')
 
             elif expected_result != "pass":
                 err.text += "\n\nERROR: This test passed when it "\
                             "expected {0}".format(expected_result)
-                etree.SubElement(element, 'failure')
+                res = etree.SubElement(element, 'failure')
+
+            # Add the piglit type to the failure result
+            if res is not None:
+                res.attrib['type'] = str(data['result'])
 
         # Split the name of the test and the group (what junit refers to as
         # classname), and replace piglits '/' separated groups with '.', after
-- 
2.1.1



More information about the Piglit mailing list