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

Side by Side Diff: build/android/pylib/instrumentation/setup.py

Issue 1571803002: [Android] Prepare build/android/ for catapult+devil. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@create-device-library-links
Patch Set: rebase Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Generates test runner factory and tests for instrumentation tests.""" 5 """Generates test runner factory and tests for instrumentation tests."""
6 6
7 import logging 7 import logging
8 import os 8 import os
9 9
10 from devil.android import device_utils 10 from devil.android import device_utils
11 from pylib import constants
12 from pylib import valgrind_tools 11 from pylib import valgrind_tools
13 from pylib.base import base_setup 12 from pylib.base import base_setup
13 from pylib.constants import host_paths
14 from pylib.instrumentation import test_package 14 from pylib.instrumentation import test_package
15 from pylib.instrumentation import test_runner 15 from pylib.instrumentation import test_runner
16 16
17 DEVICE_DATA_DIR = 'chrome/test/data' 17 DEVICE_DATA_DIR = 'chrome/test/data'
18 18
19 ISOLATE_FILE_PATHS = { 19 ISOLATE_FILE_PATHS = {
20 'AndroidWebViewTest': 'android_webview/android_webview_test_apk.isolate', 20 'AndroidWebViewTest': 'android_webview/android_webview_test_apk.isolate',
21 'ContentShellTest': 'content/content_shell_test_apk.isolate', 21 'ContentShellTest': 'content/content_shell_test_apk.isolate',
22 } 22 }
23 23
24 DEPS_EXCLUSION_LIST = [] 24 DEPS_EXCLUSION_LIST = []
25 25
26 # TODO(mikecase): Remove this function and the constant DEVICE_DATA_DIR 26 # TODO(mikecase): Remove this function and the constant DEVICE_DATA_DIR
27 # once all data deps are pushed to the same location on the device. 27 # once all data deps are pushed to the same location on the device.
28 def _PushExtraSuiteDataDeps(device, test_apk): 28 def _PushExtraSuiteDataDeps(device, test_apk):
29 """Pushes some extra data files/dirs needed by some test suite. 29 """Pushes some extra data files/dirs needed by some test suite.
30 30
31 Args: 31 Args:
32 test_apk: The test suite basename for which to return file paths. 32 test_apk: The test suite basename for which to return file paths.
33 """ 33 """
34 if test_apk in ['ChromeTest', 'ContentShellTest', 34 if test_apk in ['ChromeTest', 'ContentShellTest',
35 'CronetTestInstrumentation']: 35 'CronetTestInstrumentation']:
36 test_files = 'net/data/ssl/certificates' 36 test_files = 'net/data/ssl/certificates'
37 host_device_file_tuple = [ 37 host_device_file_tuple = [
38 (os.path.join(constants.DIR_SOURCE_ROOT, test_files), 38 (os.path.join(host_paths.DIR_SOURCE_ROOT, test_files),
39 os.path.join(device.GetExternalStoragePath(), test_files))] 39 os.path.join(device.GetExternalStoragePath(), test_files))]
40 device.PushChangedFiles(host_device_file_tuple) 40 device.PushChangedFiles(host_device_file_tuple)
41 41
42 42
43 # TODO(mikecase): Remove this function once everything uses 43 # TODO(mikecase): Remove this function once everything uses
44 # base_setup.PushDataDeps to push data deps to the device. 44 # base_setup.PushDataDeps to push data deps to the device.
45 def _PushDataDeps(device, test_options): 45 def _PushDataDeps(device, test_options):
46 valgrind_tools.PushFilesForTool(test_options.tool, device) 46 valgrind_tools.PushFilesForTool(test_options.tool, device)
47 47
48 host_device_file_tuples = [] 48 host_device_file_tuples = []
49 for dest_host_pair in test_options.test_data: 49 for dest_host_pair in test_options.test_data:
50 dst_src = dest_host_pair.split(':', 1) 50 dst_src = dest_host_pair.split(':', 1)
51 dst_layer = dst_src[0] 51 dst_layer = dst_src[0]
52 host_src = dst_src[1] 52 host_src = dst_src[1]
53 host_test_files_path = os.path.join(constants.DIR_SOURCE_ROOT, host_src) 53 host_test_files_path = os.path.join(host_paths.DIR_SOURCE_ROOT, host_src)
54 if os.path.exists(host_test_files_path): 54 if os.path.exists(host_test_files_path):
55 host_device_file_tuples += [( 55 host_device_file_tuples += [(
56 host_test_files_path, 56 host_test_files_path,
57 '%s/%s/%s' % ( 57 '%s/%s/%s' % (
58 device.GetExternalStoragePath(), 58 device.GetExternalStoragePath(),
59 DEVICE_DATA_DIR, 59 DEVICE_DATA_DIR,
60 dst_layer))] 60 dst_layer))]
61 if host_device_file_tuples: 61 if host_device_file_tuples:
62 device.PushChangedFiles(host_device_file_tuples) 62 device.PushChangedFiles(host_device_file_tuples)
63 63
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 isolator.Clear() 106 isolator.Clear()
107 107
108 device_utils.DeviceUtils.parallel(devices).pMap( 108 device_utils.DeviceUtils.parallel(devices).pMap(
109 _PushExtraSuiteDataDeps, test_options.test_apk) 109 _PushExtraSuiteDataDeps, test_options.test_apk)
110 110
111 def TestRunnerFactory(device, shard_index): 111 def TestRunnerFactory(device, shard_index):
112 return test_runner.TestRunner(test_options, device, shard_index, 112 return test_runner.TestRunner(test_options, device, shard_index,
113 test_pkg) 113 test_pkg)
114 114
115 return (TestRunnerFactory, tests) 115 return (TestRunnerFactory, tests)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698