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

Side by Side Diff: testing/test.gni

Issue 1904563002: Standalone GN build. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.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/multiprocess_func_list.cc ('k') | third_party/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 # ==============================================================================
6 # TEST SETUP
7 # ==============================================================================
8
9 # Define a test as an executable (or apk on Android) with the "testonly" flag
10 # set.
11 # Variable:
12 # use_raw_android_executable: Use executable() rather than android_apk().
13 template("test") {
14 if (is_android) {
15 import("//build/config/android/config.gni")
16 import("//build/config/android/rules.gni")
17
18 _use_raw_android_executable = defined(invoker.use_raw_android_executable) &&
19 invoker.use_raw_android_executable
20
21 # output_name is used to allow targets with the same name but in different
22 # packages to still produce unique runner scripts.
23 _output_name = invoker.target_name
24 if (defined(invoker.output_name)) {
25 _output_name = invoker.output_name
26 }
27
28 if (_use_raw_android_executable) {
29 _exec_target = "${target_name}__exec"
30 _dist_target = "${target_name}__dist"
31 _exec_output =
32 "$target_out_dir/${invoker.target_name}/${invoker.target_name}"
33
34 executable(_exec_target) {
35 # Configs will always be defined since we set_defaults in BUILDCONFIG.gn .
36 configs = []
37 data_deps = []
38 forward_variables_from(invoker, "*", [ "extra_dist_files" ])
39 testonly = true
40
41 # Thanks to the set_defaults() for test(), configs are initialized with
42 # the default shared_library configs rather than executable configs.
43 configs -= [
44 "//build/config:shared_library_config",
45 "//build/config/android:hide_native_jni_exports",
46 ]
47 configs += [ "//build/config:executable_config" ]
48
49 # Don't output to the root or else conflict with the group() below.
50 output_name = rebase_path(_exec_output, root_out_dir)
51 if (is_component_build || is_asan) {
52 data_deps += [ "//build/android:cpplib_stripped" ]
53 }
54 }
55
56 create_native_executable_dist(_dist_target) {
57 testonly = true
58 dist_dir = "$root_out_dir/$target_name"
59 binary = _exec_output
60 deps = [
61 ":$_exec_target",
62 ]
63 if (defined(invoker.extra_dist_files)) {
64 extra_files = invoker.extra_dist_files
65 }
66 }
67 } else {
68 _library_target = "_${target_name}__library"
69 _apk_target = "${target_name}_apk"
70 _apk_specific_vars = [
71 "android_manifest",
72 "enable_multidex",
73 "use_default_launcher",
74 "write_asset_list",
75 ]
76 shared_library(_library_target) {
77 # Configs will always be defined since we set_defaults in BUILDCONFIG.gn .
78 configs = [] # Prevent list overwriting warning.
79 configs = invoker.configs
80 testonly = true
81
82 deps = []
83 forward_variables_from(invoker,
84 "*",
85 _apk_specific_vars + [
86 "isolate_file",
87 "visibility",
88 ])
89
90 if (!defined(invoker.use_default_launcher) ||
91 invoker.use_default_launcher) {
92 deps += [ "//testing/android/native_test:native_test_native_code" ]
93 }
94 }
95 unittest_apk(_apk_target) {
96 forward_variables_from(invoker, _apk_specific_vars + [ "deps" ])
97 unittests_dep = ":$_library_target"
98 apk_name = invoker.target_name
99 if (defined(invoker.output_name)) {
100 apk_name = invoker.output_name
101 unittests_binary = "lib${apk_name}.so"
102 install_script_name = "install_${invoker.output_name}"
103 }
104 deps += [ ":$_library_target" ]
105 }
106
107 # Incremental test targets work only for .apks.
108 _incremental_test_runner_target =
109 "${_output_name}_incremental__test_runner_script"
110 test_runner_script(_incremental_test_runner_target) {
111 forward_variables_from(invoker, [ "isolate_file" ])
112 apk_target = ":$_apk_target"
113 test_name = "${_output_name}_incremental"
114 test_type = "gtest"
115 test_suite = _output_name
116 incremental_install = true
117 }
118 group("${target_name}_incremental") {
119 testonly = true
120 datadeps = [
121 ":$_incremental_test_runner_target",
122 ]
123 deps = [
124 ":${_apk_target}_incremental",
125 ]
126 }
127 }
128
129 _test_runner_target = "${_output_name}__test_runner_script"
130 test_runner_script(_test_runner_target) {
131 forward_variables_from(invoker, [ "isolate_file" ])
132 if (_use_raw_android_executable) {
133 executable_dist_dir = "$root_out_dir/$_dist_target"
134 } else {
135 apk_target = ":$_apk_target"
136 }
137 test_name = _output_name
138 test_type = "gtest"
139 test_suite = _output_name
140 }
141
142 group(target_name) {
143 testonly = true
144 deps = [
145 ":$_test_runner_target",
146 ]
147 if (_use_raw_android_executable) {
148 deps += [ ":$_dist_target" ]
149 } else {
150 deps += [ ":$_apk_target" ]
151 }
152 }
153
154 # TODO(GYP): Delete this after we've converted everything to GN.
155 # The _run targets exist only for compatibility w/ GYP.
156 group("${target_name}_apk_run") {
157 testonly = true
158 deps = [
159 ":${invoker.target_name}",
160 ]
161 }
162 } else if (is_ios) {
163 import("//build/config/ios/rules.gni")
164
165 _test_target = target_name
166 _resources_bundle_data = target_name + "_resources_bundle_data"
167
168 bundle_data(_resources_bundle_data) {
169 visibility = [
170 ":${_test_target}",
171 ":${_test_target}_generate_executable",
172 ]
173 sources = [
174 "//testing/gtest_ios/Default.png",
175 ]
176 outputs = [
177 "{{bundle_resources_dir}}/{{source_file_part}}",
178 ]
179 }
180
181 app(_test_target) {
182 # TODO(GYP): Make this configurable and only provide a default
183 # that can be overridden.
184 info_plist = "//testing/gtest_ios/unittest-Info.plist"
185 app_name = target_name
186 entitlements_path = "//testing/gtest_ios"
187 code_signing_identity = ""
188 testonly = true
189 extra_substitutions = [ "BUNDLE_ID_TEST_NAME=$app_name" ]
190
191 # See above call.
192 set_sources_assignment_filter([])
193
194 forward_variables_from(invoker, "*")
195
196 if (!defined(deps)) {
197 deps = []
198 }
199 deps += [
200 ":$_resources_bundle_data",
201
202 # All shared libraries must have the sanitizer deps to properly link in
203 # asan mode (this target will be empty in other cases).
204 "//build/config/sanitizers:deps",
205 ]
206 }
207 } else {
208 executable(target_name) {
209 deps = []
210 forward_variables_from(invoker, "*")
211
212 testonly = true
213 deps += [
214 # All shared libraries must have the sanitizer deps to properly link in
215 # asan mode (this target will be empty in other cases).
216 "//build/config/sanitizers:deps",
217
218 # Give tests the default manifest on Windows (a no-op elsewhere).
219 "//build/win:default_exe_manifest",
220 ]
221 }
222
223 # TODO(GYP): Delete this after we've converted everything to GN.
224 # The _run targets exist only for compatibility with GYP.
225 group("${target_name}_run") {
226 testonly = true
227 deps = [
228 ":${invoker.target_name}",
229 ]
230 }
231 }
232 }
OLDNEW
« no previous file with comments | « testing/multiprocess_func_list.cc ('k') | third_party/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698