1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

[lit] Fix a bug where UNRESOLVED tests were not handled in the XUnit

XML printer.

A test has been added that tries to comprehensively test emitting
XUnit XML output for shell tests.

Differential Revision: https://reviews.llvm.org/D45567

llvm-svn: 330409
This commit is contained in:
Dan Liew 2018-04-20 10:11:41 +00:00
parent faa1097556
commit 63cbec945c
2 changed files with 80 additions and 1 deletions

View File

@ -373,7 +373,8 @@ class Test:
xml = "<testcase classname='" + class_name + "' name='" + \
test_name + "'"
xml += " time='%.2f'" % (self.result.elapsed,)
xml += " time='{:.2f}'".format(
self.result.elapsed if self.result.elapsed is not None else 0.0)
if self.result.code.isFailure:
xml += ">\n\t<failure >\n" + escape(self.result.output)
xml += "\n\t</failure>\n</testcase>"

View File

@ -0,0 +1,78 @@
# RUN: not %{lit} -j 1 -v %{inputs}/shtest-format - --xunit-xml-output %t.xml
# RUN: FileCheck < %t.xml %s
# CHECK: <?xml version="1.0" encoding="UTF-8" ?>
# CHECK-NEXT: <testsuites>
# CHECK-NEXT: <testsuite name='shtest-format' tests='23' failures='7'>
# CHECK: <testcase classname='shtest-format.shtest-format' name='argv0.txt' time='{{[0-9]+\.[0-9]+}}'/>
# CHECK: <testcase classname='shtest-format.external_shell' name='fail.txt' time='{{[0-9]+\.[0-9]+}}'>
# CHECK-NEXT: <failure{{[ ]*}}>
# CHECK: </failure>
# CHECK-NEXT: </testcase>
# CHECK: <testcase classname='shtest-format.external_shell' name='fail_with_bad_encoding.txt' time='{{[0-9]+\.[0-9]+}}'>
# CHECK-NEXT: <failure{{[ ]*}}>
# CHECK: </failure>
# CHECK-NEXT: </testcase>
# CHECK: <testcase classname='shtest-format.external_shell' name='pass.txt' time='{{[0-9]+\.[0-9]+}}'/>
# CHECK: <testcase classname='shtest-format.shtest-format' name='fail.txt' time='{{[0-9]+\.[0-9]+}}'>
# CHECK-NEXT: <failure{{[ ]*}}>
# CHECK: </failure>
# CHECK-NEXT: </testcase>
# CHECK: <testcase classname='shtest-format.shtest-format' name='no-test-line.txt' time='{{[0-9]+\.[0-9]+}}'>
# CHECK-NEXT: <failure{{[ ]*}}>
# CHECK: </failure>
# CHECK-NEXT: </testcase>
# CHECK: <testcase classname='shtest-format.shtest-format' name='pass.txt' time='{{[0-9]+\.[0-9]+}}'/>
# CHECK: <testcase classname='shtest-format.shtest-format' name='requires-any-missing.txt' time='{{[0-9]+\.[0-9]+}}'/>
# CHECK: <testcase classname='shtest-format.shtest-format' name='requires-any-present.txt' time='{{[0-9]+\.[0-9]+}}'/>
# CHECK: <testcase classname='shtest-format.shtest-format' name='requires-missing.txt' time='{{[0-9]+\.[0-9]+}}'/>
# CHECK: <testcase classname='shtest-format.shtest-format' name='requires-present.txt' time='{{[0-9]+\.[0-9]+}}'/>
# CHECK: <testcase classname='shtest-format.shtest-format' name='requires-star.txt' time='{{[0-9]+\.[0-9]+}}'>
# CHECK-NEXT: <failure{{[ ]*}}>
# CHECK: </failure>
# CHECK-NEXT: </testcase>
# CHECK: <testcase classname='shtest-format.shtest-format' name='requires-triple.txt' time='{{[0-9]+\.[0-9]+}}'/>
# CHECK: <testcase classname='shtest-format.shtest-format' name='unsupported-expr-false.txt' time='{{[0-9]+\.[0-9]+}}'/>
# CHECK: <testcase classname='shtest-format.shtest-format' name='unsupported-expr-true.txt' time='{{[0-9]+\.[0-9]+}}'/>
# CHECK: <testcase classname='shtest-format.shtest-format' name='unsupported-star.txt' time='{{[0-9]+\.[0-9]+}}'>
# CHECK-NEXT: <failure{{[ ]*}}>
# CHECK: </failure>
# CHECK-NEXT: </testcase>
# CHECK: <testcase classname='shtest-format.unsupported_dir' name='some-test.txt' time='{{[0-9]+\.[0-9]+}}'/>
# CHECK: <testcase classname='shtest-format.shtest-format' name='xfail-expr-false.txt' time='{{[0-9]+\.[0-9]+}}'/>
# CHECK: <testcase classname='shtest-format.shtest-format' name='xfail-expr-true.txt' time='{{[0-9]+\.[0-9]+}}'/>
# CHECK: <testcase classname='shtest-format.shtest-format' name='xfail-feature.txt' time='{{[0-9]+\.[0-9]+}}'/>
# CHECK: <testcase classname='shtest-format.shtest-format' name='xfail-target.txt' time='{{[0-9]+\.[0-9]+}}'/>
# CHECK: <testcase classname='shtest-format.shtest-format' name='xfail.txt' time='{{[0-9]+\.[0-9]+}}'/>
# CHECK: <testcase classname='shtest-format.shtest-format' name='xpass.txt' time='{{[0-9]+\.[0-9]+}}'>
# CHECK-NEXT: <failure{{[ ]*}}>
# CHECK: </failure>
# CHECK-NEXT: </testcase>
# CHECK: </testsuite>
# CHECK-NEXT: </testsuites>