[PATCH 3 of 3 v2] run-tests: validate cached port in _getport

Yuya Nishihara yuya at tcha.org
Fri Jan 1 07:14:59 UTC 2016


On Mon, 28 Dec 2015 23:40:00 -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless at mozdev.org>
> # Date 1451364276 0
> #      Tue Dec 29 04:44:36 2015 +0000
> # Node ID ecd36680cdf2dd63864505f60ee14ed3ef84e864
> # Parent  a12404484af03ddddbd326af08ca1217b77ebc13
> run-tests: validate cached port in _getport
> 
> diff --git a/tests/run-tests.py b/tests/run-tests.py
> --- a/tests/run-tests.py
> +++ b/tests/run-tests.py
> @@ -2012,9 +2012,9 @@
>          return True
>  
>      def _getport(self, count):
> +        portneeded = 3
>          port = self._ports.get(count) # do we have a cached entry?
> -        if port is None:
> -            portneeded = 3
> +        if port is None or not self._checkportrange(port, portneeded):

I see no benefit to re-validate ports here because _getport() is called
repeatedly before running all tests.


More information about the Mercurial-devel mailing list