diff -r 5dc5c899428a -r 4ecaec765d76 tests/run-tests.py --- a/tests/run-tests.py Fri Nov 11 09:38:45 2011 +0000 +++ b/tests/run-tests.py Fri Nov 11 09:39:33 2011 +0000 @@ -87,7 +87,7 @@ SKIPPED_STATUS = 80 SKIPPED_PREFIX = 'skipped: ' FAILED_PREFIX = 'hghave check failed: ' -PYTHON = sys.executable +PYTHON = sys.executable.replace('\\', '/') IMPL_PATH = 'PYTHONPATH' if 'java' in sys.platform: IMPL_PATH = 'JYTHONPATH' @@ -530,20 +530,22 @@ return False def globmatch(el, l): - # The only supported special characters are * and ?. Escaping is - # supported. + # The only supported special characters are * and ? plus / which also + # matches \ on windows. Escaping of these caracters is supported. i, n = 0, len(el) res = '' while i < n: c = el[i] i += 1 - if c == '\\' and el[i] in '*?\\': + if c == '\\' and el[i] in '*?\\/': res += el[i - 1:i + 1] i += 1 elif c == '*': res += '.*' elif c == '?': res += '.' + elif c == '/' and os.name == 'nt': + res += '[/\\\\]' else: res += re.escape(c) return rematch(res, l) @@ -554,7 +556,10 @@ 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.decode('string-escape') == l)): + 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 return False @@ -638,7 +643,7 @@ os.write(fd, l) os.close(fd) - cmd = '"%s" "%s"' % (options.shell, name) + cmd = '%s "%s"' % (options.shell, name) vlog("# Running", cmd) exitcode, output = run(cmd, wd, options, replacements) # do not merge output if skipped, return hghave message instead @@ -862,15 +867,26 @@ # Make a tmp subdirectory to work in testtmp = os.environ["TESTTMP"] = os.environ["HOME"] = \ - os.path.join(HGTMP, os.path.basename(test)) + os.path.join(HGTMP, os.path.basename(test)).replace('\\', '/') - os.mkdir(testtmp) - ret, out = runner(testpath, testtmp, options, [ - (re.escape(testtmp), '$TESTTMP'), + replacements = [ (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')) + replacements.append( + (''.join(c.isalpha() and '[%s%s]' % (c.lower(), c.upper()) or + c in '/\\' and r'[/\\]' or + c.isdigit() and c or + '\\' + c + for c in testtmp), '$TESTTMP')) + else: + replacements.append((re.escape(testtmp), '$TESTTMP')) + + os.mkdir(testtmp) + ret, out = runner(testpath, testtmp, options, replacements) vlog("# Ret was:", ret) mark = '.'