From 7a0be17c087ad7723e0ec65e63f4eb80ce9b5cef Mon Sep 17 00:00:00 2001 From: Francois Pichet Date: Sat, 8 Jan 2011 18:09:48 +0000 Subject: 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 ools\clang est git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123070 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/lit/lit/TestRunner.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/utils/lit/lit/TestRunner.py b/utils/lit/lit/TestRunner.py index 6430cdd..dba7814 100644 --- a/utils/lit/lit/TestRunner.py +++ b/utils/lit/lit/TestRunner.py @@ -451,12 +451,10 @@ def parseIntegratedTestScript(test, normalize_slashes=False): # expression pattern a with substitution b in line ln. def processLine(ln): # Apply substitutions - # FIXME: Investigate why re.sub doesn't work on Windows for a,b in substitutions: if kIsWindows: - ln = ln.replace(a,b) - else: - ln = re.sub(a, b, ln) + b = b.replace("\\","\\\\") + ln = re.sub(a, b, ln) # Strip the trailing newline and any extra whitespace. return ln.strip() -- cgit v1.1