diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -2015,11 +2015,11 @@ class TestRunner(object): def _getport(self, count): port = self._ports.get(count) # do we have a cached entry? if port is None: - port = self.options.port + self._portoffset portneeded = 3 # above 100 tries we just give up and let test reports failure for tries in xrange(100): allfree = True + port = self.options.port + self._portoffset for idx in xrange(portneeded): if not checkportisavailable(port + idx): allfree = False diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t --- a/tests/test-run-tests.t +++ b/tests/test-run-tests.t @@ -223,6 +223,20 @@ Verify that when a process fails to star [1] $ rm test-serve-fail.t +Verify that we can try other ports +=================================== + $ hg init inuse + $ hg serve -R inuse -p $HGPORT -d --pid-file=blocks.pid + $ cat blocks.pid >> $DAEMON_PIDS + $ cat > test-serve-inuse.t < $ hg serve -R `pwd`/inuse -p \$HGPORT -d --pid-file=hg.pid + > $ cat hg.pid >> \$DAEMON_PIDS + > EOF + $ rt test-serve-inuse.t + . + # Ran 1 tests, 0 skipped, 0 warned, 0 failed. + $ rm test-serve-inuse.t + Running In Debug Mode ======================