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

Unified Diff: tools/telemetry/telemetry/core/backends/adb_commands.py

Issue 238513003: [Telemetry] Make Telemetry binaries platform aware. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move to util/ Created 6 years, 8 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/core/backends/adb_commands.py
diff --git a/tools/telemetry/telemetry/core/backends/adb_commands.py b/tools/telemetry/telemetry/core/backends/adb_commands.py
index 38111ac59a129026c7c1146370fb1770beb4161f..a7b4a4f7c29b9de6f328cd3e138f90d4fb521685 100644
--- a/tools/telemetry/telemetry/core/backends/adb_commands.py
+++ b/tools/telemetry/telemetry/core/backends/adb_commands.py
@@ -9,10 +9,10 @@ import logging
import os
import shutil
import stat
-import sys
from telemetry.core import util
-from telemetry.core.platform.profiler import android_prebuilt_profiler_helper
+from telemetry.core.platform import factory
+from telemetry.util import support_binaries
# This is currently a thin wrapper around Chrome Android's
# build scripts, located in chrome/build/android. This file exists mainly to
@@ -105,37 +105,44 @@ def GetBuildTypeOfPath(path):
def SetupPrebuiltTools(adb):
- # TODO(bulach): build the host tools for mac, and the targets for x86/mips.
- # Prebuilt tools from r226197.
- prebuilt_tools = [
- 'bitmaptools',
- 'file_poller',
- 'forwarder_dist/device_forwarder',
- 'host_forwarder',
- 'md5sum_dist/md5sum_bin',
- 'md5sum_bin_host',
- 'purge_ashmem',
+ """Some of the android pylib scripts we depend on are lame and expect
+ binaries to be in the out/ directory. So we copy any prebuilt binaries there
+ as a prereq."""
+
+ # TODO(bulach): Build the targets for x86/mips.
+ device_tools = [
+ 'file_poller',
+ 'forwarder_dist/device_forwarder',
+ 'md5sum_dist/md5sum_bin',
+ 'purge_ashmem',
]
- has_prebuilt = (
- sys.platform.startswith('linux') and
- adb.system_properties['ro.product.cpu.abi'].startswith('armeabi'))
- if not has_prebuilt:
- return all([util.FindSupportBinary(t) for t in prebuilt_tools])
+
+ host_tools = [
+ 'bitmaptools',
+ 'host_forwarder',
+ 'md5sum_bin_host',
+ ]
+
+ has_device_prebuilt = adb.system_properties['ro.product.cpu.abi'].startswith(
+ 'armeabi')
+ if not has_device_prebuilt:
+ return all([support_binaries.FindLocallyBuiltPath(t) for t in device_tools])
build_type = None
- for t in prebuilt_tools:
- src = os.path.basename(t)
- android_prebuilt_profiler_helper.GetIfChanged(src)
- bin_path = util.FindSupportBinary(t)
+ for t in device_tools + host_tools:
+ executable = os.path.basename(t)
+ locally_built_path = support_binaries.FindLocallyBuiltPath(t)
if not build_type:
- build_type = GetBuildTypeOfPath(bin_path) or 'Release'
+ build_type = GetBuildTypeOfPath(locally_built_path) or 'Release'
constants.SetBuildType(build_type)
dest = os.path.join(constants.GetOutDirectory(), t)
- if not bin_path:
- logging.warning('Setting up prebuilt %s', dest)
+ if not locally_built_path:
+ logging.info('Setting up prebuilt %s', dest)
if not os.path.exists(os.path.dirname(dest)):
os.makedirs(os.path.dirname(dest))
- prebuilt_path = android_prebuilt_profiler_helper.GetHostPath(src)
+ platform_name = ('android' if t in device_tools else
+ factory.GetPlatformBackendForCurrentOS().GetOSName())
+ prebuilt_path = support_binaries.FindPath(executable, platform_name)
if not os.path.exists(prebuilt_path):
raise NotImplementedError("""
%s must be checked into cloud storage.

Powered by Google App Engine
This is Rietveld 408576698