diff --git a/utils/lit/lit/Test.py b/utils/lit/lit/Test.py index 9c18d7efc44..9fa9064dc68 100644 --- a/utils/lit/lit/Test.py +++ b/utils/lit/lit/Test.py @@ -1,5 +1,5 @@ import os -from xml.sax.saxutils import escape +from xml.sax.saxutils import quoteattr from json import JSONEncoder from lit.BooleanExpression import BooleanExpression @@ -362,7 +362,7 @@ class Test: def writeJUnitXML(self, fil): """Write the test's report xml representation to a file handle.""" - test_name = escape(self.path_in_suite[-1]) + test_name = quoteattr(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(".","-") @@ -371,7 +371,8 @@ class Test: class_name = safe_name + "." + "/".join(safe_test_path) else: class_name = safe_name + "." + safe_name - testcase_template = "\n\t\n\n".format(skip_message)) + fil.write(">\n\t\n\n".format(quoteattr(skip_message))) else: fil.write("/>") diff --git a/utils/lit/lit/main.py b/utils/lit/lit/main.py index 8b4830a3342..807360ac5b9 100755 --- a/utils/lit/lit/main.py +++ b/utils/lit/lit/main.py @@ -16,6 +16,7 @@ import time import argparse import tempfile import shutil +from xml.sax.saxutils import quoteattr import lit.ProgressBar import lit.LitConfig @@ -610,13 +611,13 @@ def main_with_tmp(builtinParameters): xunit_output_file.write("\n") xunit_output_file.write("\n") for suite_name, suite in by_suite.items(): - safe_suite_name = suite_name.replace(".", "-") - xunit_output_file.write("\n") + safe_suite_name = quoteattr(suite_name.replace(".", "-")) + xunit_output_file.write("\n") for result_test in suite['tests']: result_test.writeJUnitXML(xunit_output_file) diff --git a/utils/lit/tests/shtest-xunit-output.py b/utils/lit/tests/shtest-xunit-output.py index 6e1f1424c83..c724cfa128d 100644 --- a/utils/lit/tests/shtest-xunit-output.py +++ b/utils/lit/tests/shtest-xunit-output.py @@ -4,78 +4,78 @@ # CHECK: # CHECK-NEXT: -# CHECK-NEXT: +# CHECK-NEXT: -# CHECK: +# CHECK: -# CHECK: +# CHECK: # CHECK-NEXT: # CHECK: # CHECK-NEXT: -# CHECK: +# CHECK: # CHECK-NEXT: # CHECK: # CHECK-NEXT: -# CHECK: +# CHECK: -# CHECK: +# CHECK: # CHECK-NEXT: # CHECK: # CHECK-NEXT: -# CHECK: +# CHECK: # CHECK-NEXT: # CHECK: # CHECK-NEXT: -# CHECK: +# CHECK: -# CHECK: +# CHECK: # CHECK-NEXT: -# CHECK: +# CHECK: -# CHECK: +# CHECK: # CHECK-NEXT: -# CHECK: +# CHECK: -# CHECK: +# CHECK: # CHECK-NEXT: # CHECK: # CHECK-NEXT: -# CHECK: +# CHECK: # CHECK-NEXT: -# CHECK: +# CHECK: -# CHECK: +# CHECK: # CHECK-NEXT: -# CHECK: +# CHECK: # CHECK-NEXT: # CHECK: # CHECK-NEXT: -# CHECK: +# CHECK: # CHECK-NEXT: -# CHECK: +# CHECK: -# CHECK: +# CHECK: -# CHECK: +# CHECK: -# CHECK: +# CHECK: -# CHECK: +# CHECK: -# CHECK: +# CHECK: # CHECK-NEXT: # CHECK: # CHECK-NEXT: diff --git a/utils/lit/tests/xunit-output.py b/utils/lit/tests/xunit-output.py index 845ffdb50cf..930768e61da 100644 --- a/utils/lit/tests/xunit-output.py +++ b/utils/lit/tests/xunit-output.py @@ -9,8 +9,8 @@ # CHECK: # CHECK: -# CHECK: -# CHECK: +# CHECK: +# CHECK: # CHECK-NEXT: ]]]]> &"]]> # CHECK: # CHECK: