Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1267)

Unified Diff: build/android/pylib/ports.py

Issue 11148018: Upstream the android python scripts changes that enable the new Forwarder2 to be used in our test f… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/pylib/forwarder.py ('k') | build/android/pylib/run_java_tests.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/ports.py
diff --git a/build/android/pylib/ports.py b/build/android/pylib/ports.py
index be994c362c74a0ec26f98688d72fb573fc20cfa6..e9b6b901e03d25497a1ac78749e891c0bf165a2c 100644
--- a/build/android/pylib/ports.py
+++ b/build/android/pylib/ports.py
@@ -46,6 +46,7 @@ def AllocateTestServerPort():
TEST_SERVER_PORT_LAST. Returning 0 means no more valid port can be used.
"""
port = 0
+ ports_tried = []
try:
fp_lock = open(constants.TEST_SERVER_PORT_LOCKFILE, 'w')
fcntl.flock(fp_lock, fcntl.LOCK_EX)
@@ -53,8 +54,10 @@ def AllocateTestServerPort():
assert os.path.exists(constants.TEST_SERVER_PORT_FILE)
with open(constants.TEST_SERVER_PORT_FILE, 'r+') as fp:
port = int(fp.read())
+ ports_tried.append(port)
while IsHostPortUsed(port):
port += 1
+ ports_tried.append(port)
if (port > constants.TEST_SERVER_PORT_LAST or
port < constants.TEST_SERVER_PORT_FIRST):
port = 0
@@ -67,7 +70,11 @@ def AllocateTestServerPort():
if fp_lock:
fcntl.flock(fp_lock, fcntl.LOCK_UN)
fp_lock.close()
- logging.info('Allocate port %d for test server.', port)
+ if port:
+ logging.info('Allocate port %d for test server.', port)
+ else:
+ logging.error('Could not allocate port for test server. '
+ 'List of ports tried: %s', str(ports_tried))
return port
« no previous file with comments | « build/android/pylib/forwarder.py ('k') | build/android/pylib/run_java_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698