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

Unified Diff: build/config/android/internal_rules.gni

Issue 1120883002: [Android] Generate scripts at build time to run android tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed jbudorick's comments. Created 5 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 side-by-side diff with in-line comments
Download patch
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
+ 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
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698