[llvm] 2b20df2 - [lit] Harmonize test timing data between Unix and Windows

David Zarzycki via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 17 04:43:04 PDT 2021


Author: David Zarzycki
Date: 2021-03-17T07:42:40-04:00
New Revision: 2b20df2d798a0944e54918369a717634dbcaeaa6

URL: https://github.com/llvm/llvm-project/commit/2b20df2d798a0944e54918369a717634dbcaeaa6
DIFF: https://github.com/llvm/llvm-project/commit/2b20df2d798a0944e54918369a717634dbcaeaa6.diff

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

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.

Reviewed By: jhenderson, jmorse

Differential Revision: https://reviews.llvm.org/D98767

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/utils/lit/lit/Test.py b/llvm/utils/lit/lit/Test.py
index ad42ef183ede..ca715734eab4 100644
--- a/llvm/utils/lit/lit/Test.py
+++ b/llvm/utils/lit/lit/Test.py
@@ -262,8 +262,8 @@ def __init__(self, suite, path_in_suite, config, file_path = None):
         # 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
 

diff  --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py
index cfc12661a785..c108c0015653 100755
--- a/llvm/utils/lit/lit/main.py
+++ b/llvm/utils/lit/lit/main.py
@@ -264,7 +264,12 @@ def record_test_times(tests, lit_config):
         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:

diff  --git a/llvm/utils/lit/tests/reorder.py b/llvm/utils/lit/tests/reorder.py
index 2b699067bbc3..7c9dc8d21fe3 100644
--- a/llvm/utils/lit/tests/reorder.py
+++ b/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: system-windows
 # END.
 
 # CHECK:     -- Testing: 3 tests, 1 workers --


        


More information about the llvm-commits mailing list