tests: ignore \r on windows
authorMads Kiilerich <mads@kiilerich.com>
Mon, 07 Nov 2011 03:25:10 +0100
changeset 15449 f71d60da58fb
parent 15448 873f94ecd706
child 15450 90c15a7573df
tests: ignore \r on windows
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 = '.'