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

Side by Side Diff: devil/devil/android/forwarder.py

Issue 2587153002: [devil] Add a constant for forwarder device dynamic port allocation. (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # pylint: disable=W0212 5 # pylint: disable=W0212
6 6
7 import fcntl 7 import fcntl
8 import logging 8 import logging
9 import os 9 import os
10 import psutil 10 import psutil
11 11
12 from devil import base_error 12 from devil import base_error
13 from devil import devil_env 13 from devil import devil_env
14 from devil.android import device_errors 14 from devil.android import device_errors
15 from devil.android.constants import file_system 15 from devil.android.constants import file_system
16 from devil.android.valgrind_tools import base_tool 16 from devil.android.valgrind_tools import base_tool
17 from devil.utils import cmd_helper 17 from devil.utils import cmd_helper
18 18
19 logger = logging.getLogger(__name__) 19 logger = logging.getLogger(__name__)
20 20
21 # If passed as the device port, this will tell the forwarder to allocate
22 # a dynamic port on the device. The actual port can then be retrieved with
23 # Forwarder.DevicePortForHostPort.
24 DYNAMIC_DEVICE_PORT = 0
25
21 26
22 def _GetProcessStartTime(pid): 27 def _GetProcessStartTime(pid):
23 return psutil.Process(pid).create_time 28 return psutil.Process(pid).create_time
24 29
25 30
26 def _LogMapFailureDiagnostics(device): 31 def _LogMapFailureDiagnostics(device):
27 # The host forwarder daemon logs to /tmp/host_forwarder_log, so print the end 32 # The host forwarder daemon logs to /tmp/host_forwarder_log, so print the end
28 # of that. 33 # of that.
29 try: 34 try:
30 with open('/tmp/host_forwarder_log') as host_forwarder_log: 35 with open('/tmp/host_forwarder_log') as host_forwarder_log:
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 logger.info('Killing device_forwarder.') 449 logger.info('Killing device_forwarder.')
445 self._initialized_devices.discard(device.serial) 450 self._initialized_devices.discard(device.serial)
446 if not device.FileExists(Forwarder._DEVICE_FORWARDER_PATH): 451 if not device.FileExists(Forwarder._DEVICE_FORWARDER_PATH):
447 return 452 return
448 453
449 cmd = '%s %s --kill-server' % (tool.GetUtilWrapper(), 454 cmd = '%s %s --kill-server' % (tool.GetUtilWrapper(),
450 Forwarder._DEVICE_FORWARDER_PATH) 455 Forwarder._DEVICE_FORWARDER_PATH)
451 device.RunShellCommand( 456 device.RunShellCommand(
452 cmd, env={'LD_LIBRARY_PATH': Forwarder._DEVICE_FORWARDER_FOLDER}, 457 cmd, env={'LD_LIBRARY_PATH': Forwarder._DEVICE_FORWARDER_FOLDER},
453 check_return=True) 458 check_return=True)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698