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

Side by Side Diff: testing/test.gni

Issue 1841193002: 🍬 GN: Make breakpad_unittests & sandbox_linux_unittests use test() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@test-minor-renames
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 | « build/config/android/rules.gni ('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 # 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.
11 # Variable:
12 # use_raw_android_executable: Use executable() rather than android_apk().
11 template("test") { 13 template("test") {
12 if (is_android) { 14 if (is_android) {
13 import("//build/config/android/config.gni") 15 import("//build/config/android/config.gni")
14 import("//build/config/android/rules.gni") 16 import("//build/config/android/rules.gni")
15 17
16 _library_target = "_${target_name}__library" 18 _use_raw_android_executable = defined(invoker.use_raw_android_executable) &&
17 _apk_target = "${target_name}_apk" 19 invoker.use_raw_android_executable
20 if (_use_raw_android_executable) {
21 _exec_target = "${target_name}__exec"
22 _dist_target = "${target_name}__dist"
18 23
19 shared_library(_library_target) { 24 executable(_exec_target) {
20 # Configs will always be defined since we set_defaults for a component 25 data_deps = []
21 # in the main config. We want to use those rather than whatever came with 26 forward_variables_from(invoker, "*")
22 # the nested shared/static library inside the component. 27 testonly = true
23 configs = [] # Prevent list overwriting warning.
24 configs = invoker.configs
25 28
26 testonly = true 29 # Don't output to the root or else conflict with the group() below.
30 output_name = rebase_path(target_out_dir, root_out_dir) +
31 "/${invoker.target_name}"
32 if (is_component_build || is_asan) {
33 data_deps += [ "//build/android:cpplib_stripped" ]
34 }
35 }
27 36
28 # Don't use "*" to forward all variables since some (like output_name 37 create_native_executable_dist(_dist_target) {
29 # and isolate_file) apply only to the APK below. 38 testonly = true
30 deps = [] 39 dist_dir = "$target_out_dir/$target_name"
31 forward_variables_from(invoker, 40 binary = "$target_out_dir/${invoker.target_name}"
32 [ 41 deps = [
33 "all_dependent_configs", 42 ":$_exec_target",
34 "allow_circular_includes_from", 43 ]
35 "cflags", 44 }
36 "cflags_c", 45 } else {
37 "cflags_cc", 46 _library_target = "_${target_name}__library"
38 "check_includes", 47 _apk_target = "${target_name}_apk"
39 "data",
40 "data_deps",
41 "datadeps",
42 "defines",
43 "deps",
44 "include_dirs",
45 "ldflags",
46 "lib_dirs",
47 "libs",
48 "output_extension",
49 "output_name",
50 "public",
51 "public_configs",
52 "public_deps",
53 "sources",
54 "visibility",
55 ])
56 48
57 if (!defined(invoker.use_default_launcher) || 49 shared_library(_library_target) {
58 invoker.use_default_launcher) { 50 # Configs will always be defined since we set_defaults for a component
59 deps += [ "//testing/android/native_test:native_test_native_code" ] 51 # in the main config. We want to use those rather than whatever came wit h
52 # the nested shared/static library inside the component.
53 configs = [] # Prevent list overwriting warning.
54 configs = invoker.configs
55
56 testonly = true
57
58 # Don't use "*" to forward all variables since some (like output_name
59 # and isolate_file) apply only to the APK below.
60 deps = []
61 forward_variables_from(invoker,
62 [
63 "all_dependent_configs",
64 "allow_circular_includes_from",
65 "cflags",
66 "cflags_c",
67 "cflags_cc",
68 "check_includes",
69 "data",
70 "data_deps",
71 "datadeps",
72 "defines",
73 "deps",
74 "include_dirs",
75 "ldflags",
76 "lib_dirs",
77 "libs",
78 "output_extension",
79 "output_name",
80 "public",
81 "public_configs",
82 "public_deps",
83 "sources",
84 "visibility",
85 ])
86
87 if (!defined(invoker.use_default_launcher) ||
88 invoker.use_default_launcher) {
89 deps += [ "//testing/android/native_test:native_test_native_code" ]
90 }
91 }
92
93 unittest_apk(_apk_target) {
94 forward_variables_from(invoker,
95 [
96 "android_manifest",
97 "deps",
98 "enable_multidex",
99 "use_default_launcher",
100 "write_asset_list",
101 ])
102 unittests_dep = ":$_library_target"
103 apk_name = invoker.target_name
104 if (defined(invoker.output_name)) {
105 apk_name = invoker.output_name
106 unittests_binary = "lib${apk_name}.so"
107 install_script_name = invoker.output_name
108 }
109 deps += [ ":$_library_target" ]
60 } 110 }
61 } 111 }
62 112
63 unittest_apk(_apk_target) {
64 forward_variables_from(invoker,
65 [
66 "android_manifest",
67 "deps",
68 "enable_multidex",
69 "use_default_launcher",
70 "write_asset_list",
71 ])
72 unittests_dep = ":$_library_target"
73 apk_name = invoker.target_name
74 if (defined(invoker.output_name)) {
75 apk_name = invoker.output_name
76 unittests_binary = "lib${apk_name}.so"
77 }
78 deps += [ ":$_library_target" ]
79 }
80
81 # output_name is used to allow targets with the same name but in different 113 # output_name is used to allow targets with the same name but in different
82 # pacakges to still produce unique runner scripts. 114 # pacakges to still produce unique runner scripts.
Dirk Pranke 2016/03/29 20:57:13 nit: typo: s/pacakges/packages/.
agrieve 2016/03/30 14:17:25 Done.
83 _output_name = invoker.target_name 115 _output_name = invoker.target_name
84 if (defined(invoker.output_name)) { 116 if (defined(invoker.output_name)) {
85 _output_name = invoker.output_name 117 _output_name = invoker.output_name
86 } 118 }
87 _test_runner_target = "${_output_name}__test_runner_script" 119 _test_runner_target = "${_output_name}__test_runner_script"
88 test_runner_script(_test_runner_target) { 120 test_runner_script(_test_runner_target) {
89 apk_target = ":$_apk_target" 121 if (!_use_raw_android_executable) {
122 apk_target = ":$_apk_target"
123 }
90 test_name = _output_name 124 test_name = _output_name
91 test_type = "gtest" 125 test_type = "gtest"
92 test_suite = _output_name 126 test_suite = _output_name
93 if (defined(invoker.isolate_file)) { 127 if (defined(invoker.isolate_file)) {
94 isolate_file = invoker.isolate_file 128 isolate_file = invoker.isolate_file
95 } 129 }
96 }
97 _incremental_test_runner_target =
98 "${_output_name}_incremental__test_runner_script"
99 test_runner_script(_incremental_test_runner_target) {
100 apk_target = ":$_apk_target"
101 test_name = "${_output_name}_incremental"
102 test_type = "gtest"
103 test_suite = _output_name
104 incremental_install = true
105 if (defined(invoker.isolate_file)) {
106 isolate_file = invoker.isolate_file
107 }
108 } 130 }
109 131
110 group(target_name) { 132 group(target_name) {
111 testonly = true 133 testonly = true
112 datadeps = [ 134 deps = [
113 ":$_test_runner_target", 135 ":$_test_runner_target",
114 ] 136 ]
115 deps = [ 137 if (_use_raw_android_executable) {
116 ":$_apk_target", 138 deps += [ ":$_dist_target" ]
117 ] 139 } else {
140 deps += [ ":$_apk_target" ]
141 }
118 } 142 }
119 group("${target_name}_incremental") { 143
120 testonly = true 144 if (!_use_raw_android_executable) {
Dirk Pranke 2016/03/29 20:57:13 Can we combine this block w/ the else block on lin
agrieve 2016/03/30 14:17:25 Done.
121 datadeps = [ 145 _incremental_test_runner_target =
122 ":$_incremental_test_runner_target", 146 "${_output_name}_incremental__test_runner_script"
123 ] 147 test_runner_script(_incremental_test_runner_target) {
124 deps = [ 148 apk_target = ":$_apk_target"
125 ":${_apk_target}_incremental", 149 test_name = "${_output_name}_incremental"
126 ] 150 test_type = "gtest"
151 test_suite = _output_name
152 incremental_install = true
153 if (defined(invoker.isolate_file)) {
154 isolate_file = invoker.isolate_file
155 }
156 }
157 group("${target_name}_incremental") {
158 testonly = true
159 datadeps = [
160 ":$_incremental_test_runner_target",
161 ]
162 deps = [
163 ":${_apk_target}_incremental",
164 ]
165 }
127 } 166 }
128 167
129 # TODO(GYP): Delete this after we've converted everything to GN. 168 # TODO(GYP): Delete this after we've converted everything to GN.
130 # The _run targets exist only for compatibility w/ GYP. 169 # The _run targets exist only for compatibility w/ GYP.
131 group("${target_name}_apk_run") { 170 group("${target_name}_apk_run") {
132 testonly = true 171 testonly = true
133 deps = [ 172 deps = [
134 ":${invoker.target_name}", 173 ":${invoker.target_name}",
135 ] 174 ]
136 } 175 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 # TODO(GYP): Delete this after we've converted everything to GN. 237 # TODO(GYP): Delete this after we've converted everything to GN.
199 # The _run targets exist only for compatibility with GYP. 238 # The _run targets exist only for compatibility with GYP.
200 group("${target_name}_run") { 239 group("${target_name}_run") {
201 testonly = true 240 testonly = true
202 deps = [ 241 deps = [
203 ":${invoker.target_name}", 242 ":${invoker.target_name}",
204 ] 243 ]
205 } 244 }
206 } 245 }
207 } 246 }
OLDNEW
« no previous file with comments | « build/config/android/rules.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698