Fix corner cases in lit xunit for paths with dots

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223549 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Matthews 2014-12-06 00:21:08 +00:00
parent d46a8180c0
commit 689f10d1b5

View File

@ -200,9 +200,16 @@ class Test:
def getJUnitXML(self):
test_name = self.path_in_suite[-1]
test_path = self.path_in_suite[:-1]
safe_test_path = [x.replace(".","_") for x in test_path]
safe_name = self.suite.name.replace(".","-")
xml = "<testcase classname='" + safe_name + "." + \
"/".join(test_path) + "'" + " name='" + test_name + "'"
if safe_test_path:
class_name = safe_name + "." + "/".join(safe_test_path)
else:
class_name = safe_name
xml = "<testcase classname='" + class_name + "' name='" + \
test_name + "'"
xml += " time='%.2f'" % (self.result.elapsed,)
if self.result.code.isFailure:
xml += ">\n\t<failure >\n" + escape(self.result.output)