[llvm-commits] [llvm] r123070 - /llvm/trunk/utils/lit/lit/TestRunner.py

Francois Pichet pichet2000 at gmail.com
Sat Jan 8 10:09:48 PST 2011


Author: fpichet
Date: Sat Jan  8 12:09:48 2011
New Revision: 123070

URL: http://llvm.org/viewvc/llvm-project?rev=123070&view=rev
Log:
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

Modified:
    llvm/trunk/utils/lit/lit/TestRunner.py

Modified: llvm/trunk/utils/lit/lit/TestRunner.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestRunner.py?rev=123070&r1=123069&r2=123070&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestRunner.py (original)
+++ llvm/trunk/utils/lit/lit/TestRunner.py Sat Jan  8 12:09:48 2011
@@ -451,12 +451,10 @@
     # 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()





More information about the llvm-commits mailing list