From 9e299ea6bbf87415d64d9d84003162d71304ccb9 Mon Sep 17 00:00:00 2001 From: agrieve Date: Thu, 24 Mar 2016 13:06:40 -0700 Subject: Include isolate.py in data for Android unit tests This is required for any test that uses an .isolate to push files to the device (e.g. base_unittests). BUG=589318 Review URL: https://codereview.chromium.org/1784373002 Cr-Commit-Position: refs/heads/master@{#383127} --- build/android/BUILD.gn | 39 +++--- build/android/test_runner.pydeps | 153 +++++++++++++++++++++ build/print_python_deps.py | 70 ++++++++++ build/secondary/tools/swarming_client/BUILD.gn | 14 ++ .../secondary/tools/swarming_client/isolate.pydeps | 118 ++++++++++++++++ 5 files changed, 372 insertions(+), 22 deletions(-) create mode 100644 build/android/test_runner.pydeps create mode 100755 build/print_python_deps.py create mode 100644 build/secondary/tools/swarming_client/BUILD.gn create mode 100644 build/secondary/tools/swarming_client/isolate.pydeps (limited to 'build') diff --git a/build/android/BUILD.gn b/build/android/BUILD.gn index 73b25cd..af819ed 100644 --- a/build/android/BUILD.gn +++ b/build/android/BUILD.gn @@ -84,30 +84,25 @@ action("cpplib_stripped") { ] } -group("devil_py") { - data = [ - "devil_chromium.json", - "devil_chromium.py", - "//third_party/android_tools/sdk/build-tools/23.0.1/aapt", - "//third_party/android_tools/sdk/build-tools/23.0.1/dexdump", - "//third_party/android_tools/sdk/build-tools/23.0.1/lib/libc++.so", - "//third_party/android_tools/sdk/build-tools/23.0.1/split-select", - "//third_party/android_tools/sdk/platform-tools/adb", - "//third_party/catapult/catapult_base/catapult_base/", - "//third_party/catapult/dependency_manager/dependency_manager/", - "//third_party/catapult/third_party/gsutil/", - "//third_party/catapult/devil/devil/", - ] -} - group("test_runner_py") { - data = [ - "test_runner.py", - "pylib/", - "//build/util/lib/common/", - ] + _py_files = read_file("test_runner.pydeps", "list lines") + + # Filter out comments. + set_sources_assignment_filter([ "#*" ]) + sources = _py_files + + data = sources + [ + "devil_chromium.json", + "//third_party/android_tools/sdk/build-tools/23.0.1/aapt", + "//third_party/android_tools/sdk/build-tools/23.0.1/dexdump", + "//third_party/android_tools/sdk/build-tools/23.0.1/lib/libc++.so", + "//third_party/android_tools/sdk/build-tools/23.0.1/split-select", + "//third_party/android_tools/sdk/platform-tools/adb", + "//third_party/catapult/third_party/gsutil/", + "//third_party/catapult/devil/devil/devil_dependencies.json", + ] data_deps = [ - ":devil_py", + "//tools/swarming_client:isolate_py", ] } diff --git a/build/android/test_runner.pydeps b/build/android/test_runner.pydeps new file mode 100644 index 0000000..1f4a559 --- /dev/null +++ b/build/android/test_runner.pydeps @@ -0,0 +1,153 @@ +# Generated by //build/print_python_deps.py +# root: //build/android +# target: //build/android/test_runner.py +../../third_party/appurify-python/src/appurify/__init__.py +../../third_party/appurify-python/src/appurify/api.py +../../third_party/appurify-python/src/appurify/constants.py +../../third_party/appurify-python/src/appurify/utils.py +../../third_party/catapult/catapult_base/catapult_base/__init__.py +../../third_party/catapult/catapult_base/catapult_base/cloud_storage.py +../../third_party/catapult/catapult_base/catapult_base/util.py +../../third_party/catapult/dependency_manager/dependency_manager/__init__.py +../../third_party/catapult/dependency_manager/dependency_manager/archive_info.py +../../third_party/catapult/dependency_manager/dependency_manager/base_config.py +../../third_party/catapult/dependency_manager/dependency_manager/cloud_storage_info.py +../../third_party/catapult/dependency_manager/dependency_manager/dependency_info.py +../../third_party/catapult/dependency_manager/dependency_manager/dependency_manager_util.py +../../third_party/catapult/dependency_manager/dependency_manager/exceptions.py +../../third_party/catapult/dependency_manager/dependency_manager/local_path_info.py +../../third_party/catapult/dependency_manager/dependency_manager/manager.py +../../third_party/catapult/dependency_manager/dependency_manager/uploader.py +../../third_party/catapult/devil/devil/__init__.py +../../third_party/catapult/devil/devil/android/__init__.py +../../third_party/catapult/devil/devil/android/apk_helper.py +../../third_party/catapult/devil/devil/android/battery_utils.py +../../third_party/catapult/devil/devil/android/constants/__init__.py +../../third_party/catapult/devil/devil/android/constants/file_system.py +../../third_party/catapult/devil/devil/android/decorators.py +../../third_party/catapult/devil/devil/android/device_blacklist.py +../../third_party/catapult/devil/devil/android/device_errors.py +../../third_party/catapult/devil/devil/android/device_list.py +../../third_party/catapult/devil/devil/android/device_signal.py +../../third_party/catapult/devil/devil/android/device_temp_file.py +../../third_party/catapult/devil/devil/android/device_utils.py +../../third_party/catapult/devil/devil/android/flag_changer.py +../../third_party/catapult/devil/devil/android/forwarder.py +../../third_party/catapult/devil/devil/android/install_commands.py +../../third_party/catapult/devil/devil/android/logcat_monitor.py +../../third_party/catapult/devil/devil/android/md5sum.py +../../third_party/catapult/devil/devil/android/ports.py +../../third_party/catapult/devil/devil/android/sdk/__init__.py +../../third_party/catapult/devil/devil/android/sdk/aapt.py +../../third_party/catapult/devil/devil/android/sdk/adb_wrapper.py +../../third_party/catapult/devil/devil/android/sdk/build_tools.py +../../third_party/catapult/devil/devil/android/sdk/gce_adb_wrapper.py +../../third_party/catapult/devil/devil/android/sdk/intent.py +../../third_party/catapult/devil/devil/android/sdk/keyevent.py +../../third_party/catapult/devil/devil/android/sdk/split_select.py +../../third_party/catapult/devil/devil/android/sdk/version_codes.py +../../third_party/catapult/devil/devil/android/valgrind_tools/__init__.py +../../third_party/catapult/devil/devil/android/valgrind_tools/base_tool.py +../../third_party/catapult/devil/devil/base_error.py +../../third_party/catapult/devil/devil/constants/__init__.py +../../third_party/catapult/devil/devil/constants/exit_codes.py +../../third_party/catapult/devil/devil/devil_env.py +../../third_party/catapult/devil/devil/utils/__init__.py +../../third_party/catapult/devil/devil/utils/cmd_helper.py +../../third_party/catapult/devil/devil/utils/file_utils.py +../../third_party/catapult/devil/devil/utils/host_utils.py +../../third_party/catapult/devil/devil/utils/lazy/__init__.py +../../third_party/catapult/devil/devil/utils/lazy/weak_constant.py +../../third_party/catapult/devil/devil/utils/parallelizer.py +../../third_party/catapult/devil/devil/utils/reraiser_thread.py +../../third_party/catapult/devil/devil/utils/run_tests_helper.py +../../third_party/catapult/devil/devil/utils/timeout_retry.py +../../third_party/catapult/devil/devil/utils/watchdog_timer.py +../../third_party/catapult/devil/devil/utils/zip_utils.py +../util/lib/common/perf_result_data_type.py +../util/lib/common/perf_tests_results_helper.py +../util/lib/common/unittest_util.py +devil_chromium.py +pylib/__init__.py +pylib/base/__init__.py +pylib/base/base_setup.py +pylib/base/base_test_result.py +pylib/base/base_test_runner.py +pylib/base/environment.py +pylib/base/environment_factory.py +pylib/base/test_collection.py +pylib/base/test_dispatcher.py +pylib/base/test_instance.py +pylib/base/test_instance_factory.py +pylib/base/test_run.py +pylib/base/test_run_factory.py +pylib/base/test_server.py +pylib/chrome_test_server_spawner.py +pylib/constants/__init__.py +pylib/constants/host_paths.py +pylib/gtest/__init__.py +pylib/gtest/gtest_test_instance.py +pylib/host_driven/__init__.py +pylib/host_driven/setup.py +pylib/host_driven/test_case.py +pylib/host_driven/test_info_collection.py +pylib/host_driven/test_runner.py +pylib/host_driven/tests_annotations.py +pylib/instrumentation/__init__.py +pylib/instrumentation/instrumentation_parser.py +pylib/instrumentation/instrumentation_test_instance.py +pylib/instrumentation/json_perf_parser.py +pylib/instrumentation/setup.py +pylib/instrumentation/test_jar.py +pylib/instrumentation/test_options.py +pylib/instrumentation/test_package.py +pylib/instrumentation/test_result.py +pylib/instrumentation/test_runner.py +pylib/junit/__init__.py +pylib/junit/setup.py +pylib/junit/test_dispatcher.py +pylib/junit/test_runner.py +pylib/linker/__init__.py +pylib/linker/setup.py +pylib/linker/test_case.py +pylib/linker/test_runner.py +pylib/local/__init__.py +pylib/local/device/__init__.py +pylib/local/device/local_device_environment.py +pylib/local/device/local_device_gtest_run.py +pylib/local/device/local_device_instrumentation_test_run.py +pylib/local/device/local_device_test_run.py +pylib/local/local_test_server_spawner.py +pylib/monkey/__init__.py +pylib/monkey/setup.py +pylib/monkey/test_options.py +pylib/monkey/test_runner.py +pylib/perf/__init__.py +pylib/perf/setup.py +pylib/perf/test_options.py +pylib/perf/test_runner.py +pylib/remote/__init__.py +pylib/remote/device/__init__.py +pylib/remote/device/appurify_constants.py +pylib/remote/device/appurify_sanitized.py +pylib/remote/device/remote_device_environment.py +pylib/remote/device/remote_device_gtest_run.py +pylib/remote/device/remote_device_helper.py +pylib/remote/device/remote_device_instrumentation_test_run.py +pylib/remote/device/remote_device_test_run.py +pylib/remote/device/remote_device_uirobot_test_run.py +pylib/results/__init__.py +pylib/results/flakiness_dashboard/__init__.py +pylib/results/flakiness_dashboard/json_results_generator.py +pylib/results/flakiness_dashboard/results_uploader.py +pylib/results/json_results.py +pylib/results/report_results.py +pylib/uirobot/__init__.py +pylib/uirobot/uirobot_test_instance.py +pylib/utils/__init__.py +pylib/utils/isolator.py +pylib/utils/proguard.py +pylib/utils/repo_utils.py +pylib/utils/test_environment.py +pylib/valgrind_tools.py +test_runner.py diff --git a/build/print_python_deps.py b/build/print_python_deps.py new file mode 100755 index 0000000..da83684 --- /dev/null +++ b/build/print_python_deps.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python +# Copyright 2016 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. + +"""Prints all non-system dependencies for the given module. + +The primary use-case for this script is to genererate the list of python modules +required for .isolate files. +""" + +import argparse +import imp +import os +import pipes +import sys + +# Don't use any helper modules, or else they will end up in the results. + + +_SRC_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) + + +def ComputePythonDependencies(root): + """Gets the paths of imported non-system python modules. + + A path is assumed to be a "system" import if it is outside of chromium's + src/. The paths will be relative to the current directory. + """ + module_paths = (m.__file__ for m in sys.modules.values() + if m and hasattr(m, '__file__')) + + src_paths = set() + for path in module_paths: + if path == __file__: + continue + path = os.path.abspath(path) + if not path.startswith(_SRC_ROOT): + continue + + if path.endswith('.pyc'): + path = path[:-1] + src_paths.add(os.path.relpath(path, root)) + + return sorted(src_paths) + + +def main(): + parser = argparse.ArgumentParser( + description='Prints all non-system dependencies for the given module.') + parser.add_argument('module', + help='The python module to analyze.') + parser.add_argument('--root', default='.', + help='Directory to make paths relative to.') + parser.add_argument('--output', + help='Write output to a file rather than stdout.') + options = parser.parse_args() + sys.path.append(os.path.dirname(options.module)) + imp.load_source('NAME', options.module) + out = open(options.output, 'w') if options.output else sys.stdout + with out: + out.write('# Generated by //build/print_python_deps.py\n') + out.write('# root: //%s\n' % os.path.relpath(options.root, _SRC_ROOT)) + out.write('# target: //%s\n' % os.path.relpath(options.module, _SRC_ROOT)) + for path in ComputePythonDependencies(options.root): + out.write(path + '\n') + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/build/secondary/tools/swarming_client/BUILD.gn b/build/secondary/tools/swarming_client/BUILD.gn new file mode 100644 index 0000000..f486052 --- /dev/null +++ b/build/secondary/tools/swarming_client/BUILD.gn @@ -0,0 +1,14 @@ +# Copyright 2016 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. + +group("isolate_py") { + _py_files = + read_file("//build/secondary/tools/swarming_client/isolate.pydeps", + "list lines") + + # Filter out comments. + set_sources_assignment_filter([ "#*" ]) + sources = _py_files + data = sources +} diff --git a/build/secondary/tools/swarming_client/isolate.pydeps b/build/secondary/tools/swarming_client/isolate.pydeps new file mode 100644 index 0000000..22af37b --- /dev/null +++ b/build/secondary/tools/swarming_client/isolate.pydeps @@ -0,0 +1,118 @@ +# Generated by //build/print_python_deps.py +# root: //tools/swarming_client +# target: //tools/swarming_client/isolate.py +auth.py +isolate.py +isolate_format.py +isolated_format.py +isolateserver.py +run_isolated.py +third_party/__init__.py +third_party/colorama/__init__.py +third_party/colorama/ansi.py +third_party/colorama/ansitowin32.py +third_party/colorama/initialise.py +third_party/colorama/win32.py +third_party/colorama/winterm.py +third_party/depot_tools/__init__.py +third_party/depot_tools/fix_encoding.py +third_party/depot_tools/subcommand.py +third_party/httplib2/__init__.py +third_party/httplib2/iri2uri.py +third_party/httplib2/socks.py +third_party/oauth2client/__init__.py +third_party/oauth2client/_helpers.py +third_party/oauth2client/_openssl_crypt.py +third_party/oauth2client/_pycrypto_crypt.py +third_party/oauth2client/client.py +third_party/oauth2client/clientsecrets.py +third_party/oauth2client/crypt.py +third_party/oauth2client/locked_file.py +third_party/oauth2client/multistore_file.py +third_party/oauth2client/util.py +third_party/pyasn1/pyasn1/__init__.py +third_party/pyasn1/pyasn1/codec/__init__.py +third_party/pyasn1/pyasn1/codec/ber/__init__.py +third_party/pyasn1/pyasn1/codec/ber/decoder.py +third_party/pyasn1/pyasn1/codec/ber/eoo.py +third_party/pyasn1/pyasn1/codec/cer/__init__.py +third_party/pyasn1/pyasn1/codec/cer/decoder.py +third_party/pyasn1/pyasn1/codec/der/__init__.py +third_party/pyasn1/pyasn1/codec/der/decoder.py +third_party/pyasn1/pyasn1/compat/__init__.py +third_party/pyasn1/pyasn1/compat/octets.py +third_party/pyasn1/pyasn1/debug.py +third_party/pyasn1/pyasn1/error.py +third_party/pyasn1/pyasn1/type/__init__.py +third_party/pyasn1/pyasn1/type/base.py +third_party/pyasn1/pyasn1/type/char.py +third_party/pyasn1/pyasn1/type/constraint.py +third_party/pyasn1/pyasn1/type/error.py +third_party/pyasn1/pyasn1/type/namedtype.py +third_party/pyasn1/pyasn1/type/namedval.py +third_party/pyasn1/pyasn1/type/tag.py +third_party/pyasn1/pyasn1/type/tagmap.py +third_party/pyasn1/pyasn1/type/univ.py +third_party/pyasn1/pyasn1/type/useful.py +third_party/requests/__init__.py +third_party/requests/adapters.py +third_party/requests/api.py +third_party/requests/auth.py +third_party/requests/certs.py +third_party/requests/compat.py +third_party/requests/cookies.py +third_party/requests/exceptions.py +third_party/requests/hooks.py +third_party/requests/models.py +third_party/requests/packages/__init__.py +third_party/requests/packages/urllib3/__init__.py +third_party/requests/packages/urllib3/_collections.py +third_party/requests/packages/urllib3/connection.py +third_party/requests/packages/urllib3/connectionpool.py +third_party/requests/packages/urllib3/contrib/__init__.py +third_party/requests/packages/urllib3/exceptions.py +third_party/requests/packages/urllib3/fields.py +third_party/requests/packages/urllib3/filepost.py +third_party/requests/packages/urllib3/packages/__init__.py +third_party/requests/packages/urllib3/packages/ordered_dict.py +third_party/requests/packages/urllib3/packages/six.py +third_party/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py +third_party/requests/packages/urllib3/poolmanager.py +third_party/requests/packages/urllib3/request.py +third_party/requests/packages/urllib3/response.py +third_party/requests/packages/urllib3/util/__init__.py +third_party/requests/packages/urllib3/util/connection.py +third_party/requests/packages/urllib3/util/request.py +third_party/requests/packages/urllib3/util/response.py +third_party/requests/packages/urllib3/util/retry.py +third_party/requests/packages/urllib3/util/ssl_.py +third_party/requests/packages/urllib3/util/timeout.py +third_party/requests/packages/urllib3/util/url.py +third_party/requests/sessions.py +third_party/requests/status_codes.py +third_party/requests/structures.py +third_party/requests/utils.py +third_party/rsa/rsa/__init__.py +third_party/rsa/rsa/_compat.py +third_party/rsa/rsa/common.py +third_party/rsa/rsa/core.py +third_party/rsa/rsa/key.py +third_party/rsa/rsa/pem.py +third_party/rsa/rsa/pkcs1.py +third_party/rsa/rsa/prime.py +third_party/rsa/rsa/randnum.py +third_party/rsa/rsa/transform.py +third_party/rsa/rsa/varblock.py +third_party/six/__init__.py +utils/__init__.py +utils/file_path.py +utils/fs.py +utils/logging_utils.py +utils/lru.py +utils/net.py +utils/oauth.py +utils/on_error.py +utils/subprocess42.py +utils/threading_utils.py +utils/tools.py +utils/zip_package.py -- cgit v1.1