aboutsummaryrefslogtreecommitdiffstats
path: root/utils/lit/lit/Test.py
diff options
context:
space:
mode:
Diffstat (limited to 'utils/lit/lit/Test.py')
-rw-r--r--utils/lit/lit/Test.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/utils/lit/lit/Test.py b/utils/lit/lit/Test.py
index e51bf12..2e0f478 100644
--- a/utils/lit/lit/Test.py
+++ b/utils/lit/lit/Test.py
@@ -1,4 +1,5 @@
import os
+from xml.sax.saxutils import escape
# Test result codes.
@@ -194,3 +195,17 @@ class Test:
return True
return False
+
+
+ def getJUnitXML(self):
+ test_name = self.path_in_suite[-1]
+ test_path = self.path_in_suite[:-1]
+
+ xml = "<testcase classname='" + self.suite.name + "." + "/".join(test_path) + "'" + " name='" + test_name + "'"
+ xml += " time='%.2f'" % (self.result.elapsed,)
+ if self.result.code.isFailure:
+ xml += ">\n\t<failure >\n" + escape(self.result.output)
+ xml += "\n\t</failure>\n</testcase>"
+ else:
+ xml += "/>"
+ return xml \ No newline at end of file