[PATCH] D84230: [lit] Include total elapsed time in xunit output

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 22 09:54:37 PDT 2020


arichardson updated this revision to Diff 279862.
arichardson added a comment.

fix tests


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84230/new/

https://reviews.llvm.org/D84230

Files:
  llvm/utils/lit/lit/reports.py
  llvm/utils/lit/tests/shtest-format.py
  llvm/utils/lit/tests/xunit-output.py


Index: llvm/utils/lit/tests/xunit-output.py
===================================================================
--- llvm/utils/lit/tests/xunit-output.py
+++ llvm/utils/lit/tests/xunit-output.py
@@ -8,7 +8,7 @@
 # RUN: FileCheck < %t.xunit.xml %s
 
 # CHECK:      <?xml version="1.0" encoding="UTF-8"?>
-# CHECK-NEXT: <testsuites>
+# CHECK-NEXT: <testsuites time="{{[0-9.]+}}">
 # CHECK-NEXT: <testsuite name="test-data" tests="5" failures="1" skipped="3">
 # CHECK-NEXT: <testcase classname="test-data.test-data" name="bad&name.ini" time="{{[0-1]\.[0-9]+}}">
 # CHECK-NEXT:   <failure><![CDATA[& < > ]]]]><![CDATA[> &"]]></failure>
Index: llvm/utils/lit/tests/shtest-format.py
===================================================================
--- llvm/utils/lit/tests/shtest-format.py
+++ llvm/utils/lit/tests/shtest-format.py
@@ -86,7 +86,7 @@
 
 
 # XUNIT: <?xml version="1.0" encoding="UTF-8"?>
-# XUNIT-NEXT: <testsuites>
+# XUNIT-NEXT: <testsuites time="{{[0-9.]+}}">
 # XUNIT-NEXT: <testsuite name="shtest-format" tests="21" failures="7" skipped="4">
 
 # XUNIT: <testcase classname="shtest-format.external_shell" name="fail.txt" time="{{[0-9]+\.[0-9]+}}">
Index: llvm/utils/lit/lit/reports.py
===================================================================
--- llvm/utils/lit/lit/reports.py
+++ llvm/utils/lit/lit/reports.py
@@ -74,14 +74,13 @@
         self.skipped_codes = {lit.Test.EXCLUDED,
                               lit.Test.SKIPPED, lit.Test.UNSUPPORTED}
 
-    # TODO(yln): elapsed unused, put it somewhere?
     def write_results(self, tests, elapsed):
         tests.sort(key=by_suite_and_test_path)
         tests_by_suite = itertools.groupby(tests, lambda t: t.suite)
 
         with open(self.output_file, 'w') as file:
             file.write('<?xml version="1.0" encoding="UTF-8"?>\n')
-            file.write('<testsuites>\n')
+            file.write('<testsuites time="{time:.2f}">\n'.format(time=elapsed))
             for suite, test_iter in tests_by_suite:
                 self._write_testsuite(file, suite, list(test_iter))
             file.write('</testsuites>\n')


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84230.279862.patch
Type: text/x-patch
Size: 2110 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200722/06cf38c4/attachment.bin>


More information about the llvm-commits mailing list