Merge with stable
authorChristian Ebert <blacktrash@gmx.net>
Mon, 05 Aug 2013 13:19:38 +0100
changeset 1291 451cbdc0b353
parent 1288 2e9c41125820 (current diff)
parent 1290 d56f50372ba5 (diff)
child 1294 5a04f94e1da9
Merge with stable
--- a/tests/run-tests.py	Fri Jul 19 00:37:26 2013 +0100
+++ b/tests/run-tests.py	Mon Aug 05 13:19:38 2013 +0100
@@ -578,6 +578,8 @@
     py3kswitch = options.py3k_warnings and ' -3' or ''
     cmd = '%s%s "%s"' % (PYTHON, py3kswitch, test)
     vlog("# Running", cmd)
+    if os.name == 'nt':
+        replacements.append((r'\r\n', '\n'))
     return run(cmd, wd, options, replacements, env)
 
 needescape = re.compile(r'[\x00-\x08\x0b-\x1f\x7f-\xff]').search
@@ -592,6 +594,8 @@
 def rematch(el, l):
     try:
         # use \Z to ensure that the regex matches to the end of the string
+        if os.name == 'nt':
+            return re.match(el + r'\r?\n\Z', l)
         return re.match(el + r'\n\Z', l)
     except re.error:
         # el is an invalid regex
@@ -629,6 +633,8 @@
     if el:
         if el.endswith(" (esc)\n"):
             el = el[:-7].decode('string-escape') + '\n'
+        if el == l or os.name == 'nt' and el[:-1] + '\r\n' == l:
+            return True
         if (el.endswith(" (re)\n") and rematch(el[:-6], l) or
             el.endswith(" (glob)\n") and globmatch(el[:-8], l)):
             return True
@@ -915,8 +921,10 @@
                 else:
                     return ignore("doesn't match keyword")
 
+    if not lctest.startswith("test-"):
+        return skip("not a test file")
     for ext, func, out in testtypes:
-        if lctest.startswith("test-") and lctest.endswith(ext):
+        if lctest.endswith(ext):
             runner = func
             ref = os.path.join(TESTDIR, test + out)
             break
@@ -947,7 +955,6 @@
                      c.isdigit() and c or
                      '\\' + c
                      for c in testtmp), '$TESTTMP'))
-        replacements.append((r'\r\n', '\n'))
     else:
         replacements.append((re.escape(testtmp), '$TESTTMP'))