| OLD | NEW |
| 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 # 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 |
| 10 # set. | 10 # set. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 } | 28 } |
| 29 | 29 |
| 30 _test_runner_target = "${_output_name}__test_runner_script" | 30 _test_runner_target = "${_output_name}__test_runner_script" |
| 31 _wrapper_script_vars = [ | 31 _wrapper_script_vars = [ |
| 32 "ignore_all_data_deps", | 32 "ignore_all_data_deps", |
| 33 "shard_timeout", | 33 "shard_timeout", |
| 34 ] | 34 ] |
| 35 | 35 |
| 36 assert(_use_raw_android_executable || enable_java_templates) | 36 assert(_use_raw_android_executable || enable_java_templates) |
| 37 | 37 |
| 38 _incremental_apk_only = |
| 39 incremental_apk_by_default && !_use_raw_android_executable |
| 40 |
| 38 if (_use_raw_android_executable) { | 41 if (_use_raw_android_executable) { |
| 39 _exec_target = "${target_name}__exec" | 42 _exec_target = "${target_name}__exec" |
| 40 _dist_target = "${target_name}__dist" | 43 _dist_target = "${target_name}__dist" |
| 41 _exec_output = | 44 _exec_output = |
| 42 "$target_out_dir/${invoker.target_name}/${invoker.target_name}" | 45 "$target_out_dir/${invoker.target_name}/${invoker.target_name}" |
| 43 | 46 |
| 44 executable(_exec_target) { | 47 executable(_exec_target) { |
| 45 # Configs will always be defined since we set_defaults in BUILDCONFIG.gn
. | 48 # Configs will always be defined since we set_defaults in BUILDCONFIG.gn
. |
| 46 configs = [] | 49 configs = [] |
| 47 data_deps = [] | 50 data_deps = [] |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 # target (post-GYP). | 122 # target (post-GYP). |
| 120 # It's a bit backwards for the apk to depend on the runner script, since | 123 # It's a bit backwards for the apk to depend on the runner script, since |
| 121 # the apk is conceptually a runtime_dep of the script. However, it is | 124 # the apk is conceptually a runtime_dep of the script. However, it is |
| 122 # currently necessary because the bots build this _apk target directly | 125 # currently necessary because the bots build this _apk target directly |
| 123 # rather than the group() below. | 126 # rather than the group() below. |
| 124 data_deps = [ | 127 data_deps = [ |
| 125 ":$_test_runner_target", | 128 ":$_test_runner_target", |
| 126 ] | 129 ] |
| 127 } | 130 } |
| 128 | 131 |
| 129 # Incremental test targets work only for .apks. | 132 _test_runner_target = "${_output_name}__test_runner_script" |
| 133 _incremental_test_name = "${_output_name}_incremental" |
| 130 _incremental_test_runner_target = | 134 _incremental_test_runner_target = |
| 131 "${_output_name}_incremental__test_runner_script" | 135 "${_output_name}_incremental__test_runner_script" |
| 136 if (_incremental_apk_only) { |
| 137 _incremental_test_name = _output_name |
| 138 _incremental_test_runner_target = _test_runner_target |
| 139 } |
| 140 |
| 141 # Incremental test targets work only for .apks. |
| 132 test_runner_script(_incremental_test_runner_target) { | 142 test_runner_script(_incremental_test_runner_target) { |
| 133 forward_variables_from(invoker, | 143 forward_variables_from(invoker, |
| 134 _wrapper_script_vars + [ | 144 _wrapper_script_vars + [ |
| 135 "data", | 145 "data", |
| 136 "data_deps", | 146 "data_deps", |
| 137 "deps", | 147 "deps", |
| 138 "public_deps", | 148 "public_deps", |
| 139 ]) | 149 ]) |
| 140 apk_target = ":$_apk_target" | 150 apk_target = ":$_apk_target" |
| 141 test_name = "${_output_name}_incremental" | 151 test_name = _incremental_test_name |
| 142 test_type = "gtest" | 152 test_type = "gtest" |
| 143 test_suite = _output_name | 153 test_suite = _output_name |
| 144 incremental_install = true | 154 incremental_install = true |
| 145 } | 155 } |
| 146 group("${target_name}_incremental") { | 156 group("${target_name}_incremental") { |
| 147 testonly = true | 157 testonly = true |
| 148 datadeps = [ | 158 data_deps = [ |
| 149 ":$_incremental_test_runner_target", | 159 ":$_incremental_test_runner_target", |
| 150 ] | 160 ] |
| 151 deps = [ | 161 deps = [ |
| 152 ":${_apk_target}_incremental", | 162 ":${_apk_target}_incremental", |
| 153 ] | 163 ] |
| 154 } | 164 } |
| 155 } | 165 } |
| 156 | 166 |
| 157 _test_runner_target = "${_output_name}__test_runner_script" | 167 if (!_incremental_apk_only) { |
| 158 test_runner_script(_test_runner_target) { | 168 test_runner_script(_test_runner_target) { |
| 159 forward_variables_from(invoker, | 169 forward_variables_from(invoker, |
| 160 _wrapper_script_vars + [ | 170 _wrapper_script_vars + [ |
| 161 "data", | 171 "data", |
| 162 "data_deps", | 172 "data_deps", |
| 163 "deps", | 173 "deps", |
| 164 "public_deps", | 174 "public_deps", |
| 165 ]) | 175 ]) |
| 166 | 176 |
| 167 if (_use_raw_android_executable) { | 177 if (_use_raw_android_executable) { |
| 168 executable_dist_dir = "$root_out_dir/$_dist_target" | 178 executable_dist_dir = "$root_out_dir/$_dist_target" |
| 169 } else { | 179 } else { |
| 170 apk_target = ":$_apk_target" | 180 apk_target = ":$_apk_target" |
| 181 } |
| 182 test_name = _output_name |
| 183 test_type = "gtest" |
| 184 test_suite = _output_name |
| 171 } | 185 } |
| 172 test_name = _output_name | |
| 173 test_type = "gtest" | |
| 174 test_suite = _output_name | |
| 175 } | 186 } |
| 176 | 187 |
| 177 group(target_name) { | 188 group(target_name) { |
| 178 testonly = true | 189 testonly = true |
| 179 deps = [ | 190 if (_incremental_apk_only) { |
| 180 ":$_test_runner_target", | 191 deps = [ |
| 181 ] | 192 ":${target_name}_incremental", |
| 182 if (_use_raw_android_executable) { | 193 ] |
| 183 deps += [ ":$_dist_target" ] | |
| 184 } else { | 194 } else { |
| 185 deps += [ ":$_apk_target" ] | 195 deps = [ |
| 196 ":$_test_runner_target", |
| 197 ] |
| 198 if (_use_raw_android_executable) { |
| 199 deps += [ ":$_dist_target" ] |
| 200 } else { |
| 201 deps += [ ":$_apk_target" ] |
| 202 } |
| 186 } | 203 } |
| 187 } | 204 } |
| 188 | 205 |
| 189 # TODO(GYP_GONE): Delete this after we've converted everything to GN. | 206 # TODO(GYP_GONE): Delete this after we've converted everything to GN. |
| 190 # The _run targets exist only for compatibility w/ GYP. | 207 # The _run targets exist only for compatibility w/ GYP. |
| 191 group("${target_name}_apk_run") { | 208 group("${target_name}_apk_run") { |
| 192 testonly = true | 209 testonly = true |
| 193 deps = [ | 210 deps = [ |
| 194 ":${invoker.target_name}", | 211 ":${invoker.target_name}", |
| 195 ] | 212 ] |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 } | 301 } |
| 285 | 302 |
| 286 # Test defaults. | 303 # Test defaults. |
| 287 set_defaults("test") { | 304 set_defaults("test") { |
| 288 if (is_android) { | 305 if (is_android) { |
| 289 configs = default_shared_library_configs | 306 configs = default_shared_library_configs |
| 290 } else { | 307 } else { |
| 291 configs = default_executable_configs | 308 configs = default_executable_configs |
| 292 } | 309 } |
| 293 } | 310 } |
| OLD | NEW |