aboutsummaryrefslogtreecommitdiffstats
path: root/utils/lit/lit/Test.py
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2015-01-09 02:03:04 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-01-09 02:03:04 +0000
commit1c957c198aab1b6d4f1ca9147f15107e96d091af (patch)
tree277a769861baf9a7f86af5e455d060e11a1455e2 /utils/lit/lit/Test.py
parent841dca40d8ebbeb0f2265c750d142e4f17e39189 (diff)
parent23910ec0b0880243bf3733504c8308b304a2bdd3 (diff)
downloadexternal_llvm-1c957c198aab1b6d4f1ca9147f15107e96d091af.zip
external_llvm-1c957c198aab1b6d4f1ca9147f15107e96d091af.tar.gz
external_llvm-1c957c198aab1b6d4f1ca9147f15107e96d091af.tar.bz2
am 23910ec0: am 2ce42da6: Merge "Give lit a --xunit-xml-output option for saving results in xunit format"
* commit '23910ec0b0880243bf3733504c8308b304a2bdd3': Give lit a --xunit-xml-output option for saving results in xunit format
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