run-tests: make $TESTTMP matching case-insensitive on windows stable
authorMads Kiilerich <mads@kiilerich.com>
Mon, 07 Nov 2011 03:25:10 +0100
branchstable
changeset 1019 e7fbd63e5a98
parent 1018 4d2cc32c6d97
child 1021 4ecaec765d76
child 1022 34ebea1c49c9
run-tests: make $TESTTMP matching case-insensitive on windows [ original upstream message ]
tests/run-tests.py
--- a/tests/run-tests.py	Mon Nov 07 03:25:10 2011 +0100
+++ b/tests/run-tests.py	Mon Nov 07 03:25:10 2011 +0100
@@ -870,13 +870,20 @@
         os.path.join(HGTMP, os.path.basename(test)).replace('\\', '/')
 
     replacements = [
-        (re.escape(testtmp), '$TESTTMP'),
         (r':%s\b' % options.port, ':$HGPORT'),
         (r':%s\b' % (options.port + 1), ':$HGPORT1'),
         (r':%s\b' % (options.port + 2), ':$HGPORT2'),
         ]
     if os.name == 'nt':
         replacements.append((r'\r\n', '\n'))
+        replacements.append(
+            (''.join(c.isalpha() and '[%s%s]' % (c.lower(), c.upper()) or
+                     c in '/\\' and r'[/\\]' or
+                     c.isdigit() and c or
+                     '\\' + c
+                     for c in testtmp), '$TESTTMP'))
+    else:
+        replacements.append((re.escape(testtmp), '$TESTTMP'))
 
     os.mkdir(testtmp)
     ret, out = runner(testpath, testtmp, options, replacements)