OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import("//build/config/android/config.gni") | 5 import("//build/config/android/config.gni") |
6 | 6 |
7 assert(is_android) | 7 assert(is_android) |
8 | 8 |
9 rebased_android_sdk = rebase_path(android_sdk, root_build_dir) | 9 rebased_android_sdk = rebase_path(android_sdk, root_build_dir) |
10 rebased_android_sdk_root = rebase_path(android_sdk_root, root_build_dir) | 10 rebased_android_sdk_root = rebase_path(android_sdk_root, root_build_dir) |
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 ] | 1170 ] |
1171 output = invoker.dex_path | 1171 output = invoker.dex_path |
1172 dex_arg_key = "${rebased_build_config}:final_dex:dependency_dex_files" | 1172 dex_arg_key = "${rebased_build_config}:final_dex:dependency_dex_files" |
1173 args = [ "--inputs=@FileArg($dex_arg_key)" ] | 1173 args = [ "--inputs=@FileArg($dex_arg_key)" ] |
1174 if (defined(invoker.excluded_jars)) { | 1174 if (defined(invoker.excluded_jars)) { |
1175 excluded_jars = rebase_path(invoker.excluded_jars, root_build_dir) | 1175 excluded_jars = rebase_path(invoker.excluded_jars, root_build_dir) |
1176 args += [ "--excluded-paths=${excluded_jars}" ] | 1176 args += [ "--excluded-paths=${excluded_jars}" ] |
1177 } | 1177 } |
1178 } | 1178 } |
1179 } | 1179 } |
| 1180 |
| 1181 # Generates a script in the output bin directory which runs the test |
| 1182 # target using the test runner script in build/android/test_runner.py. |
| 1183 template("test_runner_script") { |
| 1184 testonly = true |
| 1185 _test_type = invoker.test_type |
| 1186 |
| 1187 action(target_name) { |
| 1188 script = "//build/android/gyp/create_test_runner_script.py" |
| 1189 depfile = "$target_gen_dir/$target_name.d" |
| 1190 |
| 1191 test_runner_args = [ |
| 1192 _test_type, |
| 1193 "--output-directory", |
| 1194 rebase_path(root_build_dir, root_build_dir), |
| 1195 ] |
| 1196 if (_test_type == "gtest") { |
| 1197 assert(defined(invoker.test_suite)) |
| 1198 test_name = invoker.test_suite |
| 1199 test_runner_args += [ |
| 1200 "--suite", |
| 1201 invoker.test_suite, |
| 1202 ] |
| 1203 } else if (_test_type == "instrumentation") { |
| 1204 assert(defined(invoker.test_apk)) |
| 1205 test_name = invoker.test_apk |
| 1206 test_runner_args += [ |
| 1207 "--test-apk", |
| 1208 invoker.test_apk, |
| 1209 ] |
| 1210 } else { |
| 1211 assert(false, "Invalid test type: $_test_type.") |
| 1212 } |
| 1213 |
| 1214 if (defined(invoker.isolate_file)) { |
| 1215 test_runner_args += [ |
| 1216 "--isolate-file-path", |
| 1217 rebase_path(invoker.isolate_file, root_build_dir), |
| 1218 ] |
| 1219 } |
| 1220 |
| 1221 generated_script = "$root_build_dir/bin/run_${test_name}" |
| 1222 outputs = [ |
| 1223 depfile, |
| 1224 generated_script, |
| 1225 ] |
| 1226 args = [ |
| 1227 "--depfile", |
| 1228 rebase_path(depfile, root_build_dir), |
| 1229 "--script-output-path", |
| 1230 rebase_path(generated_script, root_build_dir), |
| 1231 ] |
| 1232 args += test_runner_args |
| 1233 } |
| 1234 } |
OLD | NEW |