llvm.org GIT mirror llvm / 9e38e3e
Escape ]]> in xunit xml output Summary: This sequence ends the CDATA block so any characters after that are no longer escaped. This can be fixed by replacing "]]>" with "]]]]><![CDATA[>". Reviewers: cmatthews Reviewed By: cmatthews Differential Revision: https://reviews.llvm.org/D46886 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332440 91177308-0d34-0410-b5e6-96231b3b80d8 Alexander Richardson 1 year, 4 months ago
3 changed file(s) with 8 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
380380 encoded_output = self.result.output.encode("utf-8", 'ignore')
381381 else:
382382 encoded_output = self.result.output
383 fil.write(encoded_output)
383 # In the unlikely case that the output contains the CDATA terminator
384 # we wrap it by creating a new CDATA block
385 fil.write(encoded_output.replace("]]>", "]]]]>"))
384386 fil.write("]]>\n")
385387 elif self.result.code == UNSUPPORTED:
386388 unsupported_features = self.getMissingRequiredFeatures()
0 [global]
11 result_code = FAIL
2 result_output = & < > "
2 result_output = & < > ]]> &"
33
44 [results]
55 value0 = 1
6 value1 = 2.3456
6 value1 = 2.3456
0 # Check xunit output
11 # RUN: rm -rf %t.xunit.xml
22 # RUN: not %{lit} --xunit-xml-output %t.xunit.xml %{inputs}/xunit-output
3 # If xmllint is installed verify that the generated xml is well-formed
4 # RUN: sh -c 'if command -v xmllint 2>/dev/null; then xmllint --noout %t.xunit.xml; fi'
35 # RUN: FileCheck < %t.xunit.xml %s
46
57 # CHECK:
68 # CHECK:
79 # CHECK:
810 # CHECK:
9 # CHECK-NEXT: "]]>
11 # CHECK-NEXT: ]]]]> &"]]>
1012 # CHECK:
1113 # CHECK: