[PATCH] D98767: [lit] Harmonize test timing data between Unix and Windows

David Zarzycki via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 17 02:53:36 PDT 2021


davezarzycki created this revision.
davezarzycki added reviewers: yln, jhenderson.
davezarzycki added a project: LLVM.
Herald added subscribers: delcypher, kristof.beyls.
davezarzycki requested review of this revision.

The "path" recorded for timing purposes is only used as a key into a dictionary. It is never used as an actual path to a filesystem API, therefore we should use '/' as the canonical separator so that Unix and Windows machines can share timing data. This also ensures that the lit testing works across platforms.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98767

Files:
  llvm/utils/lit/lit/Test.py
  llvm/utils/lit/lit/main.py
  llvm/utils/lit/tests/reorder.py


Index: llvm/utils/lit/tests/reorder.py
===================================================================
--- llvm/utils/lit/tests/reorder.py
+++ llvm/utils/lit/tests/reorder.py
@@ -3,7 +3,6 @@
 # RUN: cp %{inputs}/reorder/.lit_test_times.txt %{inputs}/reorder/.lit_test_times.txt.orig
 # RUN: %{lit} -j1 %{inputs}/reorder | FileCheck %s
 # RUN: not diff %{inputs}/reorder/.lit_test_times.txt %{inputs}/reorder/.lit_test_times.txt.orig
-# UNSUPPORTED: windows
 # END.
 
 # CHECK:     -- Testing: 3 tests, 1 workers --
Index: llvm/utils/lit/lit/main.py
===================================================================
--- llvm/utils/lit/lit/main.py
+++ llvm/utils/lit/lit/main.py
@@ -264,7 +264,12 @@
         if not t.suite.exec_root in times_by_suite:
             times_by_suite[t.suite.exec_root] = []
         time = -t.result.elapsed if t.isFailure() else t.result.elapsed
-        times_by_suite[t.suite.exec_root].append((os.sep.join(t.path_in_suite), t.result.elapsed))
+        # The "path" here is only used as a key into a dictionary. It is never
+        # used as an actual path to a filesystem API, therefore we use '/' as
+        # the canonical separator so that Unix and Windows machines can share
+        # timing data.
+        times_by_suite[t.suite.exec_root].append(('/'.join(t.path_in_suite),
+          t.result.elapsed))
 
     for s, value in times_by_suite.items():
         try:
Index: llvm/utils/lit/lit/Test.py
===================================================================
--- llvm/utils/lit/lit/Test.py
+++ llvm/utils/lit/lit/Test.py
@@ -262,8 +262,8 @@
         # The previous test elapsed time, if applicable.
         self.previous_elapsed = 0.0
 
-        if os.sep.join(path_in_suite) in suite.test_times:
-            time = suite.test_times[os.sep.join(path_in_suite)]
+        if '/'.join(path_in_suite) in suite.test_times:
+            time = suite.test_times['/'.join(path_in_suite)]
             self.previous_elapsed = abs(time)
             self.previous_failure = time < 0
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98767.331194.patch
Type: text/x-patch
Size: 2033 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210317/e73e8a43/attachment.bin>


More information about the llvm-commits mailing list