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

Unified Diff: build/android/pylib/instrumentation/setup.py

Issue 754433003: Update from https://crrev.com/305340 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « build/android/pylib/gtest/test_runner.py ('k') | build/android/pylib/instrumentation/test_jar.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/instrumentation/setup.py
diff --git a/build/android/pylib/instrumentation/setup.py b/build/android/pylib/instrumentation/setup.py
index 57286e2f793dd644ecc9c9b57353f1a725fb049d..8dacc3d18dc8c3866b96482ef9907a917fac9d99 100644
--- a/build/android/pylib/instrumentation/setup.py
+++ b/build/android/pylib/instrumentation/setup.py
@@ -7,11 +7,63 @@
import logging
import os
+from pylib import constants
+from pylib import valgrind_tools
+
+from pylib.base import base_setup
+from pylib.device import device_utils
from pylib.instrumentation import test_package
from pylib.instrumentation import test_runner
+DEVICE_DATA_DIR = 'chrome/test/data'
+
+ISOLATE_FILE_PATHS = {
+ 'AndroidWebViewTest': 'android_webview/android_webview_test_apk.isolate',
+ 'ChromeShellTest': 'chrome/chrome_shell_test_apk.isolate',
+ 'ContentShellTest': 'content/content_shell_test_apk.isolate',
+}
+
+DEPS_EXCLUSION_LIST = []
+
+# TODO(mikecase): Remove this function and the constant DEVICE_DATA_DIR
+# once all data deps are pushed to the same location on the device.
+def _PushExtraSuiteDataDeps(device, test_apk):
+ """Pushes some extra data files/dirs needed by some test suite.
+
+ Args:
+ test_apk: The test suite basename for which to return file paths.
+ """
+ if test_apk in ['ChromeTest', 'ContentShellTest']:
+ test_files = 'net/data/ssl/certificates'
+ host_device_file_tuple = [
+ (os.path.join(constants.DIR_SOURCE_ROOT, test_files),
+ os.path.join(device.GetExternalStoragePath(), test_files))]
+ device.PushChangedFiles(host_device_file_tuple)
-def Setup(test_options):
+
+# TODO(mikecase): Remove this function once everything uses
+# base_setup.PushDataDeps to push data deps to the device.
+def _PushDataDeps(device, test_options):
+ valgrind_tools.PushFilesForTool(test_options.tool, device)
+
+ host_device_file_tuples = []
+ for dest_host_pair in test_options.test_data:
+ dst_src = dest_host_pair.split(':', 1)
+ dst_layer = dst_src[0]
+ host_src = dst_src[1]
+ host_test_files_path = os.path.join(constants.DIR_SOURCE_ROOT, host_src)
+ if os.path.exists(host_test_files_path):
+ host_device_file_tuples += [(
+ host_test_files_path,
+ '%s/%s/%s' % (
+ device.GetExternalStoragePath(),
+ DEVICE_DATA_DIR,
+ dst_layer))]
+ if host_device_file_tuples:
+ device.PushChangedFiles(host_device_file_tuples)
+
+
+def Setup(test_options, devices):
"""Create and return the test runner factory and tests.
Args:
@@ -34,6 +86,24 @@ def Setup(test_options):
if not tests:
logging.error('No instrumentation tests to run with current args.')
+ if test_options.test_data:
+ device_utils.DeviceUtils.parallel(devices).pMap(
+ _PushDataDeps, test_options)
+ else:
+ base_setup.GenerateDepsDirUsingIsolate(test_options.test_apk,
+ test_options.isolate_file_path,
+ ISOLATE_FILE_PATHS,
+ DEPS_EXCLUSION_LIST)
+ def push_data_deps_to_device_dir(device):
+ device_dir = os.path.join(device.GetExternalStoragePath(),
+ DEVICE_DATA_DIR)
+ base_setup.PushDataDeps(device, device_dir, test_options)
+ device_utils.DeviceUtils.parallel(devices).pMap(
+ push_data_deps_to_device_dir)
+
+ device_utils.DeviceUtils.parallel(devices).pMap(
+ _PushExtraSuiteDataDeps, test_options.test_apk)
+
def TestRunnerFactory(device, shard_index):
return test_runner.TestRunner(test_options, device, shard_index,
test_pkg)
« no previous file with comments | « build/android/pylib/gtest/test_runner.py ('k') | build/android/pylib/instrumentation/test_jar.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698