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

Side by Side Diff: testing/test.gni

Issue 1968773002: [Merge to 51] Make the Android test apks depend on their run_ scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 7 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/internal_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: 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 _test_runner_target = "${_output_name}__test_runner_script"
29
28 if (_use_raw_android_executable) { 30 if (_use_raw_android_executable) {
29 _exec_target = "${target_name}__exec" 31 _exec_target = "${target_name}__exec"
30 _dist_target = "${target_name}__dist" 32 _dist_target = "${target_name}__dist"
31 _exec_output = 33 _exec_output =
32 "$target_out_dir/${invoker.target_name}/${invoker.target_name}" 34 "$target_out_dir/${invoker.target_name}/${invoker.target_name}"
33 35
34 executable(_exec_target) { 36 executable(_exec_target) {
35 # Configs will always be defined since we set_defaults in BUILDCONFIG.gn . 37 # Configs will always be defined since we set_defaults in BUILDCONFIG.gn .
36 configs = [] 38 configs = []
37 data_deps = [] 39 data_deps = []
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 unittest_apk(_apk_target) { 97 unittest_apk(_apk_target) {
96 forward_variables_from(invoker, _apk_specific_vars + [ "deps" ]) 98 forward_variables_from(invoker, _apk_specific_vars + [ "deps" ])
97 unittests_dep = ":$_library_target" 99 unittests_dep = ":$_library_target"
98 apk_name = invoker.target_name 100 apk_name = invoker.target_name
99 if (defined(invoker.output_name)) { 101 if (defined(invoker.output_name)) {
100 apk_name = invoker.output_name 102 apk_name = invoker.output_name
101 unittests_binary = "lib${apk_name}.so" 103 unittests_binary = "lib${apk_name}.so"
102 install_script_name = "install_${invoker.output_name}" 104 install_script_name = "install_${invoker.output_name}"
103 } 105 }
104 deps += [ ":$_library_target" ] 106 deps += [ ":$_library_target" ]
107
108 # TODO(agrieve): Remove this data_dep once bots don't build the _apk
109 # target (post-GYP).
110 # It's a bit backwards for the apk to depend on the runner script, since
111 # the apk is conceptually a runtime_dep of the script. However, it is
112 # currently necessary because the bots build this _apk target directly
113 # rather than the group() below.
114 data_deps = [
115 ":$_test_runner_target",
116 ]
105 } 117 }
106 118
107 # Incremental test targets work only for .apks. 119 # Incremental test targets work only for .apks.
108 _incremental_test_runner_target = 120 _incremental_test_runner_target =
109 "${_output_name}_incremental__test_runner_script" 121 "${_output_name}_incremental__test_runner_script"
110 test_runner_script(_incremental_test_runner_target) { 122 test_runner_script(_incremental_test_runner_target) {
111 forward_variables_from(invoker, [ "isolate_file" ]) 123 forward_variables_from(invoker, [ "isolate_file" ])
112 apk_target = ":$_apk_target" 124 apk_target = ":$_apk_target"
113 test_name = "${_output_name}_incremental" 125 test_name = "${_output_name}_incremental"
114 test_type = "gtest" 126 test_type = "gtest"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 # TODO(GYP): Delete this after we've converted everything to GN. 235 # TODO(GYP): Delete this after we've converted everything to GN.
224 # The _run targets exist only for compatibility with GYP. 236 # The _run targets exist only for compatibility with GYP.
225 group("${target_name}_run") { 237 group("${target_name}_run") {
226 testonly = true 238 testonly = true
227 deps = [ 239 deps = [
228 ":${invoker.target_name}", 240 ":${invoker.target_name}",
229 ] 241 ]
230 } 242 }
231 } 243 }
232 } 244 }
OLDNEW
« no previous file with comments | « build/config/android/internal_rules.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698