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

Side by Side Diff: testing/test.gni

Issue 1874393002: 🏆 Allow Android test wrapper scripts to specify their timeouts in GN/GYP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.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
« net/net.gyp ('K') | « net/net.gyp ('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: 11 # Variable:
12 # use_raw_android_executable: Use executable() rather than android_apk(). 12 # use_raw_android_executable: Use executable() rather than android_apk().
13 template("test") { 13 template("test") {
14 if (is_android) { 14 if (is_android) {
15 import("//build/config/android/config.gni") 15 import("//build/config/android/config.gni")
16 import("//build/config/android/rules.gni") 16 import("//build/config/android/rules.gni")
17 17
18 _use_raw_android_executable = defined(invoker.use_raw_android_executable) && 18 _use_raw_android_executable = defined(invoker.use_raw_android_executable) &&
19 invoker.use_raw_android_executable 19 invoker.use_raw_android_executable
20 20
21 # output_name is used to allow targets with the same name but in different 21 # output_name is used to allow targets with the same name but in different
22 # packages to still produce unique runner scripts. 22 # packages to still produce unique runner scripts.
23 _output_name = invoker.target_name 23 _output_name = invoker.target_name
24 if (defined(invoker.output_name)) { 24 if (defined(invoker.output_name)) {
25 _output_name = invoker.output_name 25 _output_name = invoker.output_name
26 } 26 }
27 27
28 _wrapper_script_vars = [
29 "isolate_file",
30 "shard_timeout",
31 ]
32
28 if (_use_raw_android_executable) { 33 if (_use_raw_android_executable) {
29 _exec_target = "${target_name}__exec" 34 _exec_target = "${target_name}__exec"
30 _dist_target = "${target_name}__dist" 35 _dist_target = "${target_name}__dist"
31 _exec_output = 36 _exec_output =
32 "$target_out_dir/${invoker.target_name}/${invoker.target_name}" 37 "$target_out_dir/${invoker.target_name}/${invoker.target_name}"
33 38
34 executable(_exec_target) { 39 executable(_exec_target) {
35 # Configs will always be defined since we set_defaults in BUILDCONFIG.gn . 40 # Configs will always be defined since we set_defaults in BUILDCONFIG.gn .
36 configs = [] 41 configs = []
37 data_deps = [] 42 data_deps = []
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 "use_default_launcher", 78 "use_default_launcher",
74 "write_asset_list", 79 "write_asset_list",
75 ] 80 ]
76 shared_library(_library_target) { 81 shared_library(_library_target) {
77 # Configs will always be defined since we set_defaults in BUILDCONFIG.gn . 82 # Configs will always be defined since we set_defaults in BUILDCONFIG.gn .
78 configs = [] # Prevent list overwriting warning. 83 configs = [] # Prevent list overwriting warning.
79 configs = invoker.configs 84 configs = invoker.configs
80 testonly = true 85 testonly = true
81 86
82 deps = [] 87 deps = []
83 forward_variables_from(invoker, 88 forward_variables_from(
84 "*", 89 invoker,
85 _apk_specific_vars + [ 90 "*",
86 "isolate_file", 91 _apk_specific_vars + _wrapper_script_vars + [ "visibility" ])
87 "visibility",
88 ])
89 92
90 if (!defined(invoker.use_default_launcher) || 93 if (!defined(invoker.use_default_launcher) ||
91 invoker.use_default_launcher) { 94 invoker.use_default_launcher) {
92 deps += [ "//testing/android/native_test:native_test_native_code" ] 95 deps += [ "//testing/android/native_test:native_test_native_code" ]
93 } 96 }
94 } 97 }
95 unittest_apk(_apk_target) { 98 unittest_apk(_apk_target) {
96 forward_variables_from(invoker, _apk_specific_vars + [ "deps" ]) 99 forward_variables_from(invoker, _apk_specific_vars + [ "deps" ])
97 unittests_dep = ":$_library_target" 100 unittests_dep = ":$_library_target"
98 apk_name = invoker.target_name 101 apk_name = invoker.target_name
99 if (defined(invoker.output_name)) { 102 if (defined(invoker.output_name)) {
100 apk_name = invoker.output_name 103 apk_name = invoker.output_name
101 unittests_binary = "lib${apk_name}.so" 104 unittests_binary = "lib${apk_name}.so"
102 install_script_name = "install_${invoker.output_name}" 105 install_script_name = "install_${invoker.output_name}"
103 } 106 }
104 deps += [ ":$_library_target" ] 107 deps += [ ":$_library_target" ]
105 } 108 }
106 109
107 # Incremental test targets work only for .apks. 110 # Incremental test targets work only for .apks.
108 _incremental_test_runner_target = 111 _incremental_test_runner_target =
109 "${_output_name}_incremental__test_runner_script" 112 "${_output_name}_incremental__test_runner_script"
110 test_runner_script(_incremental_test_runner_target) { 113 test_runner_script(_incremental_test_runner_target) {
111 forward_variables_from(invoker, [ "isolate_file" ]) 114 forward_variables_from(invoker, _wrapper_script_vars)
112 apk_target = ":$_apk_target" 115 apk_target = ":$_apk_target"
113 test_name = "${_output_name}_incremental" 116 test_name = "${_output_name}_incremental"
114 test_type = "gtest" 117 test_type = "gtest"
115 test_suite = _output_name 118 test_suite = _output_name
116 incremental_install = true 119 incremental_install = true
117 } 120 }
118 group("${target_name}_incremental") { 121 group("${target_name}_incremental") {
119 testonly = true 122 testonly = true
120 datadeps = [ 123 datadeps = [
121 ":$_incremental_test_runner_target", 124 ":$_incremental_test_runner_target",
122 ] 125 ]
123 deps = [ 126 deps = [
124 ":${_apk_target}_incremental", 127 ":${_apk_target}_incremental",
125 ] 128 ]
126 } 129 }
127 } 130 }
128 131
129 _test_runner_target = "${_output_name}__test_runner_script" 132 _test_runner_target = "${_output_name}__test_runner_script"
130 test_runner_script(_test_runner_target) { 133 test_runner_script(_test_runner_target) {
131 forward_variables_from(invoker, [ "isolate_file" ]) 134 forward_variables_from(invoker, _wrapper_script_vars)
132 if (_use_raw_android_executable) { 135 if (_use_raw_android_executable) {
133 executable_dist_dir = "$root_out_dir/$_dist_target" 136 executable_dist_dir = "$root_out_dir/$_dist_target"
134 } else { 137 } else {
135 apk_target = ":$_apk_target" 138 apk_target = ":$_apk_target"
136 } 139 }
137 test_name = _output_name 140 test_name = _output_name
138 test_type = "gtest" 141 test_type = "gtest"
139 test_suite = _output_name 142 test_suite = _output_name
140 } 143 }
141 144
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 # TODO(GYP): Delete this after we've converted everything to GN. 226 # TODO(GYP): Delete this after we've converted everything to GN.
224 # The _run targets exist only for compatibility with GYP. 227 # The _run targets exist only for compatibility with GYP.
225 group("${target_name}_run") { 228 group("${target_name}_run") {
226 testonly = true 229 testonly = true
227 deps = [ 230 deps = [
228 ":${invoker.target_name}", 231 ":${invoker.target_name}",
229 ] 232 ]
230 } 233 }
231 } 234 }
232 } 235 }
OLDNEW
« net/net.gyp ('K') | « net/net.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698