[llvm] r223305 - Don't allow test-suite names with . in them in xml output
Chris Matthews
cmatthews5 at apple.com
Wed Dec 3 14:59:15 PST 2014
Author: cmatthews
Date: Wed Dec 3 16:59:15 2014
New Revision: 223305
URL: http://llvm.org/viewvc/llvm-project?rev=223305&view=rev
Log:
Don't allow test-suite names with . in them in xml output
Modified:
llvm/trunk/utils/lit/lit/Test.py
llvm/trunk/utils/lit/lit/main.py
Modified: llvm/trunk/utils/lit/lit/Test.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/Test.py?rev=223305&r1=223304&r2=223305&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/Test.py (original)
+++ llvm/trunk/utils/lit/lit/Test.py Wed Dec 3 16:59:15 2014
@@ -200,12 +200,13 @@ class Test:
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 + "'"
+ safe_name = self.suite.name.replace(".","-")
+ xml = "<testcase classname='" + safe_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>"
+ xml += ">\n\t<failure >\n" + escape(self.result.output)
+ xml += "\n\t</failure>\n</testcase>"
else:
- xml += "/>"
+ xml += "/>"
return xml
\ No newline at end of file
Modified: llvm/trunk/utils/lit/lit/main.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/main.py?rev=223305&r1=223304&r2=223305&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/main.py (original)
+++ llvm/trunk/utils/lit/lit/main.py Wed Dec 3 16:59:15 2014
@@ -444,7 +444,8 @@ def main(builtinParameters = {}):
xunit_output_file.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n")
xunit_output_file.write("<testsuites>\n")
for suite_name, suite in by_suite.items():
- xunit_output_file.write("<testsuite name='" + suite_name + "'")
+ safe_suite_name = suite_name.replace(".", "-")
+ xunit_output_file.write("<testsuite name='" + safe_suite_name + "'")
xunit_output_file.write(" tests='" + str(suite['passes'] +
suite['failures']) + "'")
xunit_output_file.write(" failures='" + str(suite['failures']) +
More information about the llvm-commits
mailing list