summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjbudorick <jbudorick@chromium.org>2015-10-05 14:43:48 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-05 21:45:17 +0000
commitf7280993a941acd40628664d108d7a7ed36be17e (patch)
treeabaa4b94c642330cc0abfe93357dceccbcc849a4
parent9cbf3fab244508983057d62f4583fc165ab5e73c (diff)
downloadchromium_src-f7280993a941acd40628664d108d7a7ed36be17e.zip
chromium_src-f7280993a941acd40628664d108d7a7ed36be17e.tar.gz
chromium_src-f7280993a941acd40628664d108d7a7ed36be17e.tar.bz2
Revert of [Android] Add a configurable environment for devil/. (patchset #12 id:220001 of https://codereview.chromium.org/1316413003/ )
Reason for revert: breaks on non-default output directories. Original issue's description: > [Android] Add a configurable environment for devil/. > > BUG=476719 > > Committed: https://crrev.com/975fc02186d195c3baf6f0380fed06433c636670 > Cr-Commit-Position: refs/heads/master@{#352359} TBR=aiolos@chromium.org,mikecase@chromium.org,nednguyen@google.com,perezju@chromium.org,rnephew@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=476719 Review URL: https://codereview.chromium.org/1390613002 Cr-Commit-Position: refs/heads/master@{#352436}
-rw-r--r--build/android/PRESUBMIT.py32
-rwxr-xr-xbuild/android/buildbot/bb_device_status_check.py3
-rw-r--r--build/android/devil/android/apk_helper.py3
-rwxr-xr-xbuild/android/devil/android/battery_utils_test.py6
-rwxr-xr-xbuild/android/devil/android/device_temp_file_test.py6
-rw-r--r--build/android/devil/android/device_utils.py4
-rwxr-xr-xbuild/android/devil/android/device_utils_test.py32
-rwxr-xr-xbuild/android/devil/android/logcat_monitor_test.py6
-rw-r--r--build/android/devil/android/md5sum.py7
-rwxr-xr-xbuild/android/devil/android/md5sum_test.py18
-rw-r--r--build/android/devil/android/sdk/aapt.py8
-rw-r--r--build/android/devil/android/sdk/adb_wrapper.py4
-rw-r--r--build/android/devil/android/sdk/dexdump.py5
-rwxr-xr-xbuild/android/devil/android/sdk/shared_prefs_test.py6
-rw-r--r--build/android/devil/android/sdk/split_select.py7
-rw-r--r--build/android/devil/devil_env.py159
-rw-r--r--build/android/devil/utils/lsusb.py2
-rw-r--r--build/android/devil/utils/mock_calls.py6
-rwxr-xr-xbuild/android/devil/utils/mock_calls_test.py5
-rw-r--r--build/android/devil_config.json63
-rwxr-xr-xbuild/android/provision_devices.py3
-rw-r--r--build/android/pylib/forwarder.py12
-rw-r--r--build/android/pylib/perf/test_runner.py2
-rw-r--r--build/android/pylintrc4
-rwxr-xr-xbuild/android/test_runner.py21
-rw-r--r--tools/telemetry/catapult_base/dependency_manager/dependency_manager.py4
26 files changed, 82 insertions, 346 deletions
diff --git a/build/android/PRESUBMIT.py b/build/android/PRESUBMIT.py
index d7a3ae1..a75bf94 100644
--- a/build/android/PRESUBMIT.py
+++ b/build/android/PRESUBMIT.py
@@ -12,12 +12,9 @@ details on the presubmit API built into depot_tools.
def CommonChecks(input_api, output_api):
output = []
- build_android_dir = input_api.PresubmitLocalPath()
- chromium_src_dir = input_api.os_path.join(build_android_dir, '..', '..')
-
def J(*dirs):
"""Returns a path relative to presubmit directory."""
- return input_api.os_path.join(build_android_dir, *dirs)
+ return input_api.os_path.join(input_api.PresubmitLocalPath(), *dirs)
build_pys = [
r'gyp/.*\.py$',
@@ -43,7 +40,7 @@ def CommonChecks(input_api, output_api):
pylib_test_env = dict(input_api.environ)
pylib_test_env.update({
- 'PYTHONPATH': build_android_dir,
+ 'PYTHONPATH': input_api.PresubmitLocalPath(),
'PYTHONDONTWRITEBYTECODE': '1',
})
output.extend(input_api.canned_checks.RunUnitTests(
@@ -51,6 +48,11 @@ def CommonChecks(input_api, output_api):
output_api,
unit_tests=[
J('.', 'emma_coverage_stats_test.py'),
+ J('devil', 'android', 'battery_utils_test.py'),
+ J('devil', 'android', 'device_utils_test.py'),
+ J('devil', 'android', 'md5sum_test.py'),
+ J('devil', 'android', 'logcat_monitor_test.py'),
+ J('devil', 'utils', 'timeout_retry_unittest.py'),
J('gyp', 'util', 'md5_check_test.py'),
J('pylib', 'base', 'test_dispatcher_unittest.py'),
J('pylib', 'gtest', 'gtest_test_instance_test.py'),
@@ -59,26 +61,6 @@ def CommonChecks(input_api, output_api):
J('pylib', 'results', 'json_results_test.py'),
],
env=pylib_test_env))
-
-
- devil_test_env = dict(pylib_test_env)
- devil_test_env.update({
- 'DEVIL_BINARY_DIR':
- input_api.os_path.join(chromium_src_dir, 'output', 'directory'),
- 'DEVIL_PYMOCK_PATH':
- input_api.os_path.join(chromium_src_dir, 'third_party', 'pymock')
- })
- output.extend(input_api.canned_checks.RunUnitTests(
- input_api,
- output_api,
- unit_tests=[
- J('devil', 'android', 'battery_utils_test.py'),
- J('devil', 'android', 'device_utils_test.py'),
- J('devil', 'android', 'md5sum_test.py'),
- J('devil', 'android', 'logcat_monitor_test.py'),
- J('devil', 'utils', 'timeout_retry_unittest.py'),
- ],
- env=devil_test_env))
return output
diff --git a/build/android/buildbot/bb_device_status_check.py b/build/android/buildbot/bb_device_status_check.py
index 22e264f..0a7cfd6 100755
--- a/build/android/buildbot/bb_device_status_check.py
+++ b/build/android/buildbot/bb_device_status_check.py
@@ -16,7 +16,6 @@ import signal
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
-from devil import devil_env
from devil.android import battery_utils
from devil.android import device_blacklist
from devil.android import device_errors
@@ -288,8 +287,6 @@ def main():
run_tests_helper.SetLogLevel(args.verbose)
- devil_env.config.Initialize()
-
blacklist = (device_blacklist.Blacklist(args.blacklist_file)
if args.blacklist_file
else None)
diff --git a/build/android/devil/android/apk_helper.py b/build/android/devil/android/apk_helper.py
index 7d2740a..27a7ed4 100644
--- a/build/android/devil/android/apk_helper.py
+++ b/build/android/devil/android/apk_helper.py
@@ -4,11 +4,14 @@
"""Module containing utilities for apk packages."""
+import os.path
import re
from devil.android.sdk import aapt
+from pylib import constants
+_AAPT_PATH = os.path.join(constants.ANDROID_SDK_TOOLS, 'aapt')
_MANIFEST_ATTRIBUTE_RE = re.compile(
r'\s*A: ([^\(\)= ]*)\([^\(\)= ]*\)=(?:"(.*)" \(Raw: .*\)|\(type.*?\)(.*))$')
_MANIFEST_ELEMENT_RE = re.compile(r'\s*(?:E|N): (\S*) .*$')
diff --git a/build/android/devil/android/battery_utils_test.py b/build/android/devil/android/battery_utils_test.py
index 7057bcd..64253a5 100755
--- a/build/android/devil/android/battery_utils_test.py
+++ b/build/android/devil/android/battery_utils_test.py
@@ -10,17 +10,19 @@ Unit tests for the contents of battery_utils.py
# pylint: disable=protected-access,unused-argument
import logging
+import os
import sys
import unittest
-from devil import devil_env
from devil.android import battery_utils
from devil.android import device_errors
from devil.android import device_utils
from devil.android import device_utils_test
from devil.utils import mock_calls
+from pylib import constants
-sys.path.append(devil_env.config.pymock_path)
+sys.path.append(os.path.join(
+ constants.DIR_SOURCE_ROOT, 'third_party', 'pymock'))
import mock # pylint: disable=F0401
_DUMPSYS_OUTPUT = [
diff --git a/build/android/devil/android/device_temp_file_test.py b/build/android/devil/android/device_temp_file_test.py
index 6ba7089..76f9cc8 100755
--- a/build/android/devil/android/device_temp_file_test.py
+++ b/build/android/devil/android/device_temp_file_test.py
@@ -8,16 +8,18 @@ Unit tests for the contents of device_temp_file.py.
"""
import logging
+import os
import sys
import unittest
-from devil import devil_env
from devil.android import device_errors
from devil.android import device_temp_file
from devil.android.sdk import adb_wrapper
from devil.utils import mock_calls
+from pylib import constants
-sys.path.append(devil_env.config.pymock_path)
+sys.path.append(os.path.join(
+ constants.DIR_SOURCE_ROOT, 'third_party', 'pymock'))
import mock # pylint: disable=F0401
class DeviceTempFileTest(mock_calls.TestCase):
diff --git a/build/android/devil/android/device_utils.py b/build/android/devil/android/device_utils.py
index 6dab7eb..5f3fd23 100644
--- a/build/android/devil/android/device_utils.py
+++ b/build/android/devil/android/device_utils.py
@@ -22,7 +22,6 @@ import time
import zipfile
from devil import base_error
-from devil import devil_env
from devil.utils import cmd_helper
from devil.android import apk_helper
from devil.android import device_signal
@@ -41,6 +40,7 @@ from devil.utils import parallelizer
from devil.utils import reraiser_thread
from devil.utils import timeout_retry
from devil.utils import zip_utils
+from pylib import constants
from pylib.device.commands import install_commands
_DEFAULT_TIMEOUT = 30
@@ -104,7 +104,7 @@ def GetAVDs():
A list containing the configured AVDs.
"""
lines = cmd_helper.GetCmdOutput([
- os.path.join(devil_env.config.android_sdk_path, 'tools', 'android'),
+ os.path.join(constants.ANDROID_SDK_ROOT, 'tools', 'android'),
'list', 'avd']).splitlines()
avds = []
for line in lines:
diff --git a/build/android/devil/android/device_utils_test.py b/build/android/devil/android/device_utils_test.py
index d10e6ea..4cb4591 100755
--- a/build/android/devil/android/device_utils_test.py
+++ b/build/android/devil/android/device_utils_test.py
@@ -11,10 +11,10 @@ Unit tests for the contents of device_utils.py (mostly DeviceUtils).
# pylint: disable=unused-argument
import logging
+import os
import sys
import unittest
-from devil import devil_env
from devil.android import device_errors
from devil.android import device_signal
from devil.android import device_utils
@@ -23,8 +23,10 @@ from devil.android.sdk import intent
from devil.android.sdk import version_codes
from devil.utils import cmd_helper
from devil.utils import mock_calls
+from pylib import constants
-sys.path.append(devil_env.config.pymock_path)
+sys.path.append(os.path.join(
+ constants.DIR_SOURCE_ROOT, 'third_party', 'pymock'))
import mock # pylint: disable=F0401
@@ -56,21 +58,17 @@ class DeviceUtilsInitTest(unittest.TestCase):
class DeviceUtilsGetAVDsTest(mock_calls.TestCase):
def testGetAVDs(self):
- mocked_attrs = {
- 'android_sdk_path': '/my/sdk/path'
- }
- with mock.patch('devil.devil_env._Environment.__getattr__',
- mock.Mock(side_effect=lambda a: mocked_attrs[a])):
- with self.assertCall(
- mock.call.devil.utils.cmd_helper.GetCmdOutput(
- [mock.ANY, 'list', 'avd']),
- 'Available Android Virtual Devices:\n'
- ' Name: my_android5.0\n'
- ' Path: /some/path/to/.android/avd/my_android5.0.avd\n'
- ' Target: Android 5.0 (API level 21)\n'
- ' Tag/ABI: default/x86\n'
- ' Skin: WVGA800\n'):
- self.assertEquals(['my_android5.0'], device_utils.GetAVDs())
+ with self.assertCall(
+ mock.call.devil.utils.cmd_helper.GetCmdOutput(
+ [mock.ANY, 'list', 'avd']),
+ 'Available Android Virtual Devices:\n'
+ ' Name: my_android5.0\n'
+ ' Path: /some/path/to/.android/avd/my_android5.0.avd\n'
+ ' Target: Android 5.0 (API level 21)\n'
+ ' Tag/ABI: default/x86\n'
+ ' Skin: WVGA800\n'):
+ self.assertEquals(['my_android5.0'],
+ device_utils.GetAVDs())
class DeviceUtilsRestartServerTest(mock_calls.TestCase):
diff --git a/build/android/devil/android/logcat_monitor_test.py b/build/android/devil/android/logcat_monitor_test.py
index 7a49c5d..2b7969c 100755
--- a/build/android/devil/android/logcat_monitor_test.py
+++ b/build/android/devil/android/logcat_monitor_test.py
@@ -6,14 +6,16 @@
# pylint: disable=protected-access
import itertools
+import os
import sys
import unittest
-from devil import devil_env
from devil.android import logcat_monitor
from devil.android.sdk import adb_wrapper
+from pylib import constants
-sys.path.append(devil_env.config.pymock_path)
+sys.path.append(os.path.join(
+ constants.DIR_SOURCE_ROOT, 'third_party', 'pymock'))
import mock # pylint: disable=F0401
diff --git a/build/android/devil/android/md5sum.py b/build/android/devil/android/md5sum.py
index 7b12af5..dbd988f 100644
--- a/build/android/devil/android/md5sum.py
+++ b/build/android/devil/android/md5sum.py
@@ -6,9 +6,9 @@ import os
import posixpath
import re
-from devil import devil_env
from devil.android import device_errors
from devil.utils import cmd_helper
+from pylib import constants
MD5SUM_DEVICE_LIB_PATH = '/data/local/tmp/md5sum'
MD5SUM_DEVICE_BIN_PATH = MD5SUM_DEVICE_LIB_PATH + '/md5sum_bin'
@@ -30,7 +30,8 @@ def CalculateHostMd5Sums(paths):
if isinstance(paths, basestring):
paths = [paths]
- md5sum_bin_host_path = devil_env.config.md5sum_host_path
+ md5sum_bin_host_path = os.path.join(
+ constants.GetOutDirectory(), 'md5sum_bin_host')
if not os.path.exists(md5sum_bin_host_path):
raise IOError('File not built: %s' % md5sum_bin_host_path)
out = cmd_helper.GetCmdOutput([md5sum_bin_host_path] + [p for p in paths])
@@ -57,7 +58,7 @@ def CalculateDeviceMd5Sums(paths, device):
# Allow generators
paths = list(paths)
- md5sum_dist_path = devil_env.config.md5sum_device_path
+ md5sum_dist_path = os.path.join(constants.GetOutDirectory(), 'md5sum_dist')
md5sum_dist_bin_path = os.path.join(md5sum_dist_path, 'md5sum_bin')
if not os.path.exists(md5sum_dist_path):
diff --git a/build/android/devil/android/md5sum_test.py b/build/android/devil/android/md5sum_test.py
index 4cb5094..e9481b6 100755
--- a/build/android/devil/android/md5sum_test.py
+++ b/build/android/devil/android/md5sum_test.py
@@ -7,29 +7,25 @@ import os
import sys
import unittest
-from devil import devil_env
from devil.android import device_errors
from devil.android import md5sum
+from pylib import constants
-sys.path.append(devil_env.config.pymock_path)
+sys.path.append(
+ os.path.join(constants.DIR_SOURCE_ROOT, 'third_party', 'pymock'))
import mock # pylint: disable=import-error
TEST_OUT_DIR = os.path.join('test', 'out', 'directory')
HOST_MD5_EXECUTABLE = os.path.join(TEST_OUT_DIR, 'md5sum_bin_host')
-MD5_DIST = os.path.join(TEST_OUT_DIR, 'md5sum_dist')
class Md5SumTest(unittest.TestCase):
def setUp(self):
- mocked_attrs = {
- 'md5sum_host_path': HOST_MD5_EXECUTABLE,
- 'md5sum_device_path': MD5_DIST,
- }
self._patchers = [
- mock.patch('devil.devil_env._Environment.__getattr__',
- mock.Mock(side_effect=lambda a: mocked_attrs[a])),
- mock.patch('os.path.exists',
- new=mock.Mock(return_value=True)),
+ mock.patch('pylib.constants.GetOutDirectory',
+ new=mock.Mock(return_value=TEST_OUT_DIR)),
+ mock.patch('os.path.exists',
+ new=mock.Mock(return_value=True)),
]
for p in self._patchers:
p.start()
diff --git a/build/android/devil/android/sdk/aapt.py b/build/android/devil/android/sdk/aapt.py
index c2efb50..1c051e0 100644
--- a/build/android/devil/android/sdk/aapt.py
+++ b/build/android/devil/android/sdk/aapt.py
@@ -6,9 +6,10 @@
import os
-from devil import devil_env
from devil.utils import cmd_helper
+from pylib import constants
+_AAPT_PATH = os.path.join(constants.ANDROID_SDK_TOOLS, 'aapt')
def _RunAaptCmd(args):
"""Runs an aapt command.
@@ -19,16 +20,13 @@ def _RunAaptCmd(args):
Returns:
The output of the command.
"""
- aapt_path = os.path.join(
- devil_env.config.android_sdk_build_tools_path, 'aapt')
- cmd = [aapt_path] + args
+ cmd = [_AAPT_PATH] + args
status, output = cmd_helper.GetCmdStatusAndOutput(cmd)
if status != 0:
raise Exception('Failed running aapt command: "%s" with output "%s".' %
(' '.join(cmd), output))
return output
-
def Dump(what, apk, assets=None):
"""Returns the output of the aapt dump command.
diff --git a/build/android/devil/android/sdk/adb_wrapper.py b/build/android/devil/android/sdk/adb_wrapper.py
index 63ccc83..5a81c7f 100644
--- a/build/android/devil/android/sdk/adb_wrapper.py
+++ b/build/android/devil/android/sdk/adb_wrapper.py
@@ -14,11 +14,11 @@ import logging
import os
import re
-from devil import devil_env
from devil.android import decorators
from devil.android import device_errors
from devil.utils import cmd_helper
from devil.utils import timeout_retry
+from pylib import constants
_DEFAULT_TIMEOUT = 30
@@ -66,7 +66,7 @@ class AdbWrapper(object):
cmd = ['taskset', '-c', str(cpu_affinity)]
else:
cmd = []
- cmd.append(devil_env.config.adb_path)
+ cmd.append(constants.GetAdbPath())
if device_serial is not None:
cmd.extend(['-s', device_serial])
cmd.extend(args)
diff --git a/build/android/devil/android/sdk/dexdump.py b/build/android/devil/android/sdk/dexdump.py
index c6a084c..48d810f 100644
--- a/build/android/devil/android/sdk/dexdump.py
+++ b/build/android/devil/android/sdk/dexdump.py
@@ -4,11 +4,10 @@
import os
-from devil import devil_env
from devil.utils import cmd_helper
+from pylib import constants
-_DEXDUMP_PATH = os.path.join(
- devil_env.config.android_sdk_build_tools_path, 'dexdump')
+_DEXDUMP_PATH = os.path.join(constants.ANDROID_SDK_TOOLS, 'dexdump')
def DexDump(dexfiles, file_summary=False):
"""A wrapper around the Android SDK's dexdump tool.
diff --git a/build/android/devil/android/sdk/shared_prefs_test.py b/build/android/devil/android/sdk/shared_prefs_test.py
index 7623f6c..63d9aec 100755
--- a/build/android/devil/android/sdk/shared_prefs_test.py
+++ b/build/android/devil/android/sdk/shared_prefs_test.py
@@ -8,14 +8,16 @@ Unit tests for the contents of shared_prefs.py (mostly SharedPrefs).
"""
import logging
+import os
import sys
import unittest
-from devil import devil_env
from devil.android import device_utils
from devil.android.sdk import shared_prefs
+from pylib import constants
-sys.path.append(devil_env.config.pymock_path)
+sys.path.append(os.path.join(
+ constants.DIR_SOURCE_ROOT, 'third_party', 'pymock'))
import mock # pylint: disable=import-error
diff --git a/build/android/devil/android/sdk/split_select.py b/build/android/devil/android/sdk/split_select.py
index 4e20bee..47fcea3c 100644
--- a/build/android/devil/android/sdk/split_select.py
+++ b/build/android/devil/android/sdk/split_select.py
@@ -6,9 +6,10 @@
import os
-from devil import devil_env
from devil.utils import cmd_helper
+from pylib import constants
+_SPLIT_SELECT_PATH = os.path.join(constants.ANDROID_SDK_TOOLS, 'split-select')
def _RunSplitSelectCmd(args):
"""Runs a split-select command.
@@ -19,9 +20,7 @@ def _RunSplitSelectCmd(args):
Returns:
The output of the command.
"""
- split_select_path = os.path.join(
- devil_env.config.android_sdk_build_tools_path, 'split-select')
- cmd = [split_select_path] + args
+ cmd = [_SPLIT_SELECT_PATH] + args
status, output = cmd_helper.GetCmdStatusAndOutput(cmd)
if status != 0:
raise Exception('Failed running command "%s" with output "%s".' %
diff --git a/build/android/devil/devil_env.py b/build/android/devil/devil_env.py
deleted file mode 100644
index 1fc0220..0000000
--- a/build/android/devil/devil_env.py
+++ /dev/null
@@ -1,159 +0,0 @@
-# Copyright 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import json
-import logging
-import os
-import sys
-import tempfile
-import threading
-
-# TODO(jbudorick): Update this once dependency_manager moves to catapult.
-_TELEMETRY_PATH = os.path.abspath(os.path.join(
- os.path.dirname(__file__), os.pardir, os.pardir, os.pardir,
- 'tools', 'telemetry'))
-sys.path.append(_TELEMETRY_PATH)
-from catapult_base import dependency_manager # pylint: disable=import-error
-
-
-_DEFAULT_CONFIG_FILES = [
- os.path.abspath(os.path.join(
- os.path.dirname(__file__), os.pardir, 'devil_config.json')),
-]
-
-
-class _Environment(object):
-
- def __init__(self):
- self._config = None
- self._config_init_lock = threading.Lock()
-
- def Initialize(self, configs=None, config_files=None):
- """Initialize devil's environment.
-
- This uses all configurations provided via |configs| and |config_files|
- to determine the locations of devil's dependencies. Configurations should
- all take the form described by catapult_base.dependency_manager.BaseConfig.
- If no configurations are provided, a default one will be used if available.
-
- Args:
- configs: An optional list of dict configurations.
- config_files: An optional list of files to load
- """
-
- # Make sure we only initialize self._config once.
- with self._config_init_lock:
- if self._config is not None:
- return
- self._config = {}
-
- self._InitializeRecursive(configs=configs, config_files=config_files)
-
- def _InitializeRecursive(self, configs=None, config_files=None):
- # This recurses through configs to create temporary files for each and
- # take advantage of context managers to appropriately close those files.
- # TODO(jbudorick): Remove this recursion if/when dependency_manager
- # supports loading configurations directly from a dict.
- if configs:
- with tempfile.NamedTemporaryFile() as next_config_file:
- next_config_file.write(json.dumps(configs[0]))
- next_config_file.flush()
- self._InitializeRecursive(
- configs=configs[1:],
- config_files=[next_config_file.name] + (config_files or []))
- else:
- self._InitializeImpl(config_files)
-
- def _InitializeImpl(self, config_files):
- if not config_files:
- config_files = _DEFAULT_CONFIG_FILES
-
- dm = dependency_manager.DependencyManager(
- [dependency_manager.BaseConfig(c) for c in config_files])
- platform = 'linux_android'
-
- android_sdk_path = dm.FetchPath('android_sdk', platform)
-
- if os.path.exists(android_sdk_path):
- self._config['android_sdk_path'] = android_sdk_path
-
- # Chromium's hooks always download the SDK extras even if they aren't
- # downloading the SDK, so we have to check for the existence of the
- # particular components we care about.
-
- try:
- adb_path = dm.FetchPath('adb_path', platform)
- except dependency_manager.NoPathFoundError:
- adb_path = os.path.join(
- self.android_sdk_path, 'platform-tools', 'adb')
- if os.path.exists(adb_path):
- self._config['adb_path'] = adb_path
-
- build_tools_path = os.path.join(self.android_sdk_path, 'build-tools')
- if os.path.exists(build_tools_path):
- build_tools_contents = os.listdir(build_tools_path)
- if build_tools_contents:
- if len(build_tools_contents) > 1:
- build_tools_contents.sort()
- logging.warning(
- 'More than one set of build-tools provided by the Android SDK:'
- ' %s', ','.join(build_tools_contents))
- logging.warning('Defaulting to %s', build_tools_contents[-1])
- self._config['android_sdk_build_tools_path'] = os.path.join(
- self.android_sdk_path, 'build-tools', build_tools_contents[-1])
-
- try:
- self._config['forwarder_host_path'] = dm.FetchPath(
- 'forwarder_host', platform)
- self._config['forwarder_device_path'] = dm.FetchPath(
- 'forwarder_device', platform)
- except dependency_manager.NoPathFoundError as e:
- logging.warning(str(e))
-
- try:
- self._config['md5sum_host_path'] = dm.FetchPath('md5sum_host', platform)
- self._config['md5sum_device_path'] = dm.FetchPath(
- 'md5sum_device', platform)
- except dependency_manager.NoPathFoundError as e:
- logging.warning(str(e))
-
- try:
- self._config['pymock_path'] = dm.FetchPath('pymock', platform)
- except dependency_manager.NoPathFoundError as e:
- logging.warning(str(e))
-
- def __getattr__(self, name):
- if self._config is None:
- self.Initialize()
-
- if name not in self._config:
- raise AttributeError('devil environment has no %r attribute' % name)
-
- return self._config[name]
-
-
-config = _Environment()
-
-
-def GenerateDynamicConfig(deps):
- """Generate a configuration dict from the provided deps dict.
-
- Args:
- deps: A dict mapping dependency names to lists of local files.
- Returns:
- A BaseConfig-compatible dict.
- """
- return {
- 'config_type': 'BaseConfig',
- 'dependencies': {
- k: {
- 'file_info': {
- 'linux_android': {
- 'local_paths': v
- }
- }
- } for k, v in deps.iteritems()
- }
- }
-
diff --git a/build/android/devil/utils/lsusb.py b/build/android/devil/utils/lsusb.py
index d322e5c..9c98fa6 100644
--- a/build/android/devil/utils/lsusb.py
+++ b/build/android/devil/utils/lsusb.py
@@ -5,7 +5,7 @@
import logging
import re
-from devil.utils import cmd_helper
+from pylib import cmd_helper
_INDENTATION_RE = re.compile(r'^( *)')
_LSUSB_BUS_DEVICE_RE = re.compile(r'^Bus (\d{3}) Device (\d{3}):')
diff --git a/build/android/devil/utils/mock_calls.py b/build/android/devil/utils/mock_calls.py
index 5c01d01..59167ba 100644
--- a/build/android/devil/utils/mock_calls.py
+++ b/build/android/devil/utils/mock_calls.py
@@ -6,12 +6,14 @@
A test facility to assert call sequences while mocking their behavior.
"""
+import os
import sys
import unittest
-from devil import devil_env
+from pylib import constants
-sys.path.append(devil_env.config.pymock_path)
+sys.path.append(os.path.join(
+ constants.DIR_SOURCE_ROOT, 'third_party', 'pymock'))
import mock # pylint: disable=F0401
diff --git a/build/android/devil/utils/mock_calls_test.py b/build/android/devil/utils/mock_calls_test.py
index 6caa543..ae2acbb 100755
--- a/build/android/devil/utils/mock_calls_test.py
+++ b/build/android/devil/utils/mock_calls_test.py
@@ -12,11 +12,12 @@ import os
import sys
import unittest
-from devil import devil_env
from devil.android.sdk import version_codes
from devil.utils import mock_calls
+from pylib import constants
-sys.path.append(devil_env.config.pymock_path)
+sys.path.append(os.path.join(
+ constants.DIR_SOURCE_ROOT, 'third_party', 'pymock'))
import mock # pylint: disable=F0401
diff --git a/build/android/devil_config.json b/build/android/devil_config.json
deleted file mode 100644
index 2516656..0000000
--- a/build/android/devil_config.json
+++ /dev/null
@@ -1,63 +0,0 @@
-{
- "config_type": "BaseConfig",
- "dependencies": {
- "android_sdk": {
- "file_info": {
- "linux_android": {
- "local_paths": [
- "../../third_party/android_tools/sdk"
- ]
- }
- }
- },
- "forwarder_device": {
- "file_info": {
- "linux_android": {
- "local_paths": [
- "../../out/Debug/forwarder_dist",
- "../../out/Release/forwarder_dist"
- ]
- }
- }
- },
- "forwarder_host": {
- "file_info": {
- "linux_android": {
- "local_paths": [
- "../../out/Debug/host_forwarder",
- "../../out/Release/host_forwarder"
- ]
- }
- }
- },
- "md5sum_device": {
- "file_info": {
- "linux_android": {
- "local_paths": [
- "../../out/Debug/md5sum_dist",
- "../../out/Release/md5sum_dist"
- ]
- }
- }
- },
- "md5sum_host": {
- "file_info": {
- "linux_android": {
- "local_paths": [
- "../../out/Debug/md5sum_bin_host",
- "../../out/Release/md5sum_bin_host"
- ]
- }
- }
- },
- "pymock": {
- "file_info": {
- "linux_android": {
- "local_paths": [
- "../../third_party/pymock"
- ]
- }
- }
- }
- }
-}
diff --git a/build/android/provision_devices.py b/build/android/provision_devices.py
index e7bb5d2..745248b 100755
--- a/build/android/provision_devices.py
+++ b/build/android/provision_devices.py
@@ -21,7 +21,6 @@ import subprocess
import sys
import time
-from devil import devil_env
from devil.android import battery_utils
from devil.android import device_blacklist
from devil.android import device_errors
@@ -483,8 +482,6 @@ def main():
run_tests_helper.SetLogLevel(args.verbose)
- devil_env.config.Initialize()
-
return ProvisionDevices(args)
diff --git a/build/android/pylib/forwarder.py b/build/android/pylib/forwarder.py
index ba4d51a..17a0114 100644
--- a/build/android/pylib/forwarder.py
+++ b/build/android/pylib/forwarder.py
@@ -9,7 +9,6 @@ import logging
import os
import psutil
-from devil import devil_env
from devil.utils import cmd_helper
from pylib import constants
from pylib import valgrind_tools
@@ -78,7 +77,7 @@ class Forwarder(object):
device_serial = str(device)
redirection_commands = [
- ['--adb=' + devil_env.config.adb_path,
+ ['--adb=' + constants.GetAdbPath(),
'--serial-id=' + device_serial,
'--map', str(device_port), str(host_port)]
for device_port, host_port in port_pairs]
@@ -198,10 +197,11 @@ class Forwarder(object):
self._initialized_devices = set()
self._device_to_host_port_map = dict()
self._host_to_device_port_map = dict()
- self._host_forwarder_path = devil_env.config.forwarder_host_path
+ 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 = (
- devil_env.config.forwarder_device_path)
+ self._device_forwarder_path_on_host = os.path.join(
+ constants.GetOutDirectory(), 'forwarder_dist')
self._InitHostLocked()
@staticmethod
@@ -216,7 +216,7 @@ class Forwarder(object):
if not serial_with_port in instance._device_to_host_port_map:
logging.error('Trying to unmap non-forwarded port %d', device_port)
return
- redirection_command = ['--adb=' + devil_env.config.adb_path,
+ redirection_command = ['--adb=' + constants.GetAdbPath(),
'--serial-id=' + serial,
'--unmap', str(device_port)]
logging.info('Undo forwarding using command: %s', redirection_command)
diff --git a/build/android/pylib/perf/test_runner.py b/build/android/pylib/perf/test_runner.py
index 38887f3..26e17ad 100644
--- a/build/android/pylib/perf/test_runner.py
+++ b/build/android/pylib/perf/test_runner.py
@@ -74,7 +74,6 @@ _GIT_CR_POS_RE = re.compile(r'^Cr-Commit-Position: refs/heads/master@{#(\d+)}$')
def _GetChromiumRevision():
- # pylint: disable=line-too-long
"""Get the git hash and commit position of the chromium master branch.
See: https://chromium.googlesource.com/chromium/tools/build/+/master/scripts/slave/runtest.py#212
@@ -82,7 +81,6 @@ def _GetChromiumRevision():
Returns:
A dictionary with 'revision' and 'commit_pos' keys.
"""
- # pylint: enable=line-too-long
status, output = cmd_helper.GetCmdStatusAndOutput(
['git', 'log', '-n', '1', '--pretty=format:%H%n%B', 'HEAD'],
constants.DIR_SOURCE_ROOT)
diff --git a/build/android/pylintrc b/build/android/pylintrc
index 8005a5d..9c2ab5a 100644
--- a/build/android/pylintrc
+++ b/build/android/pylintrc
@@ -1,7 +1,3 @@
-[FORMAT]
-
-max-line-length=80
-
[MESSAGES CONTROL]
disable=abstract-class-not-used,bad-continuation,bad-indentation,duplicate-code,fixme,invalid-name,locally-disabled,locally-enabled,missing-docstring,star-args,too-few-public-methods,too-many-arguments,too-many-branches,too-many-instance-attributes,too-many-lines,too-many-locals,too-many-public-methods,too-many-statements,
diff --git a/build/android/test_runner.py b/build/android/test_runner.py
index a804e63..16a2260 100755
--- a/build/android/test_runner.py
+++ b/build/android/test_runner.py
@@ -17,7 +17,6 @@ import threading
import unittest
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
@@ -50,10 +49,6 @@ from pylib.uiautomator import setup as uiautomator_setup
from pylib.uiautomator import test_options as uiautomator_test_options
-_DEVIL_STATIC_CONFIG_FILE = os.path.abspath(os.path.join(
- constants.DIR_SOURCE_ROOT, 'build', 'android', 'devil_config.json'))
-
-
def AddCommonOptions(parser):
"""Adds all common options to |parser|."""
@@ -118,22 +113,6 @@ def ProcessCommonOptions(args):
constants.SetOutputDirectory(args.output_directory)
if args.adb_path:
constants.SetAdbPath(args.adb_path)
-
- output_binary = lambda p: os.path.join(constants.GetOutDirectory(), p)
- devil_dynamic_deps = {
- 'md5sum_host': [output_binary('md5sum_bin_host')],
- 'md5sum_device': [output_binary('md5sum_dist')],
- 'forwarder_host': [output_binary('host_forwarder')],
- 'forwarder_device': [output_binary('forwarder_dist')],
- }
- if args.adb_path:
- devil_dynamic_deps['adb_path'] = [args.adb_path]
-
- devil_dynamic_config = devil_env.GenerateDynamicConfig(devil_dynamic_deps)
- devil_env.config.Initialize(
- configs=[devil_dynamic_config],
- config_files=[_DEVIL_STATIC_CONFIG_FILE])
-
# Some things such as Forwarder require ADB to be in the environment path.
adb_dir = os.path.dirname(constants.GetAdbPath())
if adb_dir and adb_dir not in os.environ['PATH'].split(os.pathsep):
diff --git a/tools/telemetry/catapult_base/dependency_manager/dependency_manager.py b/tools/telemetry/catapult_base/dependency_manager/dependency_manager.py
index 485667f1..29f389f 100644
--- a/tools/telemetry/catapult_base/dependency_manager/dependency_manager.py
+++ b/tools/telemetry/catapult_base/dependency_manager/dependency_manager.py
@@ -89,6 +89,8 @@ class DependencyManager(object):
"""
dependency_info = self._GetDependencyInfo(dependency, platform)
if not dependency_info:
+ logging.error(
+ 'The dependency_manager was not initialized with the dependency.')
if not try_support_binaries:
raise exceptions.NoPathFoundError(dependency, platform)
# TODO(aiolos): Remove the support_binaries call and always raise
@@ -139,6 +141,8 @@ class DependencyManager(object):
# system.
dependency_info = self._GetDependencyInfo(dependency, platform)
if not dependency_info:
+ logging.error(
+ 'The dependency_manager was not initialized with the dependency.')
if not try_support_binaries:
raise exceptions.NoPathFoundError(dependency, platform)
return support_binaries.FindLocallyBuiltPath(dependency)