qsr | c6c612c | 2015-01-13 22:07:48 | [diff] [blame] | 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 |
| 3 | # found in the LICENSE file. |
qsr | fb5251d1 | 2015-01-21 15:57:22 | [diff] [blame] | 4 | |
| 5 | # ============================================================================== |
| 6 | # TEST SETUP |
| 7 | # ============================================================================== |
| 8 | |
Yuke Liao | e703384b | 2020-07-16 01:05:24 | [diff] [blame] | 9 | import("//build/config/chromeos/ui_mode.gni") |
Mirko Bonadei | 4a0df43 | 2020-09-08 19:06:02 | [diff] [blame] | 10 | import("//build_overrides/build.gni") |
Yuke Liao | e703384b | 2020-07-16 01:05:24 | [diff] [blame] | 11 | |
jcivelli | f4462a35 | 2017-01-10 04:45:59 | [diff] [blame] | 12 | if (is_android) { |
| 13 | import("//build/config/android/config.gni") |
James Cook | 209256f | 2018-12-07 18:40:50 | [diff] [blame] | 14 | import("//build/config/android/extract_unwind_tables.gni") |
jcivelli | f4462a35 | 2017-01-10 04:45:59 | [diff] [blame] | 15 | import("//build/config/android/rules.gni") |
Abhishek Arya | 2f5f734 | 2018-06-13 16:59:44 | [diff] [blame] | 16 | import("//build/config/sanitizers/sanitizers.gni") |
Dirk Pranke | dd4ff74 | 2020-11-18 19:57:32 | [diff] [blame] | 17 | } else if (is_fuchsia) { |
Kevin Marshall | 184e909 | 2018-02-07 21:09:06 | [diff] [blame] | 18 | import("//build/config/chromecast_build.gni") |
Chong Gu | 26908f4 | 2021-01-29 03:13:07 | [diff] [blame^] | 19 | import("//build/config/coverage/coverage.gni") |
Kevin Marshall | 55fd852 | 2019-10-04 22:47:01 | [diff] [blame] | 20 | import("//build/config/fuchsia/generate_runner_scripts.gni") |
Kevin Marshall | f35fa5f | 2018-01-29 19:24:42 | [diff] [blame] | 21 | import("//build/config/fuchsia/package.gni") |
Chong Gu | 26908f4 | 2021-01-29 03:13:07 | [diff] [blame^] | 22 | import("//third_party/fuchsia-sdk/sdk/build/cmc.gni") |
Yuta Hijikata | c297545 | 2020-12-16 15:59:39 | [diff] [blame] | 23 | } else if (is_chromeos_ash) { |
Ben Pastene | 4c35c57 | 2018-04-30 23:21:48 | [diff] [blame] | 24 | import("//build/config/chromeos/rules.gni") |
Dirk Pranke | dd4ff74 | 2020-11-18 19:57:32 | [diff] [blame] | 25 | import("//build/config/sanitizers/sanitizers.gni") |
Dirk Pranke | 6188075b | 2020-10-01 19:31:28 | [diff] [blame] | 26 | import("//build/util/generate_wrapper.gni") |
Dirk Pranke | dd4ff74 | 2020-11-18 19:57:32 | [diff] [blame] | 27 | } else if (is_ios) { |
Jeff Yoon | f7f4eb4 | 2020-03-06 18:55:36 | [diff] [blame] | 28 | import("//build/config/ios/ios_sdk.gni") |
| 29 | import("//build/config/ios/ios_test_runner_wrapper.gni") |
| 30 | import("//build/config/ios/rules.gni") |
Dirk Pranke | dd4ff74 | 2020-11-18 19:57:32 | [diff] [blame] | 31 | } else { |
Dirk Pranke | 31e346e | 2020-07-15 00:54:06 | [diff] [blame] | 32 | import("//build/config/sanitizers/sanitizers.gni") |
| 33 | import("//build/util/generate_wrapper.gni") |
| 34 | } |
| 35 | |
qsr | fb5251d1 | 2015-01-21 15:57:22 | [diff] [blame] | 36 | # Define a test as an executable (or apk on Android) with the "testonly" flag |
| 37 | # set. |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 38 | # Variable: |
Dirk Pranke | 79d065d | 2020-08-29 03:28:30 | [diff] [blame] | 39 | # use_xvfb: (optional) whether to run the executable under Xvfb. |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 40 | # use_raw_android_executable: Use executable() rather than android_apk(). |
ynovikov | 389d9e44 | 2016-05-27 02:34:56 | [diff] [blame] | 41 | # use_native_activity: Test implements ANativeActivity_onCreate(). |
Mirko Bonadei | 15522bc | 2020-09-16 20:38:39 | [diff] [blame] | 42 | # is_xctest: (iOS, optional) whether to build the executable as XCTest. |
| 43 | # Similar to the GN arg 'enable_run_ios_unittests_with_xctest' but |
| 44 | # for build targets. |
qsr | fb5251d1 | 2015-01-21 15:57:22 | [diff] [blame] | 45 | template("test") { |
Greg Guterman | 8da79b7 | 2021-01-07 23:41:09 | [diff] [blame] | 46 | # RTS |
| 47 | if (rts_exclude_file != "" && defined(invoker.sources) && |
| 48 | invoker.sources != []) { |
| 49 | # Normalize paths |
| 50 | abs_paths = get_path_info(invoker.sources, "abspath") |
| 51 | |
| 52 | # Filter |
| 53 | filtered_sources = filter_exclude(abs_paths, rts_exclusions) |
| 54 | |
| 55 | # Do the replacement |
| 56 | invoker.sources = [] |
| 57 | invoker.sources = filtered_sources |
| 58 | } |
| 59 | |
Andrew Grieve | 1b290e4a2 | 2020-11-24 20:07:01 | [diff] [blame] | 60 | testonly = true |
Mirko Bonadei | 15522bc | 2020-09-16 20:38:39 | [diff] [blame] | 61 | if (!is_ios) { |
| 62 | assert(!defined(invoker.is_xctest) || !invoker.is_xctest, |
| 63 | "is_xctest can be set only for iOS builds") |
| 64 | } |
qsr | fb5251d1 | 2015-01-21 15:57:22 | [diff] [blame] | 65 | if (is_android) { |
Dirk Pranke | 79d065d | 2020-08-29 03:28:30 | [diff] [blame] | 66 | assert(!defined(invoker.use_xvfb) || !invoker.use_xvfb) |
| 67 | |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 68 | _use_raw_android_executable = defined(invoker.use_raw_android_executable) && |
| 69 | invoker.use_raw_android_executable |
qsr | fb5251d1 | 2015-01-21 15:57:22 | [diff] [blame] | 70 | |
agrieve | 67855de | 2016-03-30 14:46:01 | [diff] [blame] | 71 | # output_name is used to allow targets with the same name but in different |
| 72 | # packages to still produce unique runner scripts. |
| 73 | _output_name = invoker.target_name |
mikecase | 56d80d7 | 2015-06-03 00:57:26 | [diff] [blame] | 74 | if (defined(invoker.output_name)) { |
agrieve | 67855de | 2016-03-30 14:46:01 | [diff] [blame] | 75 | _output_name = invoker.output_name |
mikecase | 56d80d7 | 2015-06-03 00:57:26 | [diff] [blame] | 76 | } |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 77 | |
agrieve | b355ad15 | 2016-04-19 03:45:23 | [diff] [blame] | 78 | _test_runner_target = "${_output_name}__test_runner_script" |
jbudorick | d29ecfa7 | 2016-11-18 22:45:42 | [diff] [blame] | 79 | _wrapper_script_vars = [ |
agrieve | e41ae190 | 2016-04-25 14:12:51 | [diff] [blame] | 80 | "ignore_all_data_deps", |
jbudorick | d29ecfa7 | 2016-11-18 22:45:42 | [diff] [blame] | 81 | "shard_timeout", |
agrieve | e41ae190 | 2016-04-25 14:12:51 | [diff] [blame] | 82 | ] |
agrieve | 3ac557f0 | 2016-04-12 15:52:00 | [diff] [blame] | 83 | |
jbudorick | ced2a25 | 2016-06-09 16:38:54 | [diff] [blame] | 84 | assert(_use_raw_android_executable || enable_java_templates) |
| 85 | |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 86 | if (_use_raw_android_executable) { |
| 87 | _exec_target = "${target_name}__exec" |
| 88 | _dist_target = "${target_name}__dist" |
| 89 | _exec_output = |
| 90 | "$target_out_dir/${invoker.target_name}/${invoker.target_name}" |
| 91 | |
| 92 | executable(_exec_target) { |
| 93 | # Configs will always be defined since we set_defaults in BUILDCONFIG.gn. |
| 94 | configs = [] |
| 95 | data_deps = [] |
jbudorick | d29ecfa7 | 2016-11-18 22:45:42 | [diff] [blame] | 96 | forward_variables_from(invoker, |
| 97 | "*", |
Andrew Grieve | 1b290e4a2 | 2020-11-24 20:07:01 | [diff] [blame] | 98 | TESTONLY_AND_VISIBILITY + _wrapper_script_vars + |
| 99 | [ "extra_dist_files" ]) |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 100 | |
| 101 | # Thanks to the set_defaults() for test(), configs are initialized with |
| 102 | # the default shared_library configs rather than executable configs. |
Thomas Anderson | 11c1d982 | 2019-01-15 06:32:59 | [diff] [blame] | 103 | configs -= [ |
| 104 | "//build/config:shared_library_config", |
| 105 | "//build/config/android:hide_all_but_jni", |
| 106 | ] |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 107 | configs += [ "//build/config:executable_config" ] |
| 108 | |
| 109 | # Don't output to the root or else conflict with the group() below. |
| 110 | output_name = rebase_path(_exec_output, root_out_dir) |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | create_native_executable_dist(_dist_target) { |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 114 | dist_dir = "$root_out_dir/$target_name" |
| 115 | binary = _exec_output |
Nico Weber | 852532f | 2020-01-28 18:17:22 | [diff] [blame] | 116 | deps = [ ":$_exec_target" ] |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 117 | if (defined(invoker.extra_dist_files)) { |
| 118 | extra_files = invoker.extra_dist_files |
| 119 | } |
| 120 | } |
| 121 | } else { |
Andrew Grieve | c61b8dff | 2019-10-21 16:32:02 | [diff] [blame] | 122 | _library_target = "${target_name}__library" |
| 123 | _apk_target = "${target_name}__apk" |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 124 | _apk_specific_vars = [ |
| 125 | "android_manifest", |
agrieve | c6811b42 | 2016-06-23 02:25:09 | [diff] [blame] | 126 | "android_manifest_dep", |
Clark DuVall | 1bee532 | 2020-06-10 05:51:55 | [diff] [blame] | 127 | "app_as_shared_lib", |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 128 | "enable_multidex", |
Benoît Lizé | d8b8f74 | 2019-11-07 12:50:07 | [diff] [blame] | 129 | "product_config_java_packages", |
Tibor Goldschwendt | 95db95d | 2019-06-17 20:32:02 | [diff] [blame] | 130 | "min_sdk_version", |
huapengl | c35ba6e | 2016-05-25 23:08:07 | [diff] [blame] | 131 | "proguard_configs", |
| 132 | "proguard_enabled", |
Fred Mello | 0cc91c6 | 2019-08-24 01:53:45 | [diff] [blame] | 133 | "srcjar_deps", |
Tibor Goldschwendt | 95db95d | 2019-06-17 20:32:02 | [diff] [blame] | 134 | "target_sdk_version", |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 135 | "use_default_launcher", |
ynovikov | 389d9e44 | 2016-05-27 02:34:56 | [diff] [blame] | 136 | "use_native_activity", |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 137 | ] |
Siddhartha | 764226b | 2018-03-13 02:32:55 | [diff] [blame] | 138 | |
| 139 | # Adds the unwind tables from unstripped binary as an asset file in the |
| 140 | # apk, if |add_unwind_tables_in_apk| is specified by the test. |
| 141 | if (defined(invoker.add_unwind_tables_in_apk) && |
| 142 | invoker.add_unwind_tables_in_apk) { |
| 143 | _unwind_table_asset_name = "${target_name}_unwind_assets" |
| 144 | unwind_table_asset(_unwind_table_asset_name) { |
Siddhartha | 764226b | 2018-03-13 02:32:55 | [diff] [blame] | 145 | library_target = _library_target |
Nico Weber | 852532f | 2020-01-28 18:17:22 | [diff] [blame] | 146 | deps = [ ":$_library_target" ] |
Siddhartha | 764226b | 2018-03-13 02:32:55 | [diff] [blame] | 147 | } |
| 148 | } |
| 149 | |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 150 | shared_library(_library_target) { |
| 151 | # Configs will always be defined since we set_defaults in BUILDCONFIG.gn. |
| 152 | configs = [] # Prevent list overwriting warning. |
| 153 | configs = invoker.configs |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 154 | |
jbudorick | d29ecfa7 | 2016-11-18 22:45:42 | [diff] [blame] | 155 | forward_variables_from( |
| 156 | invoker, |
| 157 | "*", |
Peter Wen | 2052bd1 | 2020-12-03 20:15:07 | [diff] [blame] | 158 | [ "deps" ] + _apk_specific_vars + _wrapper_script_vars + |
| 159 | TESTONLY_AND_VISIBILITY) |
| 160 | |
| 161 | # Native targets do not need to depend on java targets. Filter them out |
| 162 | # so that the shared library can be built without needing to wait for |
| 163 | # dependent java targets. |
| 164 | deps = [] |
| 165 | if (defined(invoker.deps)) { |
| 166 | foreach(_dep, invoker.deps) { |
| 167 | _target_label = get_label_info(_dep, "label_no_toolchain") |
| 168 | if (filter_exclude([ _target_label ], java_target_patterns) != []) { |
| 169 | deps += [ _dep ] |
| 170 | } |
| 171 | } |
| 172 | } |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 173 | |
| 174 | if (!defined(invoker.use_default_launcher) || |
| 175 | invoker.use_default_launcher) { |
Tom Anderson | ce772fa | 2018-05-30 22:20:37 | [diff] [blame] | 176 | deps += [ "//testing/android/native_test:native_test_native_code" ] |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 177 | } |
| 178 | } |
| 179 | unittest_apk(_apk_target) { |
Daniel Bratell | fdda465 | 2019-01-31 15:45:54 | [diff] [blame] | 180 | forward_variables_from(invoker, _apk_specific_vars) |
agrieve | 48bd27e | 2016-06-22 21:04:07 | [diff] [blame] | 181 | shared_library = ":$_library_target" |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 182 | apk_name = invoker.target_name |
| 183 | if (defined(invoker.output_name)) { |
| 184 | apk_name = invoker.output_name |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 185 | install_script_name = "install_${invoker.output_name}" |
| 186 | } |
agrieve | b355ad15 | 2016-04-19 03:45:23 | [diff] [blame] | 187 | |
Daniel Bratell | fdda465 | 2019-01-31 15:45:54 | [diff] [blame] | 188 | if (defined(invoker.deps)) { |
| 189 | deps = invoker.deps |
| 190 | } else { |
| 191 | deps = [] |
| 192 | } |
| 193 | |
jcivelli | f4462a35 | 2017-01-10 04:45:59 | [diff] [blame] | 194 | # Add the Java classes so that each target does not have to do it. |
| 195 | deps += [ "//base/test:test_support_java" ] |
| 196 | |
Siddhartha | 764226b | 2018-03-13 02:32:55 | [diff] [blame] | 197 | if (defined(_unwind_table_asset_name)) { |
| 198 | deps += [ ":${_unwind_table_asset_name}" ] |
| 199 | } |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 200 | } |
Andrew Grieve | e1dc23f | 2019-10-22 16:26:36 | [diff] [blame] | 201 | } |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 202 | |
Andrew Grieve | e1dc23f | 2019-10-22 16:26:36 | [diff] [blame] | 203 | test_runner_script(_test_runner_target) { |
| 204 | forward_variables_from(invoker, _wrapper_script_vars) |
estevenson | ce84439 | 2016-12-15 19:57:57 | [diff] [blame] | 205 | |
Andrew Grieve | e1dc23f | 2019-10-22 16:26:36 | [diff] [blame] | 206 | if (_use_raw_android_executable) { |
| 207 | executable_dist_dir = "$root_out_dir/$_dist_target" |
John Budorick | d5dccb2 | 2020-02-01 02:16:34 | [diff] [blame] | 208 | data_deps = [ ":$_exec_target" ] |
Andrew Grieve | e1dc23f | 2019-10-22 16:26:36 | [diff] [blame] | 209 | } else { |
| 210 | apk_target = ":$_apk_target" |
| 211 | incremental_apk = incremental_install |
Andrew Grieve | 7ca6de3 | 2019-10-18 03:57:47 | [diff] [blame] | 212 | |
| 213 | # Dep needed for the test runner .runtime_deps file to pick up data |
| 214 | # deps from the forward_variables_from(invoker, "*") on the library. |
Nico Weber | 852532f | 2020-01-28 18:17:22 | [diff] [blame] | 215 | data_deps = [ ":$_library_target" ] |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 216 | } |
Andrew Grieve | e1dc23f | 2019-10-22 16:26:36 | [diff] [blame] | 217 | test_name = _output_name |
| 218 | test_suite = _output_name |
| 219 | test_type = "gtest" |
mikecase | 56d80d7 | 2015-06-03 00:57:26 | [diff] [blame] | 220 | } |
| 221 | |
Andrew Grieve | 7ca6de3 | 2019-10-18 03:57:47 | [diff] [blame] | 222 | # Create a wrapper script rather than using a group() in order to ensure |
| 223 | # "ninja $target_name" always works. If this was a group(), then GN would |
| 224 | # not create a top-level alias for it if a target exists in another |
| 225 | # directory with the same $target_name. |
| 226 | # Also - bots run this script directly for "components_perftests". |
| 227 | generate_wrapper(target_name) { |
Andrew Grieve | 1b290e4a2 | 2020-11-24 20:07:01 | [diff] [blame] | 228 | forward_variables_from(invoker, [ "visibility" ]) |
Andrew Grieve | 7ca6de3 | 2019-10-18 03:57:47 | [diff] [blame] | 229 | executable = "$root_build_dir/bin/run_$_output_name" |
| 230 | wrapper_script = "$root_build_dir/$_output_name" |
Nico Weber | 852532f | 2020-01-28 18:17:22 | [diff] [blame] | 231 | deps = [ ":$_test_runner_target" ] |
jbudorick | 686094f6 | 2017-05-04 21:52:40 | [diff] [blame] | 232 | if (_use_raw_android_executable) { |
Andrew Grieve | 7ca6de3 | 2019-10-18 03:57:47 | [diff] [blame] | 233 | deps += [ ":$_dist_target" ] |
jbudorick | 686094f6 | 2017-05-04 21:52:40 | [diff] [blame] | 234 | } else { |
Andrew Grieve | 7ca6de3 | 2019-10-18 03:57:47 | [diff] [blame] | 235 | # Dep needed for the swarming .isolate file to pick up data |
| 236 | # deps from the forward_variables_from(invoker, "*") on the library. |
| 237 | deps += [ |
| 238 | ":$_apk_target", |
| 239 | ":$_library_target", |
| 240 | ] |
agrieve | 62ab0028 | 2016-04-05 02:03:45 | [diff] [blame] | 241 | } |
agrieve | 1a02e58 | 2015-10-15 21:35:39 | [diff] [blame] | 242 | } |
Scott Graham | 4c4cdc5 | 2017-05-29 20:45:03 | [diff] [blame] | 243 | } else if (is_fuchsia) { |
Dirk Pranke | 79d065d | 2020-08-29 03:28:30 | [diff] [blame] | 244 | assert(!defined(invoker.use_xvfb) || !invoker.use_xvfb) |
| 245 | |
Scott Graham | 4c4cdc5 | 2017-05-29 20:45:03 | [diff] [blame] | 246 | _output_name = invoker.target_name |
Kevin Marshall | f35fa5f | 2018-01-29 19:24:42 | [diff] [blame] | 247 | _pkg_target = "${_output_name}_pkg" |
Kevin Marshall | f35fa5f | 2018-01-29 19:24:42 | [diff] [blame] | 248 | _exec_target = "${_output_name}__exec" |
Scott Graham | 4c4cdc5 | 2017-05-29 20:45:03 | [diff] [blame] | 249 | |
Chong Gu | 26908f4 | 2021-01-29 03:13:07 | [diff] [blame^] | 250 | # TODO(1019938): switch the default to tests.cmx which doesn't request |
| 251 | # the deprecated-ambient-replace-as-executable feature. |
| 252 | if (!defined(invoker.manifest)) { |
| 253 | manifest = "//build/config/fuchsia/tests-with-exec.cmx" |
| 254 | } else { |
| 255 | manifest = invoker.manifest |
| 256 | } |
| 257 | |
| 258 | if (use_clang_coverage) { |
| 259 | component_with_coverage_manifest = "${target_name}-coverage.test-cmx" |
| 260 | cmc_merge(component_with_coverage_manifest) { |
| 261 | sources = [ |
| 262 | "//build/config/fuchsia/add_DebugData_service.test-cmx", |
| 263 | manifest, |
| 264 | ] |
| 265 | output_name = target_name |
| 266 | } |
| 267 | manifest = "${target_out_dir}/${component_with_coverage_manifest}" |
| 268 | } |
| 269 | |
Kevin Marshall | 39b4aa8 | 2018-06-23 00:12:15 | [diff] [blame] | 270 | fuchsia_package_runner(target_name) { |
Dirk Pranke | d5e9a1b2 | 2020-10-28 22:52:59 | [diff] [blame] | 271 | is_test_exe = true |
Fabrice de Gans-Riberi | 041a652 | 2018-12-11 00:20:53 | [diff] [blame] | 272 | forward_variables_from(invoker, |
| 273 | [ |
| 274 | "use_test_server", |
| 275 | "package_deps", |
Andrew Grieve | 1b290e4a2 | 2020-11-24 20:07:01 | [diff] [blame] | 276 | "visibility", |
Fabrice de Gans-Riberi | 041a652 | 2018-12-11 00:20:53 | [diff] [blame] | 277 | ]) |
Kevin Marshall | 39b4aa8 | 2018-06-23 00:12:15 | [diff] [blame] | 278 | runner_script = "//build/fuchsia/test_runner.py" |
| 279 | package = ":$_pkg_target" |
| 280 | package_name_override = _output_name |
Dimitri Glazkov | c95e6dd | 2018-08-24 23:39:42 | [diff] [blame] | 281 | |
Wez | dd593a5 | 2020-04-08 17:09:46 | [diff] [blame] | 282 | data_deps = [ "//testing/buildbot/filters:fuchsia_filters" ] |
Kevin Marshall | f35fa5f | 2018-01-29 19:24:42 | [diff] [blame] | 283 | } |
| 284 | |
Wez | abe2d75 | 2020-02-11 17:12:23 | [diff] [blame] | 285 | cr_fuchsia_package(_pkg_target) { |
Fabrice de Gans-Riberi | a16cac8 | 2019-06-03 19:03:20 | [diff] [blame] | 286 | binary = ":$_exec_target" |
| 287 | package_name_override = _output_name |
Chong Gu | 26908f4 | 2021-01-29 03:13:07 | [diff] [blame^] | 288 | if (use_clang_coverage) { |
| 289 | deps = [ ":$component_with_coverage_manifest" ] |
| 290 | } |
Fabrice de Gans-Riberi | a16cac8 | 2019-06-03 19:03:20 | [diff] [blame] | 291 | } |
| 292 | |
Kevin Marshall | f35fa5f | 2018-01-29 19:24:42 | [diff] [blame] | 293 | executable(_exec_target) { |
Andrew Grieve | 1b290e4a2 | 2020-11-24 20:07:01 | [diff] [blame] | 294 | forward_variables_from(invoker, "*", TESTONLY_AND_VISIBILITY) |
Kevin Marshall | f35fa5f | 2018-01-29 19:24:42 | [diff] [blame] | 295 | output_name = _exec_target |
Scott Graham | 4c4cdc5 | 2017-05-29 20:45:03 | [diff] [blame] | 296 | } |
dpranke | 2a29462 | 2015-08-07 05:23:01 | [diff] [blame] | 297 | } else if (is_ios) { |
Dirk Pranke | 79d065d | 2020-08-29 03:28:30 | [diff] [blame] | 298 | assert(!defined(invoker.use_xvfb) || !invoker.use_xvfb) |
Mirko Bonadei | 50e251d | 2020-09-14 18:05:46 | [diff] [blame] | 299 | _runtime_deps_file = "$root_out_dir/${target_name}.runtime_deps" |
Dirk Pranke | 79d065d | 2020-08-29 03:28:30 | [diff] [blame] | 300 | |
Rohit Rao | f9b096d | 2019-09-09 22:26:23 | [diff] [blame] | 301 | declare_args() { |
| 302 | # Keep the unittest-as-xctest functionality defaulted to off until the |
| 303 | # bots are updated to handle it properly. |
| 304 | # TODO(crbug.com/1001667): Remove this arg once the iOS test runner |
| 305 | # supports running unittests with xctest. |
| 306 | enable_run_ios_unittests_with_xctest = false |
| 307 | } |
| 308 | |
sdefresne | 01285787 | 2016-03-16 10:55:37 | [diff] [blame] | 309 | _test_target = target_name |
Jeff Yoon | f7f4eb4 | 2020-03-06 18:55:36 | [diff] [blame] | 310 | _wrapper_output_name = "run_${target_name}" |
| 311 | ios_test_runner_wrapper(_wrapper_output_name) { |
| 312 | forward_variables_from(invoker, |
| 313 | [ |
| 314 | "data", |
| 315 | "data_deps", |
| 316 | "deps", |
| 317 | "executable_args", |
| 318 | "retries", |
| 319 | "shards", |
| 320 | ]) |
| 321 | |
| 322 | _root_build_dir = rebase_path("${root_build_dir}", root_build_dir) |
| 323 | |
| 324 | if (!defined(executable_args)) { |
| 325 | executable_args = [] |
| 326 | } |
| 327 | executable_args += [ |
| 328 | "--app", |
| 329 | "@WrappedPath(${_root_build_dir}/${_test_target}.app)", |
| 330 | ] |
| 331 | |
| 332 | wrapper_output_name = "${_wrapper_output_name}" |
| 333 | } |
| 334 | |
sdefresne | 01285787 | 2016-03-16 10:55:37 | [diff] [blame] | 335 | _resources_bundle_data = target_name + "_resources_bundle_data" |
| 336 | |
| 337 | bundle_data(_resources_bundle_data) { |
sdefresne | 047490e | 2016-07-22 08:49:34 | [diff] [blame] | 338 | visibility = [ ":$_test_target" ] |
Nico Weber | 852532f | 2020-01-28 18:17:22 | [diff] [blame] | 339 | sources = [ "//testing/gtest_ios/Default.png" ] |
| 340 | outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ] |
dpranke | 2a29462 | 2015-08-07 05:23:01 | [diff] [blame] | 341 | } |
| 342 | |
Mirko Bonadei | 15522bc | 2020-09-16 20:38:39 | [diff] [blame] | 343 | force_xctest = enable_run_ios_unittests_with_xctest || |
| 344 | (defined(invoker.is_xctest) && invoker.is_xctest) |
| 345 | |
| 346 | if (force_xctest) { |
Rohit Rao | f9b096d | 2019-09-09 22:26:23 | [diff] [blame] | 347 | ios_test_target_type = "ios_xctest_test" |
| 348 | } else { |
| 349 | ios_test_target_type = "ios_app_bundle" |
| 350 | } |
| 351 | |
| 352 | target(ios_test_target_type, _test_target) { |
dpranke | 2a29462 | 2015-08-07 05:23:01 | [diff] [blame] | 353 | testonly = true |
sdefresne | a828c28 | 2016-05-30 18:04:20 | [diff] [blame] | 354 | |
Mirko Bonadei | 15522bc | 2020-09-16 20:38:39 | [diff] [blame] | 355 | if (force_xctest && build_with_chromium) { |
Rohit Rao | f9b096d | 2019-09-09 22:26:23 | [diff] [blame] | 356 | xctest_module_target = "//base/test:google_test_runner" |
| 357 | } |
| 358 | |
Andrew Grieve | 1b290e4a2 | 2020-11-24 20:07:01 | [diff] [blame] | 359 | forward_variables_from(invoker, "*", TESTONLY_AND_VISIBILITY) |
sdefresne | 9e147e0 | 2016-06-07 00:10:13 | [diff] [blame] | 360 | |
| 361 | # Provide sensible defaults in case invoker did not define any of those |
| 362 | # required variables. |
sdefresne | 05b97ca | 2016-06-08 07:19:46 | [diff] [blame] | 363 | if (!defined(info_plist) && !defined(info_plist_target)) { |
sdefresne | 9e147e0 | 2016-06-07 00:10:13 | [diff] [blame] | 364 | info_plist = "//testing/gtest_ios/unittest-Info.plist" |
| 365 | } |
sdefresne | 9e147e0 | 2016-06-07 00:10:13 | [diff] [blame] | 366 | |
Olivier Robin | 9689c56 | 2020-04-17 14:03:57 | [diff] [blame] | 367 | _gtest_bundle_id_suffix = "${target_name}" |
| 368 | xcode_product_bundle_id = "gtest.$_gtest_bundle_id_suffix" |
Justin Cohen | a819c11 | 2019-08-17 02:19:19 | [diff] [blame] | 369 | |
sdefresne | 9e147e0 | 2016-06-07 00:10:13 | [diff] [blame] | 370 | if (!defined(extra_substitutions)) { |
| 371 | extra_substitutions = [] |
| 372 | } |
Olivier Robin | 9689c56 | 2020-04-17 14:03:57 | [diff] [blame] | 373 | extra_substitutions += |
| 374 | [ "GTEST_BUNDLE_ID_SUFFIX=$_gtest_bundle_id_suffix" ] |
dpranke | 2a29462 | 2015-08-07 05:23:01 | [diff] [blame] | 375 | |
sdefresne | 047490e | 2016-07-22 08:49:34 | [diff] [blame] | 376 | if (!defined(bundle_deps)) { |
| 377 | bundle_deps = [] |
| 378 | } |
| 379 | bundle_deps += [ ":$_resources_bundle_data" ] |
Jeff Yoon | f7f4eb4 | 2020-03-06 18:55:36 | [diff] [blame] | 380 | |
| 381 | if (!defined(data_deps)) { |
| 382 | data_deps = [] |
| 383 | } |
| 384 | |
| 385 | # Include the generate_wrapper as part of data_deps |
| 386 | data_deps += [ ":${_wrapper_output_name}" ] |
Mirko Bonadei | 50e251d | 2020-09-14 18:05:46 | [diff] [blame] | 387 | write_runtime_deps = _runtime_deps_file |
dpranke | 2a29462 | 2015-08-07 05:23:01 | [diff] [blame] | 388 | } |
Yuta Hijikata | c297545 | 2020-12-16 15:59:39 | [diff] [blame] | 389 | } else if (is_chromeos_ash && cros_board != "") { |
Dirk Pranke | 79d065d | 2020-08-29 03:28:30 | [diff] [blame] | 390 | assert(!defined(invoker.use_xvfb) || !invoker.use_xvfb) |
| 391 | |
Ben Pastene | 1688203 | 2018-09-21 01:16:39 | [diff] [blame] | 392 | # Building for a cros board (ie: not linux-chromeos). |
Benjamin Pastene | 3bce864e | 2018-04-14 01:16:32 | [diff] [blame] | 393 | |
Benjamin Pastene | 3bce864e | 2018-04-14 01:16:32 | [diff] [blame] | 394 | _gen_runner_target = "${target_name}__runner" |
| 395 | _runtime_deps_file = |
| 396 | "$root_out_dir/gen.runtime/" + get_label_info(target_name, "dir") + |
| 397 | "/" + get_label_info(target_name, "name") + ".runtime_deps" |
| 398 | |
Ben Pastene | 4ab9865 | 2018-12-17 18:33:18 | [diff] [blame] | 399 | generate_runner_script(_gen_runner_target) { |
Benjamin Pastene | 3bce864e | 2018-04-14 01:16:32 | [diff] [blame] | 400 | generated_script = "$root_build_dir/bin/run_" + invoker.target_name |
Ben Pastene | 1688203 | 2018-09-21 01:16:39 | [diff] [blame] | 401 | test_exe = invoker.target_name |
Benjamin Pastene | 3bce864e | 2018-04-14 01:16:32 | [diff] [blame] | 402 | runtime_deps_file = _runtime_deps_file |
| 403 | } |
| 404 | |
| 405 | executable(target_name) { |
Andrew Grieve | 1b290e4a2 | 2020-11-24 20:07:01 | [diff] [blame] | 406 | forward_variables_from(invoker, "*", TESTONLY_AND_VISIBILITY) |
| 407 | forward_variables_from(invoker, [ "visibility" ]) |
Benjamin Pastene | 3bce864e | 2018-04-14 01:16:32 | [diff] [blame] | 408 | if (!defined(deps)) { |
| 409 | deps = [] |
| 410 | } |
| 411 | if (!defined(data)) { |
| 412 | data = [] |
| 413 | } |
| 414 | |
Ben Pastene | 4104178 | 2019-02-16 04:21:58 | [diff] [blame] | 415 | # We use a special trigger script for CrOS hardware tests. |
| 416 | data += [ "//testing/trigger_scripts/chromeos_device_trigger.py" ] |
| 417 | |
Benjamin Pastene | 3bce864e | 2018-04-14 01:16:32 | [diff] [blame] | 418 | output_name = target_name |
| 419 | write_runtime_deps = _runtime_deps_file |
| 420 | data += [ _runtime_deps_file ] |
Tom Anderson | ce772fa | 2018-05-30 22:20:37 | [diff] [blame] | 421 | deps += [ ":$_gen_runner_target" ] |
Benjamin Pastene | 3bce864e | 2018-04-14 01:16:32 | [diff] [blame] | 422 | } |
Yuke Liao | e703384b | 2020-07-16 01:05:24 | [diff] [blame] | 423 | } else if (chromeos_is_browser_only) { |
| 424 | _runtime_deps_file = "$root_out_dir/${target_name}.runtime_deps" |
| 425 | _executable = target_name |
| 426 | _gen_runner_target = "${target_name}__runner" |
| 427 | |
Yuke Liao | 32af424 | 2020-07-16 21:48:02 | [diff] [blame] | 428 | if (defined(invoker.use_xvfb)) { |
| 429 | _use_xvfb = invoker.use_xvfb |
| 430 | } else { |
| 431 | _use_xvfb = false |
| 432 | } |
| 433 | |
Yuke Liao | d037abc | 2020-10-06 22:48:22 | [diff] [blame] | 434 | # When use_xvfb is set by the invoker, it indicates that running this test |
| 435 | # target requires a window, and in lacros build, ash-chrome serves as the |
| 436 | # display server. Note that even though the tests themselves do not require |
| 437 | # xvfb anymore, xvfb.py is still needed to invoke the lacros test runner |
| 438 | # because ash-chrome is based on x11. |
| 439 | _use_ash_chrome = _use_xvfb |
| 440 | |
Yuke Liao | e703384b | 2020-07-16 01:05:24 | [diff] [blame] | 441 | generate_wrapper(_gen_runner_target) { |
Yuke Liao | e703384b | 2020-07-16 01:05:24 | [diff] [blame] | 442 | wrapper_script = "$root_build_dir/bin/run_" + _executable |
Yuke Liao | 32af424 | 2020-07-16 21:48:02 | [diff] [blame] | 443 | |
Yuke Liao | 2e4953cf | 2020-07-26 19:20:19 | [diff] [blame] | 444 | data = [] |
Yuke Liao | 32af424 | 2020-07-16 21:48:02 | [diff] [blame] | 445 | if (_use_xvfb) { |
| 446 | executable = "//testing/xvfb.py" |
Yuke Liao | 2e4953cf | 2020-07-26 19:20:19 | [diff] [blame] | 447 | data += [ "//testing/xvfb.py" ] |
Yuke Liao | 32af424 | 2020-07-16 21:48:02 | [diff] [blame] | 448 | } else { |
| 449 | executable = "//testing/test_env.py" |
Yuke Liao | 2e4953cf | 2020-07-26 19:20:19 | [diff] [blame] | 450 | data += [ "//testing/test_env.py" ] |
Yuke Liao | 32af424 | 2020-07-16 21:48:02 | [diff] [blame] | 451 | } |
| 452 | |
Yuke Liao | e703384b | 2020-07-16 01:05:24 | [diff] [blame] | 453 | executable_args = [ |
Yuke Liao | 32af424 | 2020-07-16 21:48:02 | [diff] [blame] | 454 | "@WrappedPath(../../build/lacros/test_runner.py)", |
Yuke Liao | 240816d | 2020-07-22 00:10:39 | [diff] [blame] | 455 | "test", |
Yuke Liao | e703384b | 2020-07-16 01:05:24 | [diff] [blame] | 456 | "@WrappedPath(./${_executable})", |
| 457 | "--test-launcher-bot-mode", |
| 458 | ] |
Yuke Liao | 32af424 | 2020-07-16 21:48:02 | [diff] [blame] | 459 | |
Yuke Liao | f540c74 | 2020-07-29 16:28:34 | [diff] [blame] | 460 | if (_use_ash_chrome) { |
Yuke Liao | 8348aa4 | 2020-11-04 19:35:23 | [diff] [blame] | 461 | executable_args += [ "--ash-chrome-path=ash_clang_x64/chrome" ] |
Yuke Liao | 240816d | 2020-07-22 00:10:39 | [diff] [blame] | 462 | } |
| 463 | |
Yuke Liao | e703384b | 2020-07-16 01:05:24 | [diff] [blame] | 464 | if (is_asan) { |
| 465 | executable_args += [ "--asan=true" ] |
| 466 | } |
| 467 | if (is_msan) { |
| 468 | executable_args += [ "--msan=true" ] |
| 469 | } |
| 470 | if (is_tsan) { |
| 471 | executable_args += [ "--tsan=true" ] |
| 472 | } |
| 473 | if (use_cfi_diag) { |
| 474 | executable_args += [ "--cfi-diag=true" ] |
| 475 | } |
| 476 | |
Yuke Liao | 2e4953cf | 2020-07-26 19:20:19 | [diff] [blame] | 477 | data += [ |
Yuke Liao | 240816d | 2020-07-22 00:10:39 | [diff] [blame] | 478 | "//build/lacros/test_runner.py", |
Yuke Liao | e703384b | 2020-07-16 01:05:24 | [diff] [blame] | 479 | "//.vpython", |
| 480 | ] |
| 481 | } |
| 482 | |
| 483 | executable(target_name) { |
Andrew Grieve | 1b290e4a2 | 2020-11-24 20:07:01 | [diff] [blame] | 484 | forward_variables_from(invoker, "*", TESTONLY_AND_VISIBILITY) |
| 485 | forward_variables_from(invoker, [ "visibility" ]) |
Yuke Liao | e703384b | 2020-07-16 01:05:24 | [diff] [blame] | 486 | if (!defined(deps)) { |
| 487 | deps = [] |
| 488 | } |
| 489 | |
Yuke Liao | d037abc | 2020-10-06 22:48:22 | [diff] [blame] | 490 | if (!defined(data_deps)) { |
| 491 | data_deps = [] |
| 492 | } |
| 493 | |
Yuke Liao | e703384b | 2020-07-16 01:05:24 | [diff] [blame] | 494 | write_runtime_deps = _runtime_deps_file |
| 495 | deps += [ ":$_gen_runner_target" ] |
Yuke Liao | d037abc | 2020-10-06 22:48:22 | [diff] [blame] | 496 | if (_use_ash_chrome && also_build_ash_chrome) { |
| 497 | data_deps += |
| 498 | [ "//chrome:chrome(//build/toolchain/linux:ash_clang_x64)" ] |
| 499 | } |
Yuke Liao | e703384b | 2020-07-16 01:05:24 | [diff] [blame] | 500 | } |
Dirk Pranke | dd4ff74 | 2020-11-18 19:57:32 | [diff] [blame] | 501 | } else if (!is_nacl) { |
Dirk Pranke | 79d065d | 2020-08-29 03:28:30 | [diff] [blame] | 502 | if (is_mac || is_win) { |
| 503 | assert(!defined(invoker.use_xvfb) || !invoker.use_xvfb) |
| 504 | } |
| 505 | |
Dirk Pranke | dd4ff74 | 2020-11-18 19:57:32 | [diff] [blame] | 506 | _runtime_deps_file = "$root_out_dir/${target_name}.runtime_deps" |
| 507 | _executable = target_name |
| 508 | _gen_runner_target = "${target_name}__runner" |
Dirk Pranke | 31e346e | 2020-07-15 00:54:06 | [diff] [blame] | 509 | |
Dirk Pranke | dd4ff74 | 2020-11-18 19:57:32 | [diff] [blame] | 510 | if ((is_linux || is_chromeos) && defined(invoker.use_xvfb)) { |
| 511 | _use_xvfb = invoker.use_xvfb |
| 512 | } else { |
| 513 | _use_xvfb = false |
| 514 | } |
| 515 | |
| 516 | generate_wrapper(_gen_runner_target) { |
Dirk Pranke | dd4ff74 | 2020-11-18 19:57:32 | [diff] [blame] | 517 | wrapper_script = "$root_build_dir/bin/run_" + _executable |
| 518 | |
| 519 | data = [] |
| 520 | if (_use_xvfb) { |
| 521 | executable = "//testing/xvfb.py" |
| 522 | data += [ "//testing/xvfb.py" ] |
Dirk Pranke | 31e346e | 2020-07-15 00:54:06 | [diff] [blame] | 523 | } else { |
Dirk Pranke | dd4ff74 | 2020-11-18 19:57:32 | [diff] [blame] | 524 | executable = "//testing/test_env.py" |
| 525 | data += [ "//testing/test_env.py" ] |
Dirk Pranke | 31e346e | 2020-07-15 00:54:06 | [diff] [blame] | 526 | } |
| 527 | |
Dirk Pranke | dd4ff74 | 2020-11-18 19:57:32 | [diff] [blame] | 528 | executable_args = [ |
| 529 | "@WrappedPath(./${_executable})", |
| 530 | "--test-launcher-bot-mode", |
| 531 | ] |
| 532 | if (is_asan) { |
| 533 | executable_args += [ "--asan=true" ] |
Dirk Pranke | 31e346e | 2020-07-15 00:54:06 | [diff] [blame] | 534 | } |
Dirk Pranke | dd4ff74 | 2020-11-18 19:57:32 | [diff] [blame] | 535 | if (is_msan) { |
| 536 | executable_args += [ "--msan=true" ] |
| 537 | } |
| 538 | if (is_tsan) { |
| 539 | executable_args += [ "--tsan=true" ] |
| 540 | } |
| 541 | if (use_cfi_diag) { |
| 542 | executable_args += [ "--cfi-diag=true" ] |
| 543 | } |
| 544 | |
| 545 | data += [ "//.vpython" ] |
Dirk Pranke | 31e346e | 2020-07-15 00:54:06 | [diff] [blame] | 546 | } |
| 547 | |
| 548 | executable(target_name) { |
Andrew Grieve | 1b290e4a2 | 2020-11-24 20:07:01 | [diff] [blame] | 549 | forward_variables_from(invoker, |
| 550 | "*", |
| 551 | TESTONLY_AND_VISIBILITY + [ "use_xvfb" ]) |
| 552 | forward_variables_from(invoker, [ "visibility" ]) |
Dirk Pranke | 31e346e | 2020-07-15 00:54:06 | [diff] [blame] | 553 | if (!defined(deps)) { |
| 554 | deps = [] |
| 555 | } |
| 556 | |
Dirk Pranke | 31e346e | 2020-07-15 00:54:06 | [diff] [blame] | 557 | deps += [ |
| 558 | # Give tests the default manifest on Windows (a no-op elsewhere). |
| 559 | "//build/win:default_exe_manifest", |
| 560 | ] |
| 561 | |
Dirk Pranke | dd4ff74 | 2020-11-18 19:57:32 | [diff] [blame] | 562 | write_runtime_deps = _runtime_deps_file |
| 563 | deps += [ ":$_gen_runner_target" ] |
| 564 | } |
| 565 | } else { |
| 566 | # This is a catch-all clause for NaCl toolchains and other random |
| 567 | # configurations that might define tests; test() in these configs |
| 568 | # will just define the underlying executables. |
| 569 | assert(!defined(invoker.use_xvfb) || !invoker.use_xvfb, |
| 570 | "use_xvfb should not be defined for a non-linux configuration") |
| 571 | executable(target_name) { |
Andrew Grieve | 1b290e4a2 | 2020-11-24 20:07:01 | [diff] [blame] | 572 | forward_variables_from(invoker, "*", TESTONLY_AND_VISIBILITY) |
| 573 | forward_variables_from(invoker, [ "visibility" ]) |
Dirk Pranke | dd4ff74 | 2020-11-18 19:57:32 | [diff] [blame] | 574 | if (!defined(deps)) { |
| 575 | deps = [] |
Dirk Pranke | 31e346e | 2020-07-15 00:54:06 | [diff] [blame] | 576 | } |
| 577 | } |
qsr | fb5251d1 | 2015-01-21 15:57:22 | [diff] [blame] | 578 | } |
| 579 | } |
brettw | edb6ecc | 2016-07-14 23:37:03 | [diff] [blame] | 580 | |
Dirk Pranke | 6188075b | 2020-10-01 19:31:28 | [diff] [blame] | 581 | # Defines a type of test that invokes a script to run, rather than |
| 582 | # invoking an executable. |
| 583 | # |
| 584 | # The script must implement the |
| 585 | # [test executable API](//docs/testing/test_executable_api.md). |
| 586 | # |
| 587 | # The template must be passed the `script` parameter, which specifies |
| 588 | # the path to the script to run. It may optionally be passed a |
| 589 | # `script_args` parameter, which can be used to include a list of |
| 590 | # args to be specified by default. The template will produce |
| 591 | # a `$root_build_dir/run_$target_name` wrapper and write the runtime_deps |
| 592 | # for the target to $root_build_dir/${target_name}.runtime_deps, as per |
| 593 | # the conventions listed in the |
| 594 | # [test wrapper API](//docs/testing/test_wrapper_api.md). |
| 595 | template("script_test") { |
| 596 | generate_wrapper(target_name) { |
| 597 | testonly = true |
| 598 | wrapper_script = "${root_build_dir}/bin/run_${target_name}" |
| 599 | |
| 600 | executable = "//testing/test_env.py" |
| 601 | |
| 602 | executable_args = |
| 603 | [ "@WrappedPath(" + rebase_path(invoker.script, root_build_dir) + ")" ] |
| 604 | if (defined(invoker.args)) { |
| 605 | executable_args += invoker.args |
| 606 | } |
| 607 | |
| 608 | data = [ |
| 609 | "//.vpython", |
| 610 | "//testing/test_env.py", |
| 611 | |
| 612 | # These aren't needed by *every* test, but they're likely needed often |
| 613 | # enough to just make it easier to declare them here. |
| 614 | "//testing/xvfb.py", |
| 615 | "//testing/scripts/common.py", |
| 616 | |
| 617 | invoker.script, |
| 618 | ] |
| 619 | if (defined(invoker.data)) { |
| 620 | data += invoker.data |
| 621 | } |
| 622 | data_deps = [] |
| 623 | if (defined(invoker.data_deps)) { |
| 624 | data_deps += invoker.data_deps |
| 625 | } |
| 626 | |
| 627 | forward_variables_from(invoker, |
| 628 | [ "*" ], |
Andrew Grieve | 1b290e4a2 | 2020-11-24 20:07:01 | [diff] [blame] | 629 | TESTONLY_AND_VISIBILITY + [ |
| 630 | "data", |
| 631 | "data_deps", |
| 632 | "script", |
| 633 | "script_args", |
| 634 | ]) |
| 635 | forward_variables_from(invoker, [ "visibility" ]) |
Dirk Pranke | 6188075b | 2020-10-01 19:31:28 | [diff] [blame] | 636 | |
| 637 | write_runtime_deps = "${root_build_dir}/${target_name}.runtime_deps" |
| 638 | } |
| 639 | } |
| 640 | |
brettw | edb6ecc | 2016-07-14 23:37:03 | [diff] [blame] | 641 | # Test defaults. |
| 642 | set_defaults("test") { |
| 643 | if (is_android) { |
| 644 | configs = default_shared_library_configs |
Yipeng Wang | 158dbc5c | 2017-06-30 18:16:41 | [diff] [blame] | 645 | configs -= [ "//build/config/android:hide_all_but_jni_onload" ] |
Thomas Anderson | 11c1d982 | 2019-01-15 06:32:59 | [diff] [blame] | 646 | configs += [ "//build/config/android:hide_all_but_jni" ] |
brettw | edb6ecc | 2016-07-14 23:37:03 | [diff] [blame] | 647 | } else { |
| 648 | configs = default_executable_configs |
| 649 | } |
| 650 | } |