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

Side by Side Diff: testing/test.gni

Issue 1908253006: Revert of Generate Android .isolate files used for test()s (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
59 # Define a test as an executable (or apk on Android) with the "testonly" flag 9 # Define a test as an executable (or apk on Android) with the "testonly" flag
60 # set. 10 # set.
61 # Variable: 11 # Variable:
62 # use_raw_android_executable: Use executable() rather than android_apk(). 12 # use_raw_android_executable: Use executable() rather than android_apk().
63 template("test") { 13 template("test") {
64 if (is_android) { 14 if (is_android) {
65 import("//build/config/android/config.gni") 15 import("//build/config/android/config.gni")
66 import("//build/config/android/rules.gni") 16 import("//build/config/android/rules.gni")
67 17
68 _use_raw_android_executable = defined(invoker.use_raw_android_executable) && 18 _use_raw_android_executable = defined(invoker.use_raw_android_executable) &&
69 invoker.use_raw_android_executable 19 invoker.use_raw_android_executable
70 20
71 # output_name is used to allow targets with the same name but in different 21 # output_name is used to allow targets with the same name but in different
72 # packages to still produce unique runner scripts. 22 # packages to still produce unique runner scripts.
73 _output_name = invoker.target_name 23 _output_name = invoker.target_name
74 if (defined(invoker.output_name)) { 24 if (defined(invoker.output_name)) {
75 _output_name = invoker.output_name 25 _output_name = invoker.output_name
76 } 26 }
77 27
78 _test_runner_target = "${_output_name}__test_runner_script" 28 _test_runner_target = "${_output_name}__test_runner_script"
79 _wrapper_script_vars = [ 29 _wrapper_script_vars = [
80 "isolate_file", 30 "isolate_file",
81 "shard_timeout", 31 "shard_timeout",
82 ] 32 ]
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 }
117 33
118 if (_use_raw_android_executable) { 34 if (_use_raw_android_executable) {
119 _exec_target = "${target_name}__exec" 35 _exec_target = "${target_name}__exec"
120 _dist_target = "${target_name}__dist" 36 _dist_target = "${target_name}__dist"
121 _exec_output = 37 _exec_output =
122 "$target_out_dir/${invoker.target_name}/${invoker.target_name}" 38 "$target_out_dir/${invoker.target_name}/${invoker.target_name}"
123 39
124 executable(_exec_target) { 40 executable(_exec_target) {
125 # Configs will always be defined since we set_defaults in BUILDCONFIG.gn . 41 # Configs will always be defined since we set_defaults in BUILDCONFIG.gn .
126 configs = [] 42 configs = []
127 data_deps = [] 43 data_deps = []
128 forward_variables_from( 44 forward_variables_from(invoker, "*", [ "extra_dist_files" ])
129 invoker,
130 "*",
131 _wrapper_script_vars + _gen_isolate_vars + [ "extra_dist_files" ])
132 testonly = true 45 testonly = true
133 46
134 # Thanks to the set_defaults() for test(), configs are initialized with 47 # Thanks to the set_defaults() for test(), configs are initialized with
135 # the default shared_library configs rather than executable configs. 48 # the default shared_library configs rather than executable configs.
136 configs -= [ 49 configs -= [
137 "//build/config:shared_library_config", 50 "//build/config:shared_library_config",
138 "//build/config/android:hide_native_jni_exports", 51 "//build/config/android:hide_native_jni_exports",
139 ] 52 ]
140 configs += [ "//build/config:executable_config" ] 53 configs += [ "//build/config:executable_config" ]
141 54
(...skipping 24 matching lines...) Expand all
166 "use_default_launcher", 79 "use_default_launcher",
167 "write_asset_list", 80 "write_asset_list",
168 ] 81 ]
169 shared_library(_library_target) { 82 shared_library(_library_target) {
170 # Configs will always be defined since we set_defaults in BUILDCONFIG.gn . 83 # Configs will always be defined since we set_defaults in BUILDCONFIG.gn .
171 configs = [] # Prevent list overwriting warning. 84 configs = [] # Prevent list overwriting warning.
172 configs = invoker.configs 85 configs = invoker.configs
173 testonly = true 86 testonly = true
174 87
175 deps = [] 88 deps = []
176 forward_variables_from(invoker, 89 forward_variables_from(
177 "*", 90 invoker,
178 _apk_specific_vars + _wrapper_script_vars + 91 "*",
179 _gen_isolate_vars + [ "visibility" ]) 92 _apk_specific_vars + _wrapper_script_vars + [ "visibility" ])
180 93
181 if (!defined(invoker.use_default_launcher) || 94 if (!defined(invoker.use_default_launcher) ||
182 invoker.use_default_launcher) { 95 invoker.use_default_launcher) {
183 deps += [ "//testing/android/native_test:native_test_native_code" ] 96 deps += [ "//testing/android/native_test:native_test_native_code" ]
184 } 97 }
185 } 98 }
186 unittest_apk(_apk_target) { 99 unittest_apk(_apk_target) {
187 forward_variables_from(invoker, _apk_specific_vars + [ "deps" ]) 100 forward_variables_from(invoker, _apk_specific_vars + [ "deps" ])
188 unittests_dep = ":$_library_target" 101 unittests_dep = ":$_library_target"
189 apk_name = invoker.target_name 102 apk_name = invoker.target_name
(...skipping 13 matching lines...) Expand all
203 data_deps = [ 116 data_deps = [
204 ":$_test_runner_target", 117 ":$_test_runner_target",
205 ] 118 ]
206 } 119 }
207 120
208 # Incremental test targets work only for .apks. 121 # Incremental test targets work only for .apks.
209 _incremental_test_runner_target = 122 _incremental_test_runner_target =
210 "${_output_name}_incremental__test_runner_script" 123 "${_output_name}_incremental__test_runner_script"
211 test_runner_script(_incremental_test_runner_target) { 124 test_runner_script(_incremental_test_runner_target) {
212 forward_variables_from(invoker, _wrapper_script_vars) 125 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 }
219 apk_target = ":$_apk_target" 126 apk_target = ":$_apk_target"
220 test_name = "${_output_name}_incremental" 127 test_name = "${_output_name}_incremental"
221 test_type = "gtest" 128 test_type = "gtest"
222 test_suite = _output_name 129 test_suite = _output_name
223 incremental_install = true 130 incremental_install = true
224 } 131 }
225 group("${target_name}_incremental") { 132 group("${target_name}_incremental") {
226 testonly = true 133 testonly = true
227 datadeps = [ 134 datadeps = [
228 ":$_incremental_test_runner_target", 135 ":$_incremental_test_runner_target",
229 ] 136 ]
230 deps = [ 137 deps = [
231 ":${_apk_target}_incremental", 138 ":${_apk_target}_incremental",
232 ] 139 ]
233 } 140 }
234 } 141 }
235 142
236 _test_runner_target = "${_output_name}__test_runner_script" 143 _test_runner_target = "${_output_name}__test_runner_script"
237 test_runner_script(_test_runner_target) { 144 test_runner_script(_test_runner_target) {
238 forward_variables_from(invoker, _wrapper_script_vars) 145 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
246 if (_use_raw_android_executable) { 146 if (_use_raw_android_executable) {
247 executable_dist_dir = "$root_out_dir/$_dist_target" 147 executable_dist_dir = "$root_out_dir/$_dist_target"
248 } else { 148 } else {
249 apk_target = ":$_apk_target" 149 apk_target = ":$_apk_target"
250 } 150 }
251 test_name = _output_name 151 test_name = _output_name
252 test_type = "gtest" 152 test_type = "gtest"
253 test_suite = _output_name 153 test_suite = _output_name
254 } 154 }
255 155
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 # TODO(GYP): Delete this after we've converted everything to GN. 237 # TODO(GYP): Delete this after we've converted everything to GN.
338 # The _run targets exist only for compatibility with GYP. 238 # The _run targets exist only for compatibility with GYP.
339 group("${target_name}_run") { 239 group("${target_name}_run") {
340 testonly = true 240 testonly = true
341 deps = [ 241 deps = [
342 ":${invoker.target_name}", 242 ":${invoker.target_name}",
343 ] 243 ]
344 } 244 }
345 } 245 }
346 } 246 }
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