[llvm] 9ed6f03 - [lit] Don't use Python3 yet

Julian Lettner via llvm-commits llvm-commits at lists.llvm.org
Fri May 1 17:36:28 PDT 2020


Author: Julian Lettner
Date: 2020-05-01T17:36:21-07:00
New Revision: 9ed6f03189ce21a609e4d6933ece5e3fb77ba0e8

URL: https://github.com/llvm/llvm-project/commit/9ed6f03189ce21a609e4d6933ece5e3fb77ba0e8
DIFF: https://github.com/llvm/llvm-project/commit/9ed6f03189ce21a609e4d6933ece5e3fb77ba0e8.diff

LOG: [lit] Don't use Python3 yet

String interpolation is a Python3 feature, we can't use it yet.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/utils/lit/lit/reports.py b/llvm/utils/lit/lit/reports.py
index 8165d8cf54fd..8499d2126be5 100755
--- a/llvm/utils/lit/lit/reports.py
+++ b/llvm/utils/lit/lit/reports.py
@@ -91,17 +91,22 @@ def _write_testsuite(self, file, suite, tests):
         failures = sum(1 for t in tests if t.isFailure())
 
         name = suite.config.name.replace('.', '-')
-        file.write(f'<testsuite name={quo(name)} tests="{len(tests)}" failures="{failures}" skipped="{skipped}">\n')
+        # file.write(f'<testsuite name={quo(name)} tests="{len(tests)}" failures="{failures}" skipped="{skipped}">\n')
+        file.write('<testsuite name={name} tests="{tests}" failures="{failures}" skipped="{skipped}">\n'.format(
+            name=quo(name), tests=len(tests), failures=failures, skipped=skipped))
         for test in tests:
             self._write_test(file, test, name)
         file.write('</testsuite>\n')
 
     def _write_test(self, file, test, suite_name):
         path = '/'.join(test.path_in_suite[:-1]).replace('.', '_')
-        class_name = f'{suite_name}.{path or suite_name}'
+        # class_name = f'{suite_name}.{path or suite_name}'
+        class_name = suite_name + '.' + (path or suite_name)
         name = test.path_in_suite[-1]
         time = test.result.elapsed or 0.0
-        file.write(f'<testcase classname={quo(class_name)} name={quo(name)} time="{time:.2f}"')
+        # file.write(f'<testcase classname={quo(class_name)} name={quo(name)} time="{time:.2f}"')
+        file.write('<testcase classname={class_name} name={name} time="{time:.2f}"'.format(
+            class_name=quo(class_name), name=quo(name), time=time))
 
         if test.isFailure():
             file.write('>\n  <failure><![CDATA[')
@@ -114,7 +119,9 @@ def _write_test(self, file, test, suite_name):
             file.write(']]></failure>\n</testcase>\n')
         elif test.result.code in self.skipped_codes:
             reason = self._get_skip_reason(test)
-            file.write(f'>\n  <skipped message={quo(reason)}/>\n</testcase>\n')
+            # file.write(f'>\n  <skipped message={quo(reason)}/>\n</testcase>\n')
+            file.write('>\n  <skipped message={reason}/>\n</testcase>\n'.format(
+                reason=quo(reason)))
         else:
             file.write('/>\n')
 


        


More information about the llvm-commits mailing list