tests: ignore \r on windows stable
authorMads Kiilerich <mads@kiilerich.com>
Mon, 07 Nov 2011 03:25:10 +0100
branchstable
changeset 1017 9cd561108da4
parent 1016 b4ca7adb4bf1
child 1018 4d2cc32c6d97
tests: ignore \r 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
@@ -557,7 +557,9 @@
         (el.endswith(" (re)\n") and rematch(el[:-6] + '\n', l) or
          el.endswith(" (glob)\n") and globmatch(el[:-8] + '\n', l) or
          el.endswith(" (esc)\n") and
-             el[:-7].decode('string-escape') + '\n' == l)):
+             (el[:-7].decode('string-escape') + '\n' == l or
+              el[:-7].decode('string-escape').replace('\r', '') +
+                  '\n' == l and os.name == 'nt'))):
         return True
     return False
 
@@ -867,13 +869,17 @@
     testtmp = os.environ["TESTTMP"] = os.environ["HOME"] = \
         os.path.join(HGTMP, os.path.basename(test)).replace('\\', '/')
 
-    os.mkdir(testtmp)
-    ret, out = runner(testpath, testtmp, options, [
+    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'))
+
+    os.mkdir(testtmp)
+    ret, out = runner(testpath, testtmp, options, replacements)
     vlog("# Ret was:", ret)
 
     mark = '.'