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

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

Issue 22903016: [android] Adds constants.GetOutDirectory() and converts test scripts to use it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix provision_devices.py which never set the build type Created 7 years, 3 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/fake_dns.py ('k') | build/android/pylib/gtest/setup.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/forwarder.py
diff --git a/build/android/pylib/forwarder.py b/build/android/pylib/forwarder.py
index 0f4b1bc7131295b1f79340878e782e31b9231e52..807634a855a4a1a5438ffc088c729122816930c8 100644
--- a/build/android/pylib/forwarder.py
+++ b/build/android/pylib/forwarder.py
@@ -17,10 +17,6 @@ import constants
from pylib import valgrind_tools
-def _MakeBinaryPath(build_type, binary_name):
- return os.path.join(cmd_helper.OutDirectory.get(), build_type, binary_name)
-
-
def _GetProcessStartTime(pid):
return psutil.Process(pid).create_time
@@ -64,7 +60,7 @@ class Forwarder(object):
os.environ[Forwarder._MULTIPROCESSING_ENV_VAR] = '1'
@staticmethod
- def Map(port_pairs, adb, build_type='Debug', tool=None):
+ def Map(port_pairs, adb, tool=None):
"""Runs the forwarder.
Args:
@@ -83,7 +79,7 @@ class Forwarder(object):
if not tool:
tool = valgrind_tools.CreateTool(None, adb)
with _FileLock(Forwarder._LOCK_PATH):
- instance = Forwarder._GetInstanceLocked(build_type, tool)
+ instance = Forwarder._GetInstanceLocked(tool)
instance._InitDeviceLocked(adb, tool)
device_serial = adb.Adb().GetSerialNumber()
@@ -137,7 +133,7 @@ class Forwarder(object):
"""
with _FileLock(Forwarder._LOCK_PATH):
port_map = Forwarder._GetInstanceLocked(
- None, None)._device_to_host_port_map
+ None)._device_to_host_port_map
adb_serial = adb.Adb().GetSerialNumber()
for (device_serial, device_port) in port_map.keys():
if adb_serial == device_serial:
@@ -148,51 +144,43 @@ class Forwarder(object):
"""Returns the device port that corresponds to a given host port."""
with _FileLock(Forwarder._LOCK_PATH):
(device_serial, device_port) = Forwarder._GetInstanceLocked(
- None, None)._host_to_device_port_map.get(host_port)
+ None)._host_to_device_port_map.get(host_port)
return device_port
@staticmethod
- def _GetInstanceLocked(build_type, tool):
+ def _GetInstanceLocked(tool):
"""Returns the singleton instance.
Note that the global lock must be acquired before calling this method.
Args:
- build_type: 'Release' or 'Debug'
tool: Tool class to use to get wrapper, if necessary, for executing the
forwarder (see valgrind_tools.py).
"""
if not Forwarder._instance:
- Forwarder._instance = Forwarder(build_type, tool)
+ Forwarder._instance = Forwarder(tool)
return Forwarder._instance
- def __init__(self, build_type, tool):
+ def __init__(self, tool):
"""Constructs a new instance of Forwarder.
Note that Forwarder is a singleton therefore this constructor should be
called only once.
Args:
- build_type: 'Release' or 'Debug'
tool: Tool class to use to get wrapper, if necessary, for executing the
forwarder (see valgrind_tools.py).
"""
assert not Forwarder._instance
- self._build_type = build_type
self._tool = tool
self._initialized_devices = set()
self._device_to_host_port_map = dict()
self._host_to_device_port_map = dict()
- self._host_forwarder_path = _MakeBinaryPath(
- self._build_type, 'host_forwarder')
- if not os.path.exists(self._host_forwarder_path):
- self._build_type = 'Release' if self._build_type == 'Debug' else 'Debug'
- self._host_forwarder_path = _MakeBinaryPath(
- self._build_type, 'host_forwarder')
- assert os.path.exists(
- self._host_forwarder_path), 'Please build forwarder2'
+ self._host_forwarder_path = os.path.join(
+ constants.GetOutDirectory(), 'host_forwarder')
+ assert os.path.exists(self._host_forwarder_path), 'Please build forwarder2'
self._device_forwarder_path_on_host = os.path.join(
- cmd_helper.OutDirectory.get(), self._build_type, 'forwarder_dist')
+ constants.GetOutDirectory(), 'forwarder_dist')
self._InitHostLocked()
@staticmethod
@@ -201,7 +189,7 @@ class Forwarder(object):
Note that the global lock must be acquired before calling this method.
"""
- instance = Forwarder._GetInstanceLocked(None, None)
+ instance = Forwarder._GetInstanceLocked(None)
serial = adb.Adb().GetSerialNumber()
serial_with_port = (serial, device_port)
if not serial_with_port in instance._device_to_host_port_map:
« no previous file with comments | « build/android/pylib/fake_dns.py ('k') | build/android/pylib/gtest/setup.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698