summaryrefslogtreecommitdiffstats
path: root/llvm/utils/lit
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2016-04-30 21:32:12 +0000
committerRui Ueyama <ruiu@google.com>2016-04-30 21:32:12 +0000
commit53aa9f2475a1dd9050524bc9a0508d1e27a637a9 (patch)
tree15da10e49582e2498036a282380cc9fae0874eaf /llvm/utils/lit
parentacc98ca43c376526ef31a618c774b230d6e6f51d (diff)
downloadbcm5719-llvm-53aa9f2475a1dd9050524bc9a0508d1e27a637a9.tar.gz
bcm5719-llvm-53aa9f2475a1dd9050524bc9a0508d1e27a637a9.zip
[lit] Add %:[STpst] to represent paths without colons on Windows.
Summary: 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. With this patch, %t will be expanded to C\foo. Differential Revision: http://reviews.llvm.org/D19757 llvm-svn: 268168
Diffstat (limited to 'llvm/utils/lit')
-rw-r--r--llvm/utils/lit/lit/TestRunner.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py
index c791b4274f8..38224add85a 100644
--- a/llvm/utils/lit/lit/TestRunner.py
+++ b/llvm/utils/lit/lit/TestRunner.py
@@ -568,6 +568,24 @@ def getDefaultSubstitutions(test, tmpDir, tmpBase, normalize_slashes=False):
('%/t', tmpBase.replace('\\', '/') + '.tmp'),
('%/T', tmpDir.replace('\\', '/')),
])
+
+ # "%:[STpst]" are paths without colons.
+ if kIsWindows:
+ substitutions.extend([
+ ('%:s', re.sub(r'^(.):', r'\1', sourcepath)),
+ ('%:S', re.sub(r'^(.):', r'\1', sourcedir)),
+ ('%:p', re.sub(r'^(.):', r'\1', sourcedir)),
+ ('%:t', re.sub(r'^(.):', r'\1', tmpBase) + '.tmp'),
+ ('%:T', re.sub(r'^(.):', r'\1', tmpDir)),
+ ])
+ else:
+ substitutions.extend([
+ ('%:s', sourcepath),
+ ('%:S', sourcedir),
+ ('%:p', sourcedir),
+ ('%:t', tmpBase + '.tmp'),
+ ('%:T', tmpDir),
+ ])
return substitutions
def applySubstitutions(script, substitutions):
OpenPOWER on IntegriCloud