| Index: build/config/android/internal_rules.gni
|
| diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni
|
| index af2db4423d4974f1be8489a58d932377f071c75f..8370cc45081c8a47fbef005bf77c8500ea378d92 100644
|
| --- a/build/config/android/internal_rules.gni
|
| +++ b/build/config/android/internal_rules.gni
|
| @@ -1377,3 +1377,57 @@ template("generate_split_manifest") {
|
| ]
|
| }
|
| }
|
| +
|
| +# Generates a script in the output bin directory which runs the test
|
| +# target using the test runner script in build/android/test_runner.py.
|
| +template("test_runner_script") {
|
| + testonly = true
|
| + _test_name = invoker.test_name
|
| + _test_type = invoker.test_type
|
| +
|
| + action(target_name) {
|
| + script = "//build/android/gyp/create_test_runner_script.py"
|
| + depfile = "$target_gen_dir/$target_name.d"
|
| +
|
| + test_runner_args = [
|
| + _test_type,
|
| + "--output-directory",
|
| + rebase_path(root_build_dir, root_build_dir),
|
| + ]
|
| + if (_test_type == "gtest") {
|
| + assert(defined(invoker.test_suite))
|
| + test_runner_args += [
|
| + "--suite",
|
| + invoker.test_suite,
|
| + ]
|
| + } else if (_test_type == "instrumentation") {
|
| + assert(defined(invoker.test_apk))
|
| + test_runner_args += [
|
| + "--test-apk",
|
| + invoker.test_apk,
|
| + ]
|
| + } else {
|
| + assert(false, "Invalid test type: $_test_type.")
|
| + }
|
| +
|
| + if (defined(invoker.isolate_file)) {
|
| + test_runner_args += [
|
| + "--isolate-file-path",
|
| + rebase_path(invoker.isolate_file, root_build_dir),
|
| + ]
|
| + }
|
| +
|
| + generated_script = "$root_build_dir/bin/run_${_test_name}"
|
| + outputs = [
|
| + depfile,
|
| + generated_script,
|
| + ]
|
| + args = [
|
| + "--depfile",
|
| + rebase_path(depfile, root_build_dir),
|
| + "--script-output-path",
|
| + rebase_path(generated_script, root_build_dir),
|
| + ]
|
| + args += test_runner_args
|
| + }
|
| +}
|
|
|