[PATCH] D45567: [lit] Fix a bug where UNRESOLVED tests were not handled in the XUnit XML printer.

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 20 03:15:12 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL330409: [lit] Fix a bug where UNRESOLVED tests were not handled in the XUnit (authored by delcypher, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D45567?vs=142162&id=143277#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D45567

Files:
  llvm/trunk/utils/lit/lit/Test.py
  llvm/trunk/utils/lit/tests/shtest-xunit-output.py


Index: llvm/trunk/utils/lit/tests/shtest-xunit-output.py
===================================================================
--- llvm/trunk/utils/lit/tests/shtest-xunit-output.py
+++ llvm/trunk/utils/lit/tests/shtest-xunit-output.py
@@ -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>
Index: llvm/trunk/utils/lit/lit/Test.py
===================================================================
--- llvm/trunk/utils/lit/lit/Test.py
+++ llvm/trunk/utils/lit/lit/Test.py
@@ -373,7 +373,8 @@
 
         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>"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45567.143277.patch
Type: text/x-patch
Size: 4405 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180420/4b232c4f/attachment.bin>


More information about the llvm-commits mailing list