Chromium Code Reviews| Index: build/config/android/internal_rules.gni |
| diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni |
| index a5a12352a2d1f7c8716cc3d5617919513f82ea8c..1f2d7236be8675c99825c18b3f0c389807ed73bd 100644 |
| --- a/build/config/android/internal_rules.gni |
| +++ b/build/config/android/internal_rules.gni |
| @@ -1255,3 +1255,58 @@ 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_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_name = invoker.test_suite |
| + test_runner_args += [ |
| + "--suite", |
| + invoker.test_suite, |
| + ] |
| + } else if (_test_type == "instrumentation") { |
| + assert(defined(invoker.test_apk)) |
| + test_name = invoker.test_apk |
|
cjhopman
2015/05/20 03:09:27
I feel like this should be based on the target nam
mikecase (-- gone --)
2015/05/20 21:22:03
Done.
|
| + 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 |
| + } |
| +} |