]> granicus.if.org Git - llvm/commitdiff
[lit] Make symlinks in test paths work a different way
authorReid Kleckner <rnk@google.com>
Thu, 31 Aug 2017 17:07:35 +0000 (17:07 +0000)
committerReid Kleckner <rnk@google.com>
Thu, 31 Aug 2017 17:07:35 +0000 (17:07 +0000)
Use os.path.normpath instead of realpath to collapse '..' and '.' path
components. Use realpath when caching search results about a path for
good measure.

I considered rigging up a test involving symlinks for this, but I doubt
I can check a symlink into SVN. The test would have to conditionally
create a symlink at runtime if the host OS supports it. This sounds too
fragile and complicated to me to be worth it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312254 91177308-0d34-0410-b5e6-96231b3b80d8

utils/lit/lit/discovery.py

index 4befe582d454c37dfb33c1f302793695bafa0fe0..ea6143d816624dc5f97752f1555c3609b4f360ea 100644 (file)
@@ -52,13 +52,14 @@ def getTestSuite(item, litConfig, cache):
 
     def search(path):
         # Check for an already instantiated test suite.
-        res = cache.get(path)
+        real_path = os.path.realpath(path)
+        res = cache.get(real_path)
         if res is None:
-            cache[path] = res = search1(path)
+            cache[real_path] = res = search1(path)
         return res
 
     # Canonicalize the path.
-    item = os.path.realpath(item)
+    item = os.path.normpath(item)
 
     # Skip files and virtual components.
     components = []