# HG changeset patch # User Martin Geisler # Date 1288603447 -3600 # Node ID fb1e8925292de52fee34af5cd89e1c82cad711d1 # Parent 3c5de8747a32830441bfea885a44fe2a11eac95c run-tests: use regex when searching for $HGPORT in test output This prevents spurious errors when a changeset hash happens to match the port number. Before, this invocation gave a test failure: $ ./run-tests.py test-log.t --port 24427 ERROR: /home/mg/src/mercurial-crew/tests/test-log.t output changed --- /home/mg/src/mercurial-crew/tests/test-log.t +++ /home/mg/src/mercurial-crew/tests/test-log.t.err @@ -626,12 +626,12 @@ $ hg log -b default changeset: 2:c3a4f03cc9a7 - parent: 0:24427303d56f + parent: 0:$HGPORT303d56f user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: commit on default ... [ original upstream message ] diff -r 3c5de8747a32 -r fb1e8925292d tests/run-tests.py --- a/tests/run-tests.py Wed Oct 20 17:38:21 2010 -0500 +++ b/tests/run-tests.py Mon Nov 01 10:24:07 2010 +0100 @@ -604,7 +604,7 @@ raise for s, r in replacements: - output = output.replace(s, r) + output = re.sub(s, r, output) return ret, splitnewlines(output) def runone(options, test, skips, fails): @@ -677,10 +677,10 @@ signal.alarm(options.timeout) ret, out = runner(testpath, options, [ - (testtmp, '$TESTTMP'), - (':%s' % options.port, ':$HGPORT'), - (':%s' % (options.port + 1), ':$HGPORT1'), - (':%s' % (options.port + 2), ':$HGPORT2'), + (re.escape(testtmp), '$TESTTMP'), + (r':%s\b' % options.port, ':$HGPORT'), + (r':%s\b' % (options.port + 1), ':$HGPORT1'), + (r':%s\b' % (options.port + 2), ':$HGPORT2'), ]) vlog("# Ret was:", ret)