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

Side by Side Diff: build/config/android/internal_rules.gni

Issue 1680233002: Android Add _incremental targets for instrumentation tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
OLDNEW
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 import("//build/config/sanitizers/sanitizers.gni") 6 import("//build/config/sanitizers/sanitizers.gni")
7 import("//build/config/zip.gni") 7 import("//build/config/zip.gni")
8 import("//third_party/ijar/ijar.gni") 8 import("//third_party/ijar/ijar.gni")
9 9
10 assert(is_android) 10 assert(is_android)
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 if (defined(invoker.proguard_enabled) && invoker.proguard_enabled) { 522 if (defined(invoker.proguard_enabled) && invoker.proguard_enabled) {
523 args += [ 523 args += [
524 "--proguard-enabled", 524 "--proguard-enabled",
525 "--proguard-info", 525 "--proguard-info",
526 rebase_path(invoker.proguard_info, root_build_dir), 526 rebase_path(invoker.proguard_info, root_build_dir),
527 ] 527 ]
528 } 528 }
529 529
530 if (defined(invoker.apk_path)) { 530 if (defined(invoker.apk_path)) {
531 _rebased_apk_path = rebase_path(invoker.apk_path, root_build_dir) 531 _rebased_apk_path = rebase_path(invoker.apk_path, root_build_dir)
532 _rebased_incremental_apk_path =
533 rebase_path(invoker.incremental_apk_path, root_build_dir)
534 _rebased_incremental_install_script_path =
535 rebase_path(invoker.incremental_install_script_path, root_build_dir)
532 args += [ "--apk-path=$_rebased_apk_path" ] 536 args += [ "--apk-path=$_rebased_apk_path" ]
537 args += [ "--incremental-apk-path=$_rebased_incremental_apk_path" ]
538 args += [ "--incremental-install-script-path=$_rebased_incremental_insta ll_script_path" ]
533 } 539 }
534 } 540 }
535 541
536 if (defined(invoker.srcjar)) { 542 if (defined(invoker.srcjar)) {
537 args += [ 543 args += [
538 "--srcjar", 544 "--srcjar",
539 rebase_path(invoker.srcjar, root_build_dir), 545 rebase_path(invoker.srcjar, root_build_dir),
540 ] 546 ]
541 } 547 }
542 } 548 }
(...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after
2020 ] 2026 ]
2021 } 2027 }
2022 } 2028 }
2023 2029
2024 # Generates a script in the output bin directory which runs the test 2030 # Generates a script in the output bin directory which runs the test
2025 # target using the test runner script in build/android/test_runner.py. 2031 # target using the test runner script in build/android/test_runner.py.
2026 template("test_runner_script") { 2032 template("test_runner_script") {
2027 testonly = true 2033 testonly = true
2028 _test_name = invoker.test_name 2034 _test_name = invoker.test_name
2029 _test_type = invoker.test_type 2035 _test_type = invoker.test_type
2036 _incremental_install =
2037 defined(invoker.incremental_install) && invoker.incremental_install
2030 2038
2031 action(target_name) { 2039 action(target_name) {
2032 script = "//build/android/gyp/create_test_runner_script.py" 2040 script = "//build/android/gyp/create_test_runner_script.py"
2033 depfile = "$target_gen_dir/$target_name.d" 2041 depfile = "$target_gen_dir/$target_name.d"
2042 deps = []
2034 2043
2035 datadeps = [ 2044 datadeps = [
2036 "//build/android:test_runner_py", 2045 "//build/android:test_runner_py",
2037 ] 2046 ]
2038 2047
2048 # apk_target is not used for native executable tests
2049 # (e.g. breakpad_unittests).
2050 if (defined(invoker.apk_target)) {
2051 _apk_build_config =
2052 get_label_info(invoker.apk_target, "target_gen_dir") + "/" +
2053 get_label_info(invoker.apk_target, "name") + ".build_config"
2054 _rebased_apk_build_config = rebase_path(_apk_build_config, root_build_dir)
2055 assert(_rebased_apk_build_config != "") # Mark as used.
2056 }
2057
2039 test_runner_args = [ 2058 test_runner_args = [
2040 _test_type, 2059 _test_type,
2041 "--output-directory", 2060 "--output-directory",
2042 rebase_path(root_build_dir, root_build_dir), 2061 rebase_path(root_build_dir, root_build_dir),
2043 ] 2062 ]
2044 if (_test_type == "gtest") { 2063 if (_test_type == "gtest") {
2045 assert(defined(invoker.test_suite)) 2064 assert(defined(invoker.test_suite))
2046 test_runner_args += [ 2065 test_runner_args += [
2047 "--suite", 2066 "--suite",
2048 invoker.test_suite, 2067 invoker.test_suite,
2049 ] 2068 ]
2050 } else if (_test_type == "instrumentation") { 2069 } else if (_test_type == "instrumentation") {
2051 deps = [ 2070 deps += [
2052 "${invoker.apk_target}__build_config", 2071 "${invoker.apk_target}__build_config",
2072 "${invoker.apk_under_test}__build_config",
2053 ] 2073 ]
2054 _build_config = 2074 _apk_under_test_build_config =
2055 get_label_info(invoker.apk_target, "target_gen_dir") + "/" + 2075 get_label_info(invoker.apk_under_test, "target_gen_dir") + "/" +
2056 get_label_info(invoker.apk_target, "name") + ".build_config" 2076 get_label_info(invoker.apk_under_test, "name") + ".build_config"
2057 _rebased_build_config = rebase_path(_build_config, root_build_dir) 2077 _rebased_apk_under_test_build_config =
2078 rebase_path(_apk_under_test_build_config, root_build_dir)
2079 _test_apk = "@FileArg($_rebased_apk_build_config:deps_info:apk_path)"
2080 _apk_under_test =
2081 "@FileArg($_rebased_apk_under_test_build_config:deps_info:apk_path)"
2082 if (_incremental_install) {
2083 _test_apk = "@FileArg($_rebased_apk_build_config:deps_info:incremental_a pk_path)"
2084 _apk_under_test = "@FileArg($_rebased_apk_under_test_build_config:deps_i nfo:incremental_apk_path)"
2085 }
2058 test_runner_args += [ 2086 test_runner_args += [
2059 "--test-apk", 2087 "--test-apk=$_test_apk",
2060 "@FileArg($_rebased_build_config:deps_info:apk_path)", 2088 "--apk-under-test=$_apk_under_test",
2061 "--apk-under-test",
2062 "@FileArg($_rebased_build_config:deps_info:tested_apk_path)",
2063 ] 2089 ]
2090 if (_incremental_install) {
2091 test_runner_args += [
2092 "--apk-under-test-install-script",
2093 "@FileArg($_rebased_apk_under_test_build_config:deps_info:incremental_ install_script_path)",
2094 ]
2095 }
2064 if (emma_coverage) { 2096 if (emma_coverage) {
2065 # Set a default coverage output directory (can be overridden by user 2097 # Set a default coverage output directory (can be overridden by user
2066 # passing the same flag). 2098 # passing the same flag).
2067 test_runner_args += [ 2099 test_runner_args += [
2068 "--coverage-dir", 2100 "--coverage-dir",
2069 rebase_path("$root_out_dir/coverage", root_build_dir), 2101 rebase_path("$root_out_dir/coverage", root_build_dir),
2070 ] 2102 ]
2071 } 2103 }
2072 } else { 2104 } else {
2073 assert(false, "Invalid test type: $_test_type.") 2105 assert(false, "Invalid test type: $_test_type.")
(...skipping 10 matching lines...) Expand all
2084 "@FileArg($_rebased_build_config:deps_info:apk_path)", 2116 "@FileArg($_rebased_build_config:deps_info:apk_path)",
2085 ] 2117 ]
2086 } 2118 }
2087 } 2119 }
2088 if (defined(invoker.isolate_file)) { 2120 if (defined(invoker.isolate_file)) {
2089 test_runner_args += [ 2121 test_runner_args += [
2090 "--isolate-file-path", 2122 "--isolate-file-path",
2091 rebase_path(invoker.isolate_file, root_build_dir), 2123 rebase_path(invoker.isolate_file, root_build_dir),
2092 ] 2124 ]
2093 } 2125 }
2094 if (defined(invoker.incremental_install) && invoker.incremental_install) { 2126 if (_incremental_install) {
2095 test_runner_args += [ 2127 test_runner_args += [
2096 "--incremental-install", 2128 "--test-apk-install-script",
2129 "@FileArg($_rebased_apk_build_config:deps_info:incremental_install_scrip t_path)",
2097 "--fast-local-dev", 2130 "--fast-local-dev",
2098 ] 2131 ]
2099 } 2132 }
2100 if (is_asan) { 2133 if (is_asan) {
2101 test_runner_args += [ "--tool=asan" ] 2134 test_runner_args += [ "--tool=asan" ]
2102 } 2135 }
2103 2136
2104 generated_script = "$root_build_dir/bin/run_${_test_name}" 2137 generated_script = "$root_build_dir/bin/run_${_test_name}"
2105 outputs = [ 2138 outputs = [
2106 depfile, 2139 depfile,
2107 generated_script, 2140 generated_script,
2108 ] 2141 ]
2109 args = [ 2142 args = [
2110 "--depfile", 2143 "--depfile",
2111 rebase_path(depfile, root_build_dir), 2144 rebase_path(depfile, root_build_dir),
2112 "--script-output-path", 2145 "--script-output-path",
2113 rebase_path(generated_script, root_build_dir), 2146 rebase_path(generated_script, root_build_dir),
2114 ] 2147 ]
2115 args += test_runner_args 2148 args += test_runner_args
2116 } 2149 }
2117 } 2150 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698