Skip to content

Commit 7c9eab8

Browse files
committed
On Windows, replace each occurrence of '\' by '\\' on the replacement string. This is necessary to prevent re.sub from replacing escape sequences occurring in path.
For example: llvm\tools\clang\test was replaced by llvm <tab> ools\clang <tab> est llvm-svn: 123070
1 parent 7fab23b commit 7c9eab8

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

llvm/utils/lit/lit/TestRunner.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,12 +451,10 @@ def parseIntegratedTestScript(test, normalize_slashes=False):
451451
# expression pattern a with substitution b in line ln.
452452
def processLine(ln):
453453
# Apply substitutions
454-
# FIXME: Investigate why re.sub doesn't work on Windows
455454
for a,b in substitutions:
456455
if kIsWindows:
457-
ln = ln.replace(a,b)
458-
else:
459-
ln = re.sub(a, b, ln)
456+
b = b.replace("\\","\\\\")
457+
ln = re.sub(a, b, ln)
460458

461459
# Strip the trailing newline and any extra whitespace.
462460
return ln.strip()

0 commit comments

Comments
 (0)