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

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 21 04:30:11 PDT 2020


arichardson created this revision.
arichardson added a reviewer: yln.
Herald added subscribers: llvm-commits, delcypher.
Herald added a project: LLVM.

The time= attribute can also be used for the testsuites tag. While this
attribute appears to be ignored by Jenkins (https://github.com/jenkinsci/junit-plugin/blob/bab34bcc96154a494f8c371953efe06d45813f67/src/main/java/hudson/tasks/junit/SuiteResult.java#L202),
it is still useful if you manually inspect the xml file


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84230

Files:
  llvm/utils/lit/lit/reports.py


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.279481.patch
Type: text/x-patch
Size: 941 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200721/b5e011c7/attachment.bin>


More information about the llvm-commits mailing list