[llvm] e944f4c - Revert "[lit] Avoid os.path.realpath in lit.py due to MAX_PATH limitations on Windows"

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 16 07:11:01 PDT 2023


Author: Saleem Abdulrasool
Date: 2023-06-16T07:10:35-07:00
New Revision: e944f4c9500b824b8fc790f8f73bd20be8e33484

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

LOG: Revert "[lit] Avoid os.path.realpath in lit.py due to MAX_PATH limitations on Windows"

This reverts commit c1cf459cbd79cc7d6ca834390649fb9185a4b237.

Reverting to permit time to explore the underlying issue.  This change
regressed the clang-PPC64-AIX and m68k-linux-cross builders.

Differential Revision: https://reviews.llvm.org/D153138
Reviewed By: compnerd

Added: 
    

Modified: 
    llvm/utils/lit/lit/TestRunner.py
    llvm/utils/lit/lit/builtin_commands/diff.py
    llvm/utils/lit/lit/discovery.py
    llvm/utils/lit/tests/Inputs/config-map-discovery/driver.py
    llvm/utils/lit/tests/Inputs/config-map-discovery/lit.alt.cfg
    llvm/utils/lit/tests/Inputs/use-llvm-tool-required/lit.cfg
    llvm/utils/lit/tests/Inputs/use-llvm-tool/lit.cfg

Removed: 
    


################################################################################
diff  --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py
index aaed0d241b1c1..24670610e3a57 100644
--- a/llvm/utils/lit/lit/TestRunner.py
+++ b/llvm/utils/lit/lit/TestRunner.py
@@ -74,7 +74,7 @@ def change_dir(self, newdir):
         if os.path.isabs(newdir):
             self.cwd = newdir
         else:
-            self.cwd = os.path.abspath(os.path.join(self.cwd, newdir))
+            self.cwd = os.path.realpath(os.path.join(self.cwd, newdir))
 
 
 class TimeoutHelper(object):
@@ -427,7 +427,7 @@ def executeBuiltinMkdir(cmd, cmd_shenv):
         dir = to_unicode(dir) if kIsWindows else to_bytes(dir)
         cwd = to_unicode(cwd) if kIsWindows else to_bytes(cwd)
         if not os.path.isabs(dir):
-            dir = os.path.abspath(os.path.join(cwd, dir))
+            dir = os.path.realpath(os.path.join(cwd, dir))
         if parent:
             lit.util.mkdir_p(dir)
         else:
@@ -473,7 +473,7 @@ def on_rm_error(func, path, exc_info):
         path = to_unicode(path) if kIsWindows else to_bytes(path)
         cwd = to_unicode(cwd) if kIsWindows else to_bytes(cwd)
         if not os.path.isabs(path):
-            path = os.path.abspath(os.path.join(cwd, path))
+            path = os.path.realpath(os.path.join(cwd, path))
         if force and not os.path.exists(path):
             continue
         try:

diff  --git a/llvm/utils/lit/lit/builtin_commands/
diff .py b/llvm/utils/lit/lit/builtin_commands/
diff .py
index 87bcad79e19a0..3a91920f9b5ed 100644
--- a/llvm/utils/lit/lit/builtin_commands/
diff .py
+++ b/llvm/utils/lit/lit/builtin_commands/
diff .py
@@ -281,7 +281,7 @@ def main(argv):
     try:
         for file in args:
             if file != "-" and not os.path.isabs(file):
-                file = os.path.abspath(os.path.join(os.getcwd(), file))
+                file = os.path.realpath(os.path.join(os.getcwd(), file))
 
             if flags.recursive_
diff :
                 if file == "-":

diff  --git a/llvm/utils/lit/lit/discovery.py b/llvm/utils/lit/lit/discovery.py
index 1924b54f5acc8..5bfe1eb5acd71 100644
--- a/llvm/utils/lit/lit/discovery.py
+++ b/llvm/utils/lit/lit/discovery.py
@@ -56,7 +56,8 @@ def search1(path):
         # configuration to load instead.
         config_map = litConfig.params.get("config_map")
         if config_map:
-            target = config_map.get(os.path.normcase(os.path.abspath(cfgpath)))
+            cfgpath = os.path.realpath(cfgpath)
+            target = config_map.get(os.path.normcase(cfgpath))
             if target:
                 cfgpath = target
 
@@ -66,16 +67,16 @@ def search1(path):
 
         cfg = TestingConfig.fromdefaults(litConfig)
         cfg.load_from_path(cfgpath, litConfig)
-        source_root = os.path.abspath(cfg.test_source_root or path)
-        exec_root = os.path.abspath(cfg.test_exec_root or path)
+        source_root = os.path.realpath(cfg.test_source_root or path)
+        exec_root = os.path.realpath(cfg.test_exec_root or path)
         return Test.TestSuite(cfg.name, source_root, exec_root, cfg), ()
 
     def search(path):
         # Check for an already instantiated test suite.
-        full_path = os.path.normcase(os.path.abspath(path))
-        res = cache.get(full_path)
+        real_path = os.path.realpath(path)
+        res = cache.get(real_path)
         if res is None:
-            cache[full_path] = res = search1(path)
+            cache[real_path] = res = search1(path)
         return res
 
     # Canonicalize the path.

diff  --git a/llvm/utils/lit/tests/Inputs/config-map-discovery/driver.py b/llvm/utils/lit/tests/Inputs/config-map-discovery/driver.py
index 9d0f6285faaad..d22b84d6a15cf 100644
--- a/llvm/utils/lit/tests/Inputs/config-map-discovery/driver.py
+++ b/llvm/utils/lit/tests/Inputs/config-map-discovery/driver.py
@@ -3,7 +3,7 @@
 import sys
 
 main_config = sys.argv[1]
-main_config = os.path.abspath(main_config)
+main_config = os.path.realpath(main_config)
 main_config = os.path.normcase(main_config)
 
 config_map = {main_config: sys.argv[2]}

diff  --git a/llvm/utils/lit/tests/Inputs/config-map-discovery/lit.alt.cfg b/llvm/utils/lit/tests/Inputs/config-map-discovery/lit.alt.cfg
index 80b202e7f7eae..c7b303f50a05c 100644
--- a/llvm/utils/lit/tests/Inputs/config-map-discovery/lit.alt.cfg
+++ b/llvm/utils/lit/tests/Inputs/config-map-discovery/lit.alt.cfg
@@ -5,5 +5,5 @@ config.suffixes = ['.txt']
 config.test_format = lit.formats.ShTest()
 
 import os
-config.test_exec_root = os.path.abspath(os.path.dirname(__file__))
+config.test_exec_root = os.path.realpath(os.path.dirname(__file__))
 config.test_source_root = os.path.join(config.test_exec_root, "tests")

diff  --git a/llvm/utils/lit/tests/Inputs/use-llvm-tool-required/lit.cfg b/llvm/utils/lit/tests/Inputs/use-llvm-tool-required/lit.cfg
index 44d997db37a9a..e41207bc2f05d 100644
--- a/llvm/utils/lit/tests/Inputs/use-llvm-tool-required/lit.cfg
+++ b/llvm/utils/lit/tests/Inputs/use-llvm-tool-required/lit.cfg
@@ -7,7 +7,7 @@ config.test_source_root = None
 config.test_exec_root = None
 import os.path
 
-config.llvm_tools_dir = os.path.abspath(os.path.dirname(__file__))
+config.llvm_tools_dir = os.path.realpath(os.path.dirname(__file__))
 import lit.llvm
 
 lit.llvm.initialize(lit_config, config)

diff  --git a/llvm/utils/lit/tests/Inputs/use-llvm-tool/lit.cfg b/llvm/utils/lit/tests/Inputs/use-llvm-tool/lit.cfg
index 244253aa14e8c..8fe62d98c1349 100644
--- a/llvm/utils/lit/tests/Inputs/use-llvm-tool/lit.cfg
+++ b/llvm/utils/lit/tests/Inputs/use-llvm-tool/lit.cfg
@@ -7,7 +7,7 @@ config.test_source_root = None
 config.test_exec_root = None
 import os.path
 
-this_dir = os.path.abspath(os.path.dirname(__file__))
+this_dir = os.path.realpath(os.path.dirname(__file__))
 config.llvm_tools_dir = os.path.join(this_dir, "build")
 import lit.llvm
 


        


More information about the llvm-commits mailing list