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

Side by Side Diff: testing/test.gni

Issue 1848033005: Revert of 🍬 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 | « sandbox/linux/BUILD.gn ('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().
13 template("test") { 11 template("test") {
14 if (is_android) { 12 if (is_android) {
15 import("//build/config/android/config.gni") 13 import("//build/config/android/config.gni")
16 import("//build/config/android/rules.gni") 14 import("//build/config/android/rules.gni")
17 15
18 _use_raw_android_executable = defined(invoker.use_raw_android_executable) && 16 _library_target = "_${target_name}__library"
19 invoker.use_raw_android_executable 17 _apk_target = "${target_name}_apk"
18
19 shared_library(_library_target) {
20 # Configs will always be defined since we set_defaults for a component
21 # in the main config. We want to use those rather than whatever came with
22 # the nested shared/static library inside the component.
23 configs = [] # Prevent list overwriting warning.
24 configs = invoker.configs
25
26 testonly = true
27
28 # Don't use "*" to forward all variables since some (like output_name
29 # and isolate_file) apply only to the APK below.
30 deps = []
31 forward_variables_from(invoker,
32 [
33 "all_dependent_configs",
34 "allow_circular_includes_from",
35 "cflags",
36 "cflags_c",
37 "cflags_cc",
38 "check_includes",
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
57 if (!defined(invoker.use_default_launcher) ||
58 invoker.use_default_launcher) {
59 deps += [ "//testing/android/native_test:native_test_native_code" ]
60 }
61 }
62
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 install_script_name = "install_${invoker.output_name}"
78 }
79 deps += [ ":$_library_target" ]
80 }
20 81
21 # output_name is used to allow targets with the same name but in different 82 # output_name is used to allow targets with the same name but in different
22 # packages to still produce unique runner scripts. 83 # packages to still produce unique runner scripts.
23 _output_name = invoker.target_name 84 _output_name = invoker.target_name
24 if (defined(invoker.output_name)) { 85 if (defined(invoker.output_name)) {
25 _output_name = invoker.output_name 86 _output_name = invoker.output_name
26 } 87 }
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 data_deps = []
36 forward_variables_from(invoker, "*")
37 testonly = true
38
39 # Don't output to the root or else conflict with the group() below.
40 output_name = rebase_path(_exec_output, root_out_dir)
41 if (is_component_build || is_asan) {
42 data_deps += [ "//build/android:cpplib_stripped" ]
43 }
44 }
45
46 # TODO(agrieve): This is required for component builds, but it's not
47 # currently used by test_runner.py (and so doesn't work in component
48 # builds).
49 create_native_executable_dist(_dist_target) {
50 testonly = true
51 dist_dir = "$target_out_dir/$target_name"
52 binary = _exec_output
53 deps = [
54 ":$_exec_target",
55 ]
56 }
57 } else {
58 _library_target = "_${target_name}__library"
59 _apk_target = "${target_name}_apk"
60 _apk_specific_vars = [
61 "android_manifest",
62 "enable_multidex",
63 "use_default_launcher",
64 "write_asset_list",
65 ]
66 shared_library(_library_target) {
67 # Configs will always be defined since we set_defaults for a component
68 # in the main config. We want to use those rather than whatever came
69 # with the nested shared/static library inside the component.
70 configs = [] # Prevent list overwriting warning.
71 configs = invoker.configs
72 testonly = true
73
74 deps = []
75 forward_variables_from(invoker,
76 "*",
77 _apk_specific_vars + [
78 "isolate_file",
79 "visibility",
80 ])
81
82 if (!defined(invoker.use_default_launcher) ||
83 invoker.use_default_launcher) {
84 deps += [ "//testing/android/native_test:native_test_native_code" ]
85 }
86 }
87 unittest_apk(_apk_target) {
88 forward_variables_from(invoker, _apk_specific_vars + [ "deps" ])
89 unittests_dep = ":$_library_target"
90 apk_name = invoker.target_name
91 if (defined(invoker.output_name)) {
92 apk_name = invoker.output_name
93 unittests_binary = "lib${apk_name}.so"
94 install_script_name = "install_${invoker.output_name}"
95 }
96 deps += [ ":$_library_target" ]
97 }
98
99 # Incremental test targets work only for .apks.
100 _incremental_test_runner_target =
101 "${_output_name}_incremental__test_runner_script"
102 test_runner_script(_incremental_test_runner_target) {
103 forward_variables_from(invoker, [ "isolate_file" ])
104 apk_target = ":$_apk_target"
105 test_name = "${_output_name}_incremental"
106 test_type = "gtest"
107 test_suite = _output_name
108 incremental_install = true
109 }
110 group("${target_name}_incremental") {
111 testonly = true
112 datadeps = [
113 ":$_incremental_test_runner_target",
114 ]
115 deps = [
116 ":${_apk_target}_incremental",
117 ]
118 }
119 }
120
121 _test_runner_target = "${_output_name}__test_runner_script" 88 _test_runner_target = "${_output_name}__test_runner_script"
122 test_runner_script(_test_runner_target) { 89 test_runner_script(_test_runner_target) {
123 forward_variables_from(invoker, [ "isolate_file" ]) 90 apk_target = ":$_apk_target"
124 if (_use_raw_android_executable) {
125 executable = _exec_output
126 } else {
127 apk_target = ":$_apk_target"
128 }
129 test_name = _output_name 91 test_name = _output_name
130 test_type = "gtest" 92 test_type = "gtest"
131 test_suite = _output_name 93 test_suite = _output_name
94 if (defined(invoker.isolate_file)) {
95 isolate_file = invoker.isolate_file
96 }
97 }
98 _incremental_test_runner_target =
99 "${_output_name}_incremental__test_runner_script"
100 test_runner_script(_incremental_test_runner_target) {
101 apk_target = ":$_apk_target"
102 test_name = "${_output_name}_incremental"
103 test_type = "gtest"
104 test_suite = _output_name
105 incremental_install = true
106 if (defined(invoker.isolate_file)) {
107 isolate_file = invoker.isolate_file
108 }
132 } 109 }
133 110
134 group(target_name) { 111 group(target_name) {
135 testonly = true 112 testonly = true
136 deps = [ 113 datadeps = [
137 ":$_test_runner_target", 114 ":$_test_runner_target",
138 ] 115 ]
139 if (_use_raw_android_executable) { 116 deps = [
140 deps += [ ":$_dist_target" ] 117 ":$_apk_target",
141 } else { 118 ]
142 deps += [ ":$_apk_target" ] 119 }
143 } 120 group("${target_name}_incremental") {
121 testonly = true
122 datadeps = [
123 ":$_incremental_test_runner_target",
124 ]
125 deps = [
126 ":${_apk_target}_incremental",
127 ]
144 } 128 }
145 129
146 # TODO(GYP): Delete this after we've converted everything to GN. 130 # TODO(GYP): Delete this after we've converted everything to GN.
147 # The _run targets exist only for compatibility w/ GYP. 131 # The _run targets exist only for compatibility w/ GYP.
148 group("${target_name}_apk_run") { 132 group("${target_name}_apk_run") {
149 testonly = true 133 testonly = true
150 deps = [ 134 deps = [
151 ":${invoker.target_name}", 135 ":${invoker.target_name}",
152 ] 136 ]
153 } 137 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 # TODO(GYP): Delete this after we've converted everything to GN. 199 # TODO(GYP): Delete this after we've converted everything to GN.
216 # The _run targets exist only for compatibility with GYP. 200 # The _run targets exist only for compatibility with GYP.
217 group("${target_name}_run") { 201 group("${target_name}_run") {
218 testonly = true 202 testonly = true
219 deps = [ 203 deps = [
220 ":${invoker.target_name}", 204 ":${invoker.target_name}",
221 ] 205 ]
222 } 206 }
223 } 207 }
224 } 208 }
OLDNEW
« no previous file with comments | « sandbox/linux/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698