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

Unified Diff: tools/telemetry/telemetry/cros_interface.py

Issue 11348217: [telemetry] Removing flake in wpr_server.py caused by static port assignment from chrome/test/funct… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move away from pylib Created 7 years, 11 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
Index: tools/telemetry/telemetry/cros_interface.py
diff --git a/tools/telemetry/telemetry/cros_interface.py b/tools/telemetry/telemetry/cros_interface.py
index 91a85746f8049f078de6b02eb9fe4f0412d5d6d7..6c6c8c8d7aaa3066ce9e318893e27f2a353ec4f1 100644
--- a/tools/telemetry/telemetry/cros_interface.py
+++ b/tools/telemetry/telemetry/cros_interface.py
@@ -204,6 +204,9 @@ class CrOSInterface(object):
self._hostname = hostname
self._ssh_identity = None
+ # List of ports generated from GetRemotePort() that may not be in use yet.
+ self._reserved_ports = []
+
if ssh_identity:
self._ssh_identity = os.path.abspath(os.path.expanduser(ssh_identity))
@@ -382,7 +385,12 @@ class CrOSInterface(object):
port_in_use = address_in_use.split(':')[-1]
ports_in_use.append(int(port_in_use))
- return sorted(ports_in_use)[-1] + 1
+ ports_in_use.extend(self._reserved_ports)
+
+ new_port = sorted(ports_in_use)[-1] + 1
+ self._reserved_ports.append(new_port)
+
+ return new_port
def IsHTTPServerRunningOnPort(self, port):
wget_output = self.GetAllCmdOutput(
« no previous file with comments | « tools/telemetry/telemetry/cros_browser_backend.py ('k') | tools/telemetry/telemetry/cros_interface_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698