--- a/tests/run-tests.py Sat Oct 09 12:26:56 2010 +0100
+++ b/tests/run-tests.py Sat Oct 09 15:47:19 2010 +0100
@@ -443,25 +443,25 @@
def alarmed(signum, frame):
raise Timeout
-def pytest(test, options):
+def pytest(test, options, replacements):
py3kswitch = options.py3k_warnings and ' -3' or ''
cmd = '%s%s "%s"' % (PYTHON, py3kswitch, test)
vlog("# Running", cmd)
- return run(cmd, options)
+ return run(cmd, options, replacements)
-def shtest(test, options):
+def shtest(test, options, replacements):
cmd = '"%s"' % test
vlog("# Running", cmd)
- return run(cmd, options)
+ return run(cmd, options, replacements)
-def battest(test, options):
+def battest(test, options, replacements):
# To reliably get the error code from batch files on WinXP,
# the "cmd /c call" prefix is needed. Grrr
cmd = 'cmd /c call "%s"' % testpath
vlog("# Running", cmd)
- return run(cmd, options)
+ return run(cmd, options, replacements)
-def tsttest(test, options):
+def tsttest(test, options, replacements):
t = open(test)
out = []
script = []
@@ -500,7 +500,7 @@
cmd = '/bin/sh "%s"' % name
vlog("# Running", cmd)
- exitcode, output = run(cmd, options)
+ exitcode, output = run(cmd, options, replacements)
# do not merge output if skipped, return hghave message instead
if exitcode == SKIPPED_STATUS:
return exitcode, output
@@ -565,7 +565,7 @@
return exitcode, postout
-def run(cmd, options):
+def run(cmd, options, replacements):
"""Run command in a sub-process, capturing the output (stdout and stderr).
Return a tuple (exitcode, output). output is None in debug mode."""
# TODO: Use subprocess.Popen if we're running on Python 2.4
@@ -608,6 +608,8 @@
cleanup()
raise
+ for s, r in replacements:
+ output = output.replace(s, r)
return ret, splitnewlines(output)
def runone(options, test, skips, fails):
@@ -682,14 +684,19 @@
runner = shtest
# Make a tmp subdirectory to work in
- tmpd = os.path.join(HGTMP, test)
- os.mkdir(tmpd)
- os.chdir(tmpd)
+ testtmp = os.environ["TESTTMP"] = os.path.join(HGTMP, test)
+ os.mkdir(testtmp)
+ os.chdir(testtmp)
if options.timeout > 0:
signal.alarm(options.timeout)
- ret, out = runner(testpath, options)
+ ret, out = runner(testpath, options, [
+ (testtmp, '$TESTTMP'),
+ (':%s' % options.port, ':$HGPORT'),
+ (':%s' % (options.port + 1), ':$HGPORT1'),
+ (':%s' % (options.port + 2), ':$HGPORT2'),
+ ])
vlog("# Ret was:", ret)
if options.timeout > 0:
@@ -755,7 +762,7 @@
os.chdir(TESTDIR)
if not options.keep_tmpdir:
- shutil.rmtree(tmpd, True)
+ shutil.rmtree(testtmp, True)
if skipped:
return None
return ret == 0
--- a/tests/test-keyword.t Sat Oct 09 12:26:56 2010 +0100
+++ b/tests/test-keyword.t Sat Oct 09 15:47:19 2010 +0100
@@ -154,7 +154,7 @@
do not process $Id:
xxx $
ignore $Id$
- a* (glob)
+ a
Test hook execution
@@ -180,6 +180,7 @@
> [notify]
> sources = pull
> diffstat = False
+ > maxsubject = 15
> [reposubs]
> * = Test
> EOF
@@ -197,13 +198,13 @@
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Date: * (glob)
- Subject: changeset in * (glob)
+ Subject: changeset in...
From: mercurial
X-Hg-Notification: changeset a2392c293916
Message-Id: <hg.a2392c293916*> (glob)
To: Test
- changeset a2392c293916 in * (glob)
+ changeset a2392c293916 in $TESTTMP/Test
details: *cmd=changeset;node=a2392c293916 (glob)
description:
addsym
@@ -220,14 +221,14 @@
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Date:* (glob)
- Subject: changeset in* (glob)
+ Subject: changeset in...
From: User Name <user@example.com>
X-Hg-Notification: changeset ef63ca68695b
Message-Id: <hg.ef63ca68695b*> (glob)
To: Test
- changeset ef63ca68695b in * (glob)
- details: *cmd=changeset;node=ef63ca68695b (glob)
+ changeset ef63ca68695b in $TESTTMP/Test
+ details: $TESTTMP/Test?cmd=changeset;node=ef63ca68695b
description:
absym
@@ -535,7 +536,7 @@
$ cp sym i
$ ls -l i
- -rw-r--r-- * (glob)
+ -rw-r--r--* (glob)
$ head -1 i
expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
$ hg copy --after --verbose sym i
@@ -614,7 +615,7 @@
do not process $Id:
xxx $
ignore $Id$
- a* (glob)
+ a
Write custom keyword and prepare multiline commit message
@@ -664,7 +665,7 @@
xxx $
$Xinfo: User Name <user@example.com>: firstline $
ignore $Id$
- a* (glob)
+ a
annotate
@@ -735,7 +736,7 @@
> default = ../Test
> EOF
$ hg incoming
- comparing with *test-keyword.t/Test (glob)
+ comparing with $TESTTMP/Test
searching for changes
changeset: 2:bb948857c743
tag: tip
@@ -994,7 +995,7 @@
xxx $
$Xinfo: User Name <user@example.com>: firstline $
ignore $Id$
- a* (glob)
+ a
Now disable keyword expansion
@@ -1011,4 +1012,4 @@
xxx $
$Xinfo$
ignore $Id$
- a* (glob)
+ a