[Piglit] [PATCH] framework: Add handler for failure and error when expecting the other
Dylan Baker
baker.dylan.c at gmail.com
Wed Mar 16 00:33:29 UTC 2016
Right now the JUnit backend knows what to do with a failure when it
expects one (or a crash), but not what to do when it expects a failure
and gets a crash (or vice versa).
This patch teaches it what to do in that case, mark the test as a
failure and give a message explaining why.
cc: mark.a.janes at intel.com
signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
framework/backends/junit.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/framework/backends/junit.py b/framework/backends/junit.py
index f9eec66..761b201 100644
--- a/framework/backends/junit.py
+++ b/framework/backends/junit.py
@@ -151,6 +151,12 @@ class JUnitBackend(FileBackend):
err.text += "\n\nWARN: passing test as an expected failure"
res = etree.SubElement(element, 'skipped',
message='expected failure')
+ elif expected_result == 'error':
+ err.text += \
+ "\n\nERROR: Test should have been crash but was failure"
+ res = etree.SubElement(element, 'failure',
+ message='expected crash, but got '
+ 'failure')
else:
res = etree.SubElement(element, 'failure')
@@ -159,6 +165,12 @@ class JUnitBackend(FileBackend):
err.text += "\n\nWARN: passing test as an expected crash"
res = etree.SubElement(element, 'skipped',
message='expected crash')
+ elif expected_result == 'failure':
+ err.text += \
+ "\n\nERROR: Test should have been failure but was crash"
+ res = etree.SubElement(element, 'failure',
+ message='expected failure, but got '
+ 'crash')
else:
res = etree.SubElement(element, 'error')
--
2.7.3
More information about the Piglit
mailing list