Skip to content

Commit

Permalink
[android] Stop using isolate.py for data dependency management.
Browse files Browse the repository at this point in the history
BUG=663110

Review-Url: https://codereview.chromium.org/2492123002
Cr-Commit-Position: refs/heads/master@{#432940}
  • Loading branch information
jbudorick authored and Commit bot committed Nov 17, 2016
1 parent 89c538f commit 634c87c
Show file tree
Hide file tree
Showing 22 changed files with 309 additions and 829 deletions.
1 change: 0 additions & 1 deletion PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@


_GENERIC_PYDEPS_FILES = [
'build/secondary/tools/swarming_client/isolate.pydeps',
]


Expand Down
3 changes: 0 additions & 3 deletions build/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@ group("test_runner_py") {
"//third_party/catapult/devil/devil/devil_dependencies.json",
"//third_party/proguard/lib/proguard.jar",
]
data_deps = [
"//tools/swarming_client:isolate_py",
]
}

# Create wrapper scripts in out/bin that takes care of setting the
Expand Down
1 change: 1 addition & 0 deletions build/android/PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def J(*dirs):
J('pylib', 'local', 'device', 'local_device_test_run_test.py'),
J('pylib', 'results', 'json_results_test.py'),
J('pylib', 'symbols', 'elf_symbolizer_unittest.py'),
J('pylib', 'utils', 'device_dependencies_test.py'),
],
env=pylib_test_env))

Expand Down
120 changes: 0 additions & 120 deletions build/android/gn/generate_isolate.py

This file was deleted.

4 changes: 4 additions & 0 deletions build/android/gyp/create_test_runner_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def main(args):
group.add_argument('--executable-dist-dir')
group.add_argument('--isolate-file-path')
group.add_argument('--output-directory')
group.add_argument('--runtime-deps-path')
group.add_argument('--test-apk')
group.add_argument('--test-apk-incremental-install-script')
group.add_argument('--coverage-dir')
Expand Down Expand Up @@ -102,6 +103,9 @@ def RelativizePathToScript(path):
if args.output_directory:
test_runner_path_args.append(
('--output-directory', RelativizePathToScript(args.output_directory)))
if args.runtime_deps_path:
test_runner_path_args.append(
('--runtime-deps-path', RelativizePathToScript(args.runtime_deps_path)))
if args.test_apk:
test_runner_path_args.append(
('--test-apk', RelativizePathToScript(args.test_apk)))
Expand Down
6 changes: 3 additions & 3 deletions build/android/pylib/base/test_instance_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
from pylib.junit import junit_test_instance
from pylib.monkey import monkey_test_instance
from pylib.perf import perf_test_instance
from pylib.utils import isolator
from pylib.utils import device_dependencies


def CreateTestInstance(args, error_func):

if args.command == 'gtest':
return gtest_test_instance.GtestTestInstance(
args, isolator.Isolator(), error_func)
args, device_dependencies.GetDataDependencies, error_func)
elif args.command == 'instrumentation':
return instrumentation_test_instance.InstrumentationTestInstance(
args, isolator.Isolator(), error_func)
args, device_dependencies.GetDataDependencies, error_func)
elif args.command == 'junit':
return junit_test_instance.JunitTestInstance(args, error_func)
elif args.command == 'monkey':
Expand Down
33 changes: 9 additions & 24 deletions build/android/pylib/gtest/gtest_test_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from pylib.constants import host_paths
from pylib.base import base_test_result
from pylib.base import test_instance
from pylib.utils import isolator

with host_paths.SysPath(host_paths.BUILD_COMMON_PATH):
import unittest_util # pylint: disable=import-error
Expand Down Expand Up @@ -230,7 +229,7 @@ def ConvertTestFilterFileIntoGTestFilterArgument(input_lines):

class GtestTestInstance(test_instance.TestInstance):

def __init__(self, args, isolate_delegate, error_func):
def __init__(self, args, data_deps_delegate, error_func):
super(GtestTestInstance, self).__init__()
# TODO(jbudorick): Support multiple test suites.
if len(args.suite_name) > 1:
Expand Down Expand Up @@ -287,16 +286,10 @@ def __init__(self, args, isolate_delegate, error_func):
else:
self._gtest_filter = None

if (args.isolate_file_path and
not isolator.IsIsolateEmpty(args.isolate_file_path)):
self._isolate_abs_path = os.path.abspath(args.isolate_file_path)
self._isolate_delegate = isolate_delegate
self._isolated_abs_path = os.path.join(
constants.GetOutDirectory(), '%s.isolated' % self._suite)
else:
logging.warning('%s isolate file provided. No data deps will be pushed.',
'Empty' if args.isolate_file_path else 'No')
self._isolate_delegate = None
self._data_deps_delegate = data_deps_delegate
self._runtime_deps_path = args.runtime_deps_path
if not self._runtime_deps_path:
logging.warning('No data dependencies will be pushed.')

if args.app_data_files:
self._app_data_files = args.app_data_files
Expand Down Expand Up @@ -393,15 +386,8 @@ def TestType(self):
#override
def SetUp(self):
"""Map data dependencies via isolate."""
if self._isolate_delegate:
self._isolate_delegate.Remap(
self._isolate_abs_path, self._isolated_abs_path)
self._isolate_delegate.PurgeExcluded(_DEPS_EXCLUSION_LIST)
self._isolate_delegate.MoveOutputDeps()
dest_dir = None
self._data_deps.extend([
(self._isolate_delegate.isolate_deps_dir, dest_dir)])

self._data_deps.extend(
self._data_deps_delegate(self._runtime_deps_path))

def GetDataDependencies(self):
"""Returns the test suite's data dependencies.
Expand Down Expand Up @@ -455,7 +441,6 @@ def _GenerateDisabledFilterString(self, disabled_prefixes):

#override
def TearDown(self):
"""Clear the mappings created by SetUp."""
if self._isolate_delegate:
self._isolate_delegate.Clear()
"""Do nothing."""
pass

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from pylib.constants import host_paths
from pylib.instrumentation import test_result
from pylib.instrumentation import instrumentation_parser
from pylib.utils import isolator
from pylib.utils import proguard

with host_paths.SysPath(host_paths.BUILD_COMMON_PATH):
Expand Down Expand Up @@ -400,7 +399,7 @@ def GetUniqueTestName(test, sep='#'):

class InstrumentationTestInstance(test_instance.TestInstance):

def __init__(self, args, isolate_delegate, error_func):
def __init__(self, args, data_deps_delegate, error_func):
super(InstrumentationTestInstance, self).__init__()

self._additional_apks = []
Expand All @@ -417,10 +416,9 @@ def __init__(self, args, isolate_delegate, error_func):
self._initializeApkAttributes(args, error_func)

self._data_deps = None
self._isolate_abs_path = None
self._isolate_delegate = None
self._isolated_abs_path = None
self._initializeDataDependencyAttributes(args, isolate_delegate)
self._data_deps_delegate = None
self._runtime_deps_path = None
self._initializeDataDependencyAttributes(args, data_deps_delegate)

self._annotations = None
self._excluded_annotations = None
Expand Down Expand Up @@ -520,22 +518,12 @@ def _initializeApkAttributes(self, args, error_func):
self._additional_apks = (
[apk_helper.ToHelper(x) for x in args.additional_apks])

def _initializeDataDependencyAttributes(self, args, isolate_delegate):
def _initializeDataDependencyAttributes(self, args, data_deps_delegate):
self._data_deps = []
if (args.isolate_file_path and
not isolator.IsIsolateEmpty(args.isolate_file_path)):
if os.path.isabs(args.isolate_file_path):
self._isolate_abs_path = args.isolate_file_path
else:
self._isolate_abs_path = os.path.join(
constants.DIR_SOURCE_ROOT, args.isolate_file_path)
self._isolate_delegate = isolate_delegate
self._isolated_abs_path = os.path.join(
constants.GetOutDirectory(), '%s.isolated' % self._test_package)
else:
self._isolate_delegate = None
self._data_deps_delegate = data_deps_delegate
self._runtime_deps_path = args.runtime_deps_path

if not self._isolate_delegate:
if not self._runtime_deps_path:
logging.warning('No data dependencies will be pushed.')

def _initializeTestFilterAttributes(self, args):
Expand Down Expand Up @@ -688,11 +676,8 @@ def TestType(self):

#override
def SetUp(self):
if self._isolate_delegate:
self._isolate_delegate.Remap(
self._isolate_abs_path, self._isolated_abs_path)
self._isolate_delegate.MoveOutputDeps()
self._data_deps.extend([(self._isolate_delegate.isolate_deps_dir, None)])
self._data_deps.extend(
self._data_deps_delegate(self._runtime_deps_path))

def GetDataDependencies(self):
return self._data_deps
Expand Down Expand Up @@ -764,5 +749,4 @@ def GenerateTestResults(

#override
def TearDown(self):
if self._isolate_delegate:
self._isolate_delegate.Clear()
pass
17 changes: 10 additions & 7 deletions build/android/pylib/local/device/local_device_gtest_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,19 +251,20 @@ def TestPackage(self):
def SetUp(self):
@local_device_environment.handle_shard_failures_with(
on_failure=self._env.BlacklistDevice)
def individual_device_set_up(dev):
def individual_device_set_up(dev, host_device_tuples):
def install_apk():
# Install test APK.
self._delegate.Install(dev)

def push_test_data():
# Push data dependencies.
device_root = self._delegate.GetTestDataRoot(dev)
data_deps = self._test_instance.GetDataDependencies()
host_device_tuples = [
(h, d if d is not None else device_root)
for h, d in data_deps]
dev.PushChangedFiles(host_device_tuples, delete_device_stale=True)
host_device_tuples_substituted = [
(h, local_device_test_run.SubstituteDeviceRoot(d, device_root))
for h, d in host_device_tuples]
dev.PushChangedFiles(
host_device_tuples_substituted,
delete_device_stale=True)
if not host_device_tuples:
dev.RunShellCommand(['rm', '-rf', device_root], check_return=True)
dev.RunShellCommand(['mkdir', '-p', device_root], check_return=True)
Expand All @@ -289,7 +290,9 @@ def init_tool_and_start_servers():
for step in steps:
step()

self._env.parallel_devices.pMap(individual_device_set_up)
self._env.parallel_devices.pMap(
individual_device_set_up,
self._test_instance.GetDataDependencies())

#override
def _ShouldShard(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@ def TestPackage(self):

#override
def SetUp(self):
def substitute_device_root(d, device_root):
if not d:
return device_root
elif isinstance(d, list):
return posixpath.join(*(p if p else device_root for p in d))
else:
return d

@local_device_environment.handle_shard_failures_with(
self._env.BlacklistDevice)
def individual_device_set_up(dev, host_device_tuples):
Expand Down Expand Up @@ -117,7 +109,7 @@ def push_test_data():
device_root = posixpath.join(dev.GetExternalStoragePath(),
'chromium_tests_root')
host_device_tuples_substituted = [
(h, substitute_device_root(d, device_root))
(h, local_device_test_run.SubstituteDeviceRoot(d, device_root))
for h, d in host_device_tuples]
logging.info('instrumentation data deps:')
for h, d in host_device_tuples_substituted:
Expand Down
Loading

0 comments on commit 634c87c

Please sign in to comment.