# HG changeset patch # User Matt Mackall # Date 1370210119 18000 # Node ID 79e201b6826a2d8049fde48019f27bf34a08f5e1 # Parent e9ad07011f870b2ac63cf8f38668a16b2f6c0b86 run-tests: use count to calculate port to use This will keep threads from using the same server ports [ original upstream message ] diff -r e9ad07011f87 -r 79e201b6826a tests/run-tests.py --- a/tests/run-tests.py Sun Jun 02 16:38:15 2013 -0500 +++ b/tests/run-tests.py Sun Jun 02 16:55:19 2013 -0500 @@ -362,13 +362,13 @@ hgrc.write('[%s]\n%s\n' % (section, key)) hgrc.close() -def createenv(options, testtmp, threadtmp): +def createenv(options, testtmp, threadtmp, port): env = os.environ.copy() env['TESTTMP'] = testtmp env['HOME'] = testtmp - env["HGPORT"] = str(options.port) - env["HGPORT1"] = str(options.port + 1) - env["HGPORT2"] = str(options.port + 2) + env["HGPORT"] = str(port) + env["HGPORT1"] = str(port + 1) + env["HGPORT2"] = str(port + 2) env["HGRCPATH"] = os.path.join(threadtmp, '.hgrc') env["DAEMON_PIDS"] = os.path.join(threadtmp, 'daemon.pids') env["HGEDITOR"] = sys.executable + ' -c "import sys; sys.exit(0)"' @@ -951,10 +951,11 @@ os.mkdir(threadtmp) os.mkdir(testtmp) + port = options.port + count * 3 replacements = [ - (r':%s\b' % options.port, ':$HGPORT'), - (r':%s\b' % (options.port + 1), ':$HGPORT1'), - (r':%s\b' % (options.port + 2), ':$HGPORT2'), + (r':%s\b' % port, ':$HGPORT'), + (r':%s\b' % (port + 1), ':$HGPORT1'), + (r':%s\b' % (port + 2), ':$HGPORT2'), ] if os.name == 'nt': replacements.append( @@ -966,7 +967,7 @@ else: replacements.append((re.escape(testtmp), '$TESTTMP')) - env = createenv(options, testtmp, threadtmp) + env = createenv(options, testtmp, threadtmp, port) createhgrc(env['HGRCPATH'], options) if options.time: