[PATCH] D39023: lit: Improve %: normalization.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 17 16:46:48 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL316044: lit: Improve %: normalization. (authored by pcc).
Changed prior to commit:
https://reviews.llvm.org/D39023?vs=119400&id=119401#toc
Repository:
rL LLVM
https://reviews.llvm.org/D39023
Files:
llvm/trunk/utils/lit/lit/TestRunner.py
Index: llvm/trunk/utils/lit/lit/TestRunner.py
===================================================================
--- llvm/trunk/utils/lit/lit/TestRunner.py
+++ llvm/trunk/utils/lit/lit/TestRunner.py
@@ -825,6 +825,13 @@
tmpBase = os.path.join(tmpDir, execbase)
return tmpDir, tmpBase
+def colonNormalizePath(path):
+ if kIsWindows:
+ return re.sub(r'^(.):', r'\1', path.replace('\\', '/'))
+ else:
+ assert path[0] == '/'
+ return path[1:]
+
def getDefaultSubstitutions(test, tmpDir, tmpBase, normalize_slashes=False):
sourcepath = test.getSourcePath()
sourcedir = os.path.dirname(sourcepath)
@@ -860,23 +867,15 @@
('%/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),
- ])
+ # "%:[STpst]" are normalized paths without colons and without a leading
+ # slash.
+ substitutions.extend([
+ ('%:s', colonNormalizePath(sourcepath)),
+ ('%:S', colonNormalizePath(sourcedir)),
+ ('%:p', colonNormalizePath(sourcedir)),
+ ('%:t', colonNormalizePath(tmpBase + '.tmp')),
+ ('%:T', colonNormalizePath(tmpDir)),
+ ])
return substitutions
def applySubstitutions(script, substitutions):
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39023.119401.patch
Type: text/x-patch
Size: 1899 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171017/f4f1f321/attachment.bin>
More information about the llvm-commits
mailing list