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

Side by Side Diff: testing/test.gni

Issue 1914573002: Reland of Generate Android .isolate files used for test()s (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nitpick comment Created 4 years, 8 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
« no previous file with comments | « testing/generate_isolate.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 # ============================================================================== 5 # ==============================================================================
6 # TEST SETUP 6 # TEST SETUP
7 # ============================================================================== 7 # ==============================================================================
8 8
9 template("_gen_isolate") {
10 testonly = true
11 _runtime_deps_file = "$target_gen_dir/$target_name.runtime_deps"
12 group("${target_name}__write_deps") {
13 forward_variables_from(invoker,
14 [
15 "data",
16 "data_deps",
17 "deps",
18 "public_deps",
19 ])
20 write_runtime_deps = _runtime_deps_file
21 }
22
23 action(target_name) {
24 script = "//testing/generate_isolate.py"
25 outputs = [
26 invoker.output,
27 ]
28 args = [
29 "--output-directory=.",
30 "--out-file",
31 rebase_path(invoker.output, root_build_dir),
32 "--runtime-deps-file",
33 rebase_path(_runtime_deps_file, root_build_dir),
34 ]
35 if (is_android) {
36 args += [ "--apply-android-filters" ]
37 }
38 if (defined(invoker.apply_device_filters) && invoker.apply_device_filters) {
39 args += [ "--apply-device-filters" ]
40 }
41 _assert_no_odd_data =
42 defined(invoker.assert_no_odd_data) && invoker.assert_no_odd_data
43 if (_assert_no_odd_data) {
44 args += [ "--assert-no-odd-data" ]
45 }
46 if (defined(invoker.command)) {
47 _isolate_dir = get_path_info(invoker.output, "dir")
48 args += [
49 "--command",
50 rebase_path(invoker.command, _isolate_dir),
51 ]
52 }
53 deps = [
54 ":${invoker.target_name}__write_deps",
55 ]
56 }
57 }
58
9 # Define a test as an executable (or apk on Android) with the "testonly" flag 59 # Define a test as an executable (or apk on Android) with the "testonly" flag
10 # set. 60 # set.
11 # Variable: 61 # Variable:
12 # use_raw_android_executable: Use executable() rather than android_apk(). 62 # use_raw_android_executable: Use executable() rather than android_apk().
13 template("test") { 63 template("test") {
14 if (is_android) { 64 if (is_android) {
15 import("//build/config/android/config.gni") 65 import("//build/config/android/config.gni")
16 import("//build/config/android/rules.gni") 66 import("//build/config/android/rules.gni")
17 67
18 _use_raw_android_executable = defined(invoker.use_raw_android_executable) && 68 _use_raw_android_executable = defined(invoker.use_raw_android_executable) &&
19 invoker.use_raw_android_executable 69 invoker.use_raw_android_executable
20 70
21 # output_name is used to allow targets with the same name but in different 71 # output_name is used to allow targets with the same name but in different
22 # packages to still produce unique runner scripts. 72 # packages to still produce unique runner scripts.
23 _output_name = invoker.target_name 73 _output_name = invoker.target_name
24 if (defined(invoker.output_name)) { 74 if (defined(invoker.output_name)) {
25 _output_name = invoker.output_name 75 _output_name = invoker.output_name
26 } 76 }
27 77
28 _test_runner_target = "${_output_name}__test_runner_script" 78 _test_runner_target = "${_output_name}__test_runner_script"
29 _wrapper_script_vars = [ 79 _wrapper_script_vars = [
30 "isolate_file", 80 "isolate_file",
31 "shard_timeout", 81 "shard_timeout",
32 ] 82 ]
83 _gen_isolate_vars = [
84 "allow_odd_runtime_deps",
85 "ignore_all_data_deps",
86 ]
87
88 # TODO(agrieve): Delete all manually passed-in .isolate files now that they
89 # are unused. http://crbug.com/589318
90 assert(!defined(invoker.isolate_file) || invoker.isolate_file != "") # Mark used.
91 _generate_device_isolate =
92 !defined(invoker.ignore_all_data_deps) || !invoker.ignore_all_data_deps
93
94 if (_generate_device_isolate) {
95 _allow_odd_runtime_deps = defined(invoker.allow_odd_runtime_deps) &&
96 invoker.allow_odd_runtime_deps
97
98 # The device isolate is needed at runtime, so it cannot go in
99 # target_gen_dir, as builder/tester configurations do not include it.
100 _target_dir_name = get_label_info(":$target_name", "dir")
101 _device_isolate_path = "$root_out_dir/gen.runtime/$_target_dir_name/$targe t_name.device.isolate"
102 _gen_isolate_target_name = "${target_name}__isolate"
103 _gen_isolate(_gen_isolate_target_name) {
104 data_deps = []
105 forward_variables_from(invoker,
106 [
107 "data",
108 "data_deps",
109 "deps",
110 "public_deps",
111 ])
112 assert_no_odd_data = !_allow_odd_runtime_deps
113 output = _device_isolate_path
114 apply_device_filters = true
115 }
116 }
33 117
34 if (_use_raw_android_executable) { 118 if (_use_raw_android_executable) {
35 _exec_target = "${target_name}__exec" 119 _exec_target = "${target_name}__exec"
36 _dist_target = "${target_name}__dist" 120 _dist_target = "${target_name}__dist"
37 _exec_output = 121 _exec_output =
38 "$target_out_dir/${invoker.target_name}/${invoker.target_name}" 122 "$target_out_dir/${invoker.target_name}/${invoker.target_name}"
39 123
40 executable(_exec_target) { 124 executable(_exec_target) {
41 # Configs will always be defined since we set_defaults in BUILDCONFIG.gn . 125 # Configs will always be defined since we set_defaults in BUILDCONFIG.gn .
42 configs = [] 126 configs = []
43 data_deps = [] 127 data_deps = []
44 forward_variables_from(invoker, "*", [ "extra_dist_files" ]) 128 forward_variables_from(
129 invoker,
130 "*",
131 _wrapper_script_vars + _gen_isolate_vars + [ "extra_dist_files" ])
45 testonly = true 132 testonly = true
46 133
47 # Thanks to the set_defaults() for test(), configs are initialized with 134 # Thanks to the set_defaults() for test(), configs are initialized with
48 # the default shared_library configs rather than executable configs. 135 # the default shared_library configs rather than executable configs.
49 configs -= [ 136 configs -= [
50 "//build/config:shared_library_config", 137 "//build/config:shared_library_config",
51 "//build/config/android:hide_native_jni_exports", 138 "//build/config/android:hide_native_jni_exports",
52 ] 139 ]
53 configs += [ "//build/config:executable_config" ] 140 configs += [ "//build/config:executable_config" ]
54 141
(...skipping 24 matching lines...) Expand all
79 "use_default_launcher", 166 "use_default_launcher",
80 "write_asset_list", 167 "write_asset_list",
81 ] 168 ]
82 shared_library(_library_target) { 169 shared_library(_library_target) {
83 # Configs will always be defined since we set_defaults in BUILDCONFIG.gn . 170 # Configs will always be defined since we set_defaults in BUILDCONFIG.gn .
84 configs = [] # Prevent list overwriting warning. 171 configs = [] # Prevent list overwriting warning.
85 configs = invoker.configs 172 configs = invoker.configs
86 testonly = true 173 testonly = true
87 174
88 deps = [] 175 deps = []
89 forward_variables_from( 176 forward_variables_from(invoker,
90 invoker, 177 "*",
91 "*", 178 _apk_specific_vars + _wrapper_script_vars +
92 _apk_specific_vars + _wrapper_script_vars + [ "visibility" ]) 179 _gen_isolate_vars + [ "visibility" ])
93 180
94 if (!defined(invoker.use_default_launcher) || 181 if (!defined(invoker.use_default_launcher) ||
95 invoker.use_default_launcher) { 182 invoker.use_default_launcher) {
96 deps += [ "//testing/android/native_test:native_test_native_code" ] 183 deps += [ "//testing/android/native_test:native_test_native_code" ]
97 } 184 }
98 } 185 }
99 unittest_apk(_apk_target) { 186 unittest_apk(_apk_target) {
100 forward_variables_from(invoker, _apk_specific_vars + [ "deps" ]) 187 forward_variables_from(invoker, _apk_specific_vars + [ "deps" ])
101 unittests_dep = ":$_library_target" 188 unittests_dep = ":$_library_target"
102 apk_name = invoker.target_name 189 apk_name = invoker.target_name
(...skipping 13 matching lines...) Expand all
116 data_deps = [ 203 data_deps = [
117 ":$_test_runner_target", 204 ":$_test_runner_target",
118 ] 205 ]
119 } 206 }
120 207
121 # Incremental test targets work only for .apks. 208 # Incremental test targets work only for .apks.
122 _incremental_test_runner_target = 209 _incremental_test_runner_target =
123 "${_output_name}_incremental__test_runner_script" 210 "${_output_name}_incremental__test_runner_script"
124 test_runner_script(_incremental_test_runner_target) { 211 test_runner_script(_incremental_test_runner_target) {
125 forward_variables_from(invoker, _wrapper_script_vars) 212 forward_variables_from(invoker, _wrapper_script_vars)
213 if (_generate_device_isolate) {
214 isolate_file = _device_isolate_path
215 deps = [
216 ":$_gen_isolate_target_name",
217 ]
218 }
126 apk_target = ":$_apk_target" 219 apk_target = ":$_apk_target"
127 test_name = "${_output_name}_incremental" 220 test_name = "${_output_name}_incremental"
128 test_type = "gtest" 221 test_type = "gtest"
129 test_suite = _output_name 222 test_suite = _output_name
130 incremental_install = true 223 incremental_install = true
131 } 224 }
132 group("${target_name}_incremental") { 225 group("${target_name}_incremental") {
133 testonly = true 226 testonly = true
134 datadeps = [ 227 datadeps = [
135 ":$_incremental_test_runner_target", 228 ":$_incremental_test_runner_target",
136 ] 229 ]
137 deps = [ 230 deps = [
138 ":${_apk_target}_incremental", 231 ":${_apk_target}_incremental",
139 ] 232 ]
140 } 233 }
141 } 234 }
142 235
143 _test_runner_target = "${_output_name}__test_runner_script" 236 _test_runner_target = "${_output_name}__test_runner_script"
144 test_runner_script(_test_runner_target) { 237 test_runner_script(_test_runner_target) {
145 forward_variables_from(invoker, _wrapper_script_vars) 238 forward_variables_from(invoker, _wrapper_script_vars)
239 if (_generate_device_isolate) {
240 isolate_file = _device_isolate_path
241 deps = [
242 ":$_gen_isolate_target_name",
243 ]
244 }
245
146 if (_use_raw_android_executable) { 246 if (_use_raw_android_executable) {
147 executable_dist_dir = "$root_out_dir/$_dist_target" 247 executable_dist_dir = "$root_out_dir/$_dist_target"
148 } else { 248 } else {
149 apk_target = ":$_apk_target" 249 apk_target = ":$_apk_target"
150 } 250 }
151 test_name = _output_name 251 test_name = _output_name
152 test_type = "gtest" 252 test_type = "gtest"
153 test_suite = _output_name 253 test_suite = _output_name
154 } 254 }
155 255
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 # TODO(GYP): Delete this after we've converted everything to GN. 337 # TODO(GYP): Delete this after we've converted everything to GN.
238 # The _run targets exist only for compatibility with GYP. 338 # The _run targets exist only for compatibility with GYP.
239 group("${target_name}_run") { 339 group("${target_name}_run") {
240 testonly = true 340 testonly = true
241 deps = [ 341 deps = [
242 ":${invoker.target_name}", 342 ":${invoker.target_name}",
243 ] 343 ]
244 } 344 }
245 } 345 }
246 } 346 }
OLDNEW
« no previous file with comments | « testing/generate_isolate.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698