OLD | NEW |
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 template("_gen_isolate") { | |
10 testonly = true | |
11 _runtime_deps_file = "$target_gen_dir/$target_name.runtime_deps" | |
12 group("${target_name}__write_deps") { | |
13 forward_variables_from(invoker, | |
14 [ | |
15 "data", | |
16 "data_deps", | |
17 "deps", | |
18 "public_deps", | |
19 ]) | |
20 write_runtime_deps = _runtime_deps_file | |
21 } | |
22 | |
23 action(target_name) { | |
24 script = "//testing/generate_isolate.py" | |
25 inputs = [ | |
26 _runtime_deps_file, | |
27 ] | |
28 outputs = [ | |
29 invoker.output, | |
30 ] | |
31 args = [ | |
32 "--output-directory=.", | |
33 "--out-file", | |
34 rebase_path(invoker.output, root_build_dir), | |
35 "--runtime-deps-file", | |
36 rebase_path(_runtime_deps_file, root_build_dir), | |
37 ] | |
38 if (is_android) { | |
39 args += [ "--apply-android-filters" ] | |
40 } | |
41 if (defined(invoker.apply_device_filters) && invoker.apply_device_filters) { | |
42 args += [ "--apply-device-filters" ] | |
43 } | |
44 _assert_no_odd_data = | |
45 defined(invoker.assert_no_odd_data) && invoker.assert_no_odd_data | |
46 if (_assert_no_odd_data) { | |
47 args += [ "--assert-no-odd-data" ] | |
48 } | |
49 if (defined(invoker.command)) { | |
50 _isolate_dir = get_path_info(invoker.output, "dir") | |
51 args += [ | |
52 "--command", | |
53 rebase_path(invoker.command, _isolate_dir), | |
54 ] | |
55 } | |
56 deps = [ | |
57 ":${invoker.target_name}__write_deps", | |
58 ] | |
59 } | |
60 } | |
61 | |
62 # 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 |
63 # set. | 10 # set. |
64 # Variable: | 11 # Variable: |
65 # use_raw_android_executable: Use executable() rather than android_apk(). | 12 # use_raw_android_executable: Use executable() rather than android_apk(). |
66 # use_native_activity: Test implements ANativeActivity_onCreate(). | 13 # use_native_activity: Test implements ANativeActivity_onCreate(). |
67 template("test") { | 14 template("test") { |
68 if (is_android) { | 15 if (is_android) { |
69 import("//build/config/android/config.gni") | 16 import("//build/config/android/config.gni") |
70 import("//build/config/android/rules.gni") | 17 import("//build/config/android/rules.gni") |
71 import("//build/config/sanitizers/sanitizers.gni") | 18 import("//build/config/sanitizers/sanitizers.gni") |
(...skipping 19 matching lines...) Expand all Loading... |
91 | 38 |
92 if (_generate_device_isolate) { | 39 if (_generate_device_isolate) { |
93 _allow_odd_runtime_deps = defined(invoker.allow_odd_runtime_deps) && | 40 _allow_odd_runtime_deps = defined(invoker.allow_odd_runtime_deps) && |
94 invoker.allow_odd_runtime_deps | 41 invoker.allow_odd_runtime_deps |
95 | 42 |
96 # The device isolate is needed at runtime, so it cannot go in | 43 # The device isolate is needed at runtime, so it cannot go in |
97 # target_gen_dir, as builder/tester configurations do not include it. | 44 # target_gen_dir, as builder/tester configurations do not include it. |
98 _target_dir_name = get_label_info(":$target_name", "dir") | 45 _target_dir_name = get_label_info(":$target_name", "dir") |
99 _device_isolate_path = "$root_out_dir/gen.runtime/$_target_dir_name/$targe
t_name.device.isolate" | 46 _device_isolate_path = "$root_out_dir/gen.runtime/$_target_dir_name/$targe
t_name.device.isolate" |
100 _gen_isolate_target_name = "${target_name}__isolate" | 47 _gen_isolate_target_name = "${target_name}__isolate" |
101 _gen_isolate(_gen_isolate_target_name) { | 48 device_isolate(_gen_isolate_target_name) { |
102 forward_variables_from(invoker, | 49 forward_variables_from(invoker, |
103 [ | 50 [ |
104 "data", | 51 "data", |
105 "data_deps", | 52 "data_deps", |
106 "deps", | 53 "deps", |
107 "public_deps", | 54 "public_deps", |
108 ]) | 55 ]) |
109 assert_no_odd_data = !_allow_odd_runtime_deps | 56 assert_no_odd_data = !_allow_odd_runtime_deps |
110 output = _device_isolate_path | 57 output = _device_isolate_path |
111 apply_device_filters = true | |
112 } | 58 } |
113 } | 59 } |
114 | 60 |
115 assert(_use_raw_android_executable || enable_java_templates) | 61 assert(_use_raw_android_executable || enable_java_templates) |
116 | 62 |
117 if (_use_raw_android_executable) { | 63 if (_use_raw_android_executable) { |
118 _exec_target = "${target_name}__exec" | 64 _exec_target = "${target_name}__exec" |
119 _dist_target = "${target_name}__dist" | 65 _dist_target = "${target_name}__dist" |
120 _exec_output = | 66 _exec_output = |
121 "$target_out_dir/${invoker.target_name}/${invoker.target_name}" | 67 "$target_out_dir/${invoker.target_name}/${invoker.target_name}" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 } | 312 } |
367 | 313 |
368 # Test defaults. | 314 # Test defaults. |
369 set_defaults("test") { | 315 set_defaults("test") { |
370 if (is_android) { | 316 if (is_android) { |
371 configs = default_shared_library_configs | 317 configs = default_shared_library_configs |
372 } else { | 318 } else { |
373 configs = default_executable_configs | 319 configs = default_executable_configs |
374 } | 320 } |
375 } | 321 } |
OLD | NEW |