diff -r 95e6504e6e27 -r 2498fa07212f tests/run-tests.py --- a/tests/run-tests.py Thu Oct 18 16:28:04 2012 +0200 +++ b/tests/run-tests.py Sun Oct 21 16:10:25 2012 +0100 @@ -476,11 +476,8 @@ py3kswitch = options.py3k_warnings and ' -3' or '' cmd = '%s%s "%s"' % (PYTHON, py3kswitch, test) vlog("# Running", cmd) - return run(cmd, wd, options, replacements) - -def shtest(test, wd, options, replacements): - cmd = '%s "%s"' % (options.shell, test) - vlog("# Running", cmd) + if os.name == 'nt': + replacements.append((r'\r\n', '\n')) return run(cmd, wd, options, replacements) needescape = re.compile(r'[\x00-\x08\x0b-\x1f\x7f-\xff]').search @@ -494,8 +491,10 @@ def rematch(el, l): try: - # ensure that the regex matches to the end of the string - return re.match(el + r'\Z', l) + # 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 return False @@ -524,14 +523,14 @@ def linematch(el, l): if el == l: # perfect match (fast) return True - if (el and - (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 or - el[:-7].decode('string-escape').replace('\r', '') + - '\n' == l and os.name == 'nt'))): - return True + 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 return False def tsttest(test, wd, options, replacements): @@ -870,10 +869,7 @@ runner = tsttest ref = testpath else: - # do not try to run non-executable programs - if not os.access(testpath, os.X_OK): - return skip("not executable") - runner = shtest + return skip("unknown test type") # Make a tmp subdirectory to work in testtmp = os.environ["TESTTMP"] = os.environ["HOME"] = \ @@ -885,7 +881,6 @@ (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