Commit a0d4757e authored by ilevy@chromium.org's avatar ilevy@chromium.org

Specify admin port for local rietveld.

Latest dev appengine server defaults admin port to 8000
which isn't always available and can cause spurious
failures.

R=maruel@chromium.org

Review URL: https://chromiumcodereview.appspot.com/20904002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@214050 0039d316-1c4b-4281-b951-d872f2087c98
parent 9414599a
......@@ -39,15 +39,12 @@ def test_port(port):
s.close()
def find_free_port():
# Test to find an available port starting at 8080.
port = 8080
max_val = (2<<16)
while test_port(port) and port < max_val:
port += 1
if port == max_val:
raise Failure('Having issues finding an available port')
return port
def find_free_port(start_port):
"""Search for a free port starting at specified port."""
for port in xrange(start_port, (2<<16)):
if not test_port(port):
return port
raise Failure('Having issues finding an available port')
class LocalRietveld(object):
......@@ -110,7 +107,8 @@ class LocalRietveld(object):
self.install_prerequisites()
assert not self.tempdir
self.tempdir = tempfile.mkdtemp(prefix='rietveld_test')
self.port = find_free_port()
self.port = find_free_port(8080)
admin_port = find_free_port(self.port + 1)
if verbose:
stdout = stderr = None
else:
......@@ -121,6 +119,7 @@ class LocalRietveld(object):
self.dev_app,
'.',
'--port', str(self.port),
'--admin_port', str(admin_port),
'--storage', self.tempdir,
'--clear_search_indexes',
'--skip_sdk_update_check',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment