[PATCH] D19757: [lit] Add %:[STpst] to represent paths without Windows drive letters.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 29 18:15:53 PDT 2016


ruiu created this revision.
ruiu added a reviewer: rnk.
ruiu added a subscriber: llvm-commits.

We need these variables to concatenate two absolute paths to construct
a valid path. Currently, %t/%t is, for example, expanded to C:/foo/C:/foo,
which is not a valid path because ":" is not a valid path character
on Windows.

http://reviews.llvm.org/D19757

Files:
  utils/lit/lit/TestRunner.py

Index: utils/lit/lit/TestRunner.py
===================================================================
--- utils/lit/lit/TestRunner.py
+++ utils/lit/lit/TestRunner.py
@@ -568,6 +568,24 @@
             ('%/t', tmpBase.replace('\\', '/') + '.tmp'),
             ('%/T', tmpDir.replace('\\', '/')),
             ])
+
+    # "%:[STpst]" are paths without Windows drive letters.
+    if kIsWindows:
+        substitutions.extend([
+                ('%:s', re.sub(r'^.:', '', sourcepath)),
+                ('%:S', re.sub(r'^.:', '', sourcedir)),
+                ('%:p', re.sub(r'^.:', '', sourcedir)),
+                ('%:t', re.sub(r'^.:', '', tmpBase) + '.tmp'),
+                ('%:T', re.sub(r'^.:', '', tmpDir)),
+                ])
+    else:
+        substitutions.extend([
+                ('%:s', sourcepath),
+                ('%:S', sourcedir),
+                ('%:p', sourcedir),
+                ('%:t', tmpBase + '.tmp'),
+                ('%:T', tmpDir),
+                ])
     return substitutions
 
 def applySubstitutions(script, substitutions):


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19757.55696.patch
Type: text/x-patch
Size: 1065 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160430/2e35250a/attachment.bin>


More information about the llvm-commits mailing list