[Android] Use more specific host platforms for devil.
BUG=566160,566170 Review URL: https://codereview.chromium.org/1501843002 Cr-Commit-Position: refs/heads/master@{#363488}
This commit is contained in:
.gitignore
build/android
tools/telemetry/telemetry/internal/platform
1
.gitignore
vendored
1
.gitignore
vendored
@ -57,6 +57,7 @@ v8.log
|
||||
/ash/ash_unittests_run.xml
|
||||
/base/base_unittests_run.xml
|
||||
/breakpad/src/
|
||||
/build/android/bin
|
||||
/build/Debug
|
||||
/build/Debug_x64
|
||||
/build/gomacc.lock
|
||||
|
@ -41,6 +41,7 @@ class _BaseCommandFailedError(CommandFailedError):
|
||||
message = ''.join(message)
|
||||
super(_BaseCommandFailedError, self).__init__(message, device_serial)
|
||||
|
||||
|
||||
class AdbCommandFailedError(_BaseCommandFailedError):
|
||||
"""Exception for adb command failures."""
|
||||
|
||||
@ -106,3 +107,11 @@ class NoDevicesError(base_error.BaseError):
|
||||
def __init__(self):
|
||||
super(NoDevicesError, self).__init__(
|
||||
'No devices attached.', is_infra_error=True)
|
||||
|
||||
|
||||
class NoAdbError(base_error.BaseError):
|
||||
"""Exception for being unable to find ADB."""
|
||||
|
||||
def __init__(self):
|
||||
super(NoAdbError, self).__init__(
|
||||
'Unable to find adb.', is_infra_error=True)
|
||||
|
@ -58,7 +58,10 @@ def _FindAdb():
|
||||
except dependency_manager.NoPathFoundError:
|
||||
pass
|
||||
|
||||
return devil_env.config.FetchPath('adb')
|
||||
try:
|
||||
return devil_env.config.FetchPath('adb')
|
||||
except dependency_manager.NoPathFoundError:
|
||||
raise device_errors.NoAdbError()
|
||||
|
||||
|
||||
DeviceStat = collections.namedtuple('DeviceStat',
|
||||
|
@ -5,7 +5,7 @@
|
||||
"cloud_storage_bucket": "chromium-telemetry",
|
||||
"cloud_storage_base_folder": "binary_dependencies",
|
||||
"file_info": {
|
||||
"android_host": {
|
||||
"android_linux2": {
|
||||
"cloud_storage_hash": "7448de3cb5e834afdedeaad8b40ba63ac53f3dc4",
|
||||
"download_path": "../bin/aapt"
|
||||
}
|
||||
@ -15,7 +15,7 @@
|
||||
"cloud_storage_bucket": "chromium-telemetry",
|
||||
"cloud_storage_base_folder": "binary_dependencies",
|
||||
"file_info": {
|
||||
"android_host": {
|
||||
"android_linux2": {
|
||||
"cloud_storage_hash": "0c2043552619c8ec8bb5d986ba75703a598611fc",
|
||||
"download_path": "../bin/adb"
|
||||
}
|
||||
@ -25,7 +25,7 @@
|
||||
"cloud_storage_bucket": "chromium-telemetry",
|
||||
"cloud_storage_base_folder": "binary_dependencies",
|
||||
"file_info": {
|
||||
"android_host": {
|
||||
"android_linux2": {
|
||||
"cloud_storage_hash": "52d150a7ccde835f38b4337392152f3013d5f303",
|
||||
"download_path": "../bin/lib/libc++.so"
|
||||
}
|
||||
@ -35,7 +35,7 @@
|
||||
"cloud_storage_bucket": "chromium-telemetry",
|
||||
"cloud_storage_base_folder": "binary_dependencies",
|
||||
"file_info": {
|
||||
"android_host": {
|
||||
"android_linux2": {
|
||||
"cloud_storage_hash": "38765b5b358c29003e56b1d214606ea13467b6fe",
|
||||
"download_path": "../bin/dexdump"
|
||||
}
|
||||
@ -59,7 +59,7 @@
|
||||
"cloud_storage_bucket": "chromium-telemetry",
|
||||
"cloud_storage_base_folder": "binary_dependencies",
|
||||
"file_info": {
|
||||
"android_host": {
|
||||
"android_linux2": {
|
||||
"cloud_storage_hash": "b3dda9fbdd4a3fb933b64111c11070aa809c7ed4",
|
||||
"download_path": "../bin/forwarder_host"
|
||||
}
|
||||
@ -87,7 +87,7 @@
|
||||
"cloud_storage_bucket": "chromium-telemetry",
|
||||
"cloud_storage_base_folder": "binary_dependencies",
|
||||
"file_info": {
|
||||
"android_host": {
|
||||
"android_linux2": {
|
||||
"cloud_storage_hash": "49e36c9c4246cfebef26cbd07436c1a8343254aa",
|
||||
"download_path": "../bin/md5sum_host"
|
||||
}
|
||||
@ -95,7 +95,17 @@
|
||||
},
|
||||
"pymock": {
|
||||
"file_info": {
|
||||
"android_host": {
|
||||
"android_darwin": {
|
||||
"local_paths": [
|
||||
"../../../tools/telemetry/third_party/mock"
|
||||
]
|
||||
},
|
||||
"android_linux2": {
|
||||
"local_paths": [
|
||||
"../../../tools/telemetry/third_party/mock"
|
||||
]
|
||||
},
|
||||
"android_win32": {
|
||||
"local_paths": [
|
||||
"../../../tools/telemetry/third_party/mock"
|
||||
]
|
||||
@ -106,7 +116,7 @@
|
||||
"cloud_storage_bucket": "chromium-telemetry",
|
||||
"cloud_storage_base_folder": "binary_dependencies",
|
||||
"file_info": {
|
||||
"android_host": {
|
||||
"android_linux2": {
|
||||
"cloud_storage_hash": "3327881fa3951a503b9467425ea8e781cdffeb9f",
|
||||
"download_path": "../bin/split-select"
|
||||
}
|
||||
|
@ -37,11 +37,11 @@ _DEVIL_DEFAULT_CONFIG = os.path.abspath(os.path.join(
|
||||
_LEGACY_ENVIRONMENT_VARIABLES = {
|
||||
'ADB_PATH': {
|
||||
'dependency_name': 'adb',
|
||||
'platform': 'android_host',
|
||||
'platform': 'android_linux2',
|
||||
},
|
||||
'ANDROID_SDK_ROOT': {
|
||||
'dependency_name': 'android_sdk',
|
||||
'platform': 'android_host',
|
||||
'platform': 'android_linux2',
|
||||
},
|
||||
}
|
||||
|
||||
@ -120,17 +120,17 @@ class _Environment(object):
|
||||
self.Initialize()
|
||||
if dependency in _ANDROID_BUILD_TOOLS:
|
||||
self.FetchPath('android_build_tools_libc++', arch=arch, device=device)
|
||||
return self._dm.FetchPath(dependency, _GetPlatform(arch, device))
|
||||
return self._dm.FetchPath(dependency, GetPlatform(arch, device))
|
||||
|
||||
def LocalPath(self, dependency, arch=None, device=None):
|
||||
if self._dm is None:
|
||||
self.Initialize()
|
||||
return self._dm.LocalPath(dependency, _GetPlatform(arch, device))
|
||||
return self._dm.LocalPath(dependency, GetPlatform(arch, device))
|
||||
|
||||
|
||||
def _GetPlatform(arch, device):
|
||||
def GetPlatform(arch=None, device=None):
|
||||
if not arch:
|
||||
arch = device.product_cpu_abi if device else 'host'
|
||||
arch = device.product_cpu_abi if device else sys.platform
|
||||
return 'android_%s' % arch
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
"dependencies": {
|
||||
"aapt": {
|
||||
"file_info": {
|
||||
"android_host": {
|
||||
"android_linux2": {
|
||||
"local_paths": [
|
||||
"../../third_party/android_tools/sdk/build-tools/23.0.0/aapt"
|
||||
]
|
||||
@ -12,7 +12,7 @@
|
||||
},
|
||||
"adb": {
|
||||
"file_info": {
|
||||
"android_host": {
|
||||
"android_linux2": {
|
||||
"local_paths": [
|
||||
"../../third_party/android_tools/sdk/platform-tools/adb"
|
||||
]
|
||||
@ -21,7 +21,7 @@
|
||||
},
|
||||
"android_sdk": {
|
||||
"file_info": {
|
||||
"android_host": {
|
||||
"android_linux2": {
|
||||
"local_paths": [
|
||||
"../../third_party/android_tools/sdk"
|
||||
]
|
||||
@ -30,7 +30,7 @@
|
||||
},
|
||||
"dexdump": {
|
||||
"file_info": {
|
||||
"android_host": {
|
||||
"android_linux2": {
|
||||
"local_paths": [
|
||||
"../../third_party/android_tools/sdk/build-tools/23.0.0/dexdump"
|
||||
]
|
||||
@ -39,7 +39,7 @@
|
||||
},
|
||||
"split-select": {
|
||||
"file_info": {
|
||||
"android_host": {
|
||||
"android_linux2": {
|
||||
"local_paths": [
|
||||
"../../third_party/android_tools/sdk/build-tools/23.0.0/split-select"
|
||||
]
|
||||
@ -48,7 +48,17 @@
|
||||
},
|
||||
"pymock": {
|
||||
"file_info": {
|
||||
"android_host": {
|
||||
"android_darwin": {
|
||||
"local_paths": [
|
||||
"../../third_party/pymock"
|
||||
]
|
||||
},
|
||||
"android_linux2": {
|
||||
"local_paths": [
|
||||
"../../third_party/pymock"
|
||||
]
|
||||
},
|
||||
"android_win32": {
|
||||
"local_paths": [
|
||||
"../../third_party/pymock"
|
||||
]
|
||||
|
@ -19,6 +19,7 @@ import unittest
|
||||
import devil_chromium
|
||||
|
||||
from devil import base_error
|
||||
from devil import devil_env
|
||||
from devil.android import apk_helper
|
||||
from devil.android import device_blacklist
|
||||
from devil.android import device_errors
|
||||
@ -122,7 +123,7 @@ def ProcessCommonOptions(args):
|
||||
if args.adb_path:
|
||||
devil_custom_deps = {
|
||||
'adb': {
|
||||
'android_host': [args.adb_path]
|
||||
devil_env.GetPlatform(): [args.adb_path]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ from telemetry.internal.platform.profiler import monsoon
|
||||
from devil.android import device_blacklist
|
||||
from devil.android import device_errors
|
||||
from devil.android import device_utils
|
||||
from pylib import constants
|
||||
from devil.android.sdk import adb_wrapper
|
||||
|
||||
|
||||
class AndroidDevice(device.Device):
|
||||
@ -132,9 +132,14 @@ def CanDiscoverDevices():
|
||||
if os.name != 'posix':
|
||||
return False
|
||||
|
||||
adb_path = constants.GetAdbPath()
|
||||
try:
|
||||
adb_path = adb_wrapper.AdbWrapper.GetAdbPath()
|
||||
except device_errors.NoAdbError:
|
||||
return False
|
||||
|
||||
if os.path.isabs(adb_path) and not os.path.exists(adb_path):
|
||||
return False
|
||||
|
||||
try:
|
||||
with open(os.devnull, 'w') as devnull:
|
||||
adb_process = subprocess.Popen(
|
||||
|
Reference in New Issue
Block a user