# HG changeset patch # User Christian Ebert # Date 1350832204 -3600 # Node ID d98134ae80ba288def09864ca4d26d343a8f66a3 # Parent 9a4ed3acf89e449bb7e2ec27c8fef61c128894e6# Parent 95e6504e6e2768fcd8047553767adea163448e26 Merge with default diff -r 95e6504e6e27 -r d98134ae80ba 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:04 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 diff -r 95e6504e6e27 -r d98134ae80ba tests/test-keyword.t --- a/tests/test-keyword.t Thu Oct 18 16:28:04 2012 +0200 +++ b/tests/test-keyword.t Sun Oct 21 16:10:04 2012 +0100 @@ -509,9 +509,9 @@ $ hg --debug commit --amend -d '15 1' -m 'amend without changes' | grep keywords overwriting a expanding keywords $ hg -q id - 577e60613a88 + 67d8c481a6be $ head -1 a - expand $Id: a,v 577e60613a88 1970/01/01 00:00:15 test $ + expand $Id: a,v 67d8c481a6be 1970/01/01 00:00:15 test $ $ hg -q strip -n tip