[llvm] 5ccfa15 - [lit] abs_path_preserve_drive - don't normalize path, leave this to the caller

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 2 05:43:29 PDT 2023


Author: Simon Pilgrim
Date: 2023-08-02T13:43:18+01:00
New Revision: 5ccfa15681300323effe314348bb415f6a59c97f

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

LOG: [lit] abs_path_preserve_drive - don't normalize path, leave this to the caller

As noted on D154130, this was preventing path matching between normalized/unnormalized paths on some windows builds.

Added: 
    

Modified: 
    llvm/utils/lit/lit/discovery.py
    llvm/utils/lit/lit/util.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/lit/lit/discovery.py b/llvm/utils/lit/lit/discovery.py
index 5f96dc9c823c61..2e7f90c6bb0c96 100644
--- a/llvm/utils/lit/lit/discovery.py
+++ b/llvm/utils/lit/lit/discovery.py
@@ -57,7 +57,7 @@ def search1(path):
         config_map = litConfig.params.get("config_map")
         if config_map:
             cfgpath = util.abs_path_preserve_drive(cfgpath)
-            target = config_map.get(cfgpath)
+            target = config_map.get(os.path.normcase(cfgpath))
             if target:
                 cfgpath = target
 

diff  --git a/llvm/utils/lit/lit/util.py b/llvm/utils/lit/lit/util.py
index f2df5c1e032966..c8d7ec62a57458 100644
--- a/llvm/utils/lit/lit/util.py
+++ b/llvm/utils/lit/lit/util.py
@@ -138,12 +138,12 @@ def abs_path_preserve_drive(path):
         # Since Python 3.8, os.path.realpath resolves sustitute drives,
         # so we should not use it. In Python 3.7, os.path.realpath
         # was implemented as os.path.abspath.
-        return os.path.normpath(os.path.abspath(path))
+        return os.path.abspath(path)
     else:
         # On UNIX, the current directory always has symbolic links resolved,
         # so any program accepting relative paths cannot preserve symbolic
         # links in paths and we should always use os.path.realpath.
-        return os.path.normpath(os.path.realpath(path))
+        return os.path.realpath(path)
 
 def mkdir(path):
     try:


        


More information about the llvm-commits mailing list