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 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 Loading... |
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 Loading... |
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 deps += [ "${invoker.apk_target}__build_config" ] |
| 2052 _apk_build_config = |
| 2053 get_label_info(invoker.apk_target, "target_gen_dir") + "/" + |
| 2054 get_label_info(invoker.apk_target, "name") + ".build_config" |
| 2055 _rebased_apk_build_config = rebase_path(_apk_build_config, root_build_dir) |
| 2056 assert(_rebased_apk_build_config != "") # Mark as used. |
| 2057 } |
| 2058 |
2039 test_runner_args = [ | 2059 test_runner_args = [ |
2040 _test_type, | 2060 _test_type, |
2041 "--output-directory", | 2061 "--output-directory", |
2042 rebase_path(root_build_dir, root_build_dir), | 2062 rebase_path(root_build_dir, root_build_dir), |
2043 ] | 2063 ] |
2044 if (_test_type == "gtest") { | 2064 if (_test_type == "gtest") { |
2045 assert(defined(invoker.test_suite)) | 2065 assert(defined(invoker.test_suite)) |
2046 test_runner_args += [ | 2066 test_runner_args += [ |
2047 "--suite", | 2067 "--suite", |
2048 invoker.test_suite, | 2068 invoker.test_suite, |
2049 ] | 2069 ] |
2050 } else if (_test_type == "instrumentation") { | 2070 } else if (_test_type == "instrumentation") { |
2051 deps = [ | 2071 _test_apk = "@FileArg($_rebased_apk_build_config:deps_info:apk_path)" |
2052 "${invoker.apk_target}__build_config", | 2072 if (_incremental_install) { |
2053 ] | 2073 _test_apk = "@FileArg($_rebased_apk_build_config:deps_info:incremental_a
pk_path)" |
2054 _build_config = | 2074 } |
2055 get_label_info(invoker.apk_target, "target_gen_dir") + "/" + | 2075 test_runner_args += [ "--test-apk=$_test_apk" ] |
2056 get_label_info(invoker.apk_target, "name") + ".build_config" | 2076 if (defined(invoker.apk_under_test)) { |
2057 _rebased_build_config = rebase_path(_build_config, root_build_dir) | 2077 deps += [ "${invoker.apk_under_test}__build_config" ] |
2058 test_runner_args += [ | 2078 _apk_under_test_build_config = |
2059 "--test-apk", | 2079 get_label_info(invoker.apk_under_test, "target_gen_dir") + "/" + |
2060 "@FileArg($_rebased_build_config:deps_info:apk_path)", | 2080 get_label_info(invoker.apk_under_test, "name") + ".build_config" |
2061 "--apk-under-test", | 2081 _rebased_apk_under_test_build_config = |
2062 "@FileArg($_rebased_build_config:deps_info:tested_apk_path)", | 2082 rebase_path(_apk_under_test_build_config, root_build_dir) |
2063 ] | 2083 _apk_under_test = |
| 2084 "@FileArg($_rebased_apk_under_test_build_config:deps_info:apk_path)" |
| 2085 if (_incremental_install) { |
| 2086 _apk_under_test = "@FileArg($_rebased_apk_under_test_build_config:deps
_info:incremental_apk_path)" |
| 2087 } |
| 2088 test_runner_args += [ "--apk-under-test=$_apk_under_test" ] |
| 2089 } |
2064 if (emma_coverage) { | 2090 if (emma_coverage) { |
2065 # Set a default coverage output directory (can be overridden by user | 2091 # Set a default coverage output directory (can be overridden by user |
2066 # passing the same flag). | 2092 # passing the same flag). |
2067 test_runner_args += [ | 2093 test_runner_args += [ |
2068 "--coverage-dir", | 2094 "--coverage-dir", |
2069 rebase_path("$root_out_dir/coverage", root_build_dir), | 2095 rebase_path("$root_out_dir/coverage", root_build_dir), |
2070 ] | 2096 ] |
2071 } | 2097 } |
2072 } else { | 2098 } else { |
2073 assert(false, "Invalid test type: $_test_type.") | 2099 assert(false, "Invalid test type: $_test_type.") |
(...skipping 10 matching lines...) Expand all Loading... |
2084 "@FileArg($_rebased_build_config:deps_info:apk_path)", | 2110 "@FileArg($_rebased_build_config:deps_info:apk_path)", |
2085 ] | 2111 ] |
2086 } | 2112 } |
2087 } | 2113 } |
2088 if (defined(invoker.isolate_file)) { | 2114 if (defined(invoker.isolate_file)) { |
2089 test_runner_args += [ | 2115 test_runner_args += [ |
2090 "--isolate-file-path", | 2116 "--isolate-file-path", |
2091 rebase_path(invoker.isolate_file, root_build_dir), | 2117 rebase_path(invoker.isolate_file, root_build_dir), |
2092 ] | 2118 ] |
2093 } | 2119 } |
2094 if (defined(invoker.incremental_install) && invoker.incremental_install) { | 2120 if (_incremental_install) { |
2095 test_runner_args += [ | 2121 test_runner_args += [ |
2096 "--incremental-install", | 2122 "--test-apk-incremental-install-script", |
2097 "--fast-local-dev", | 2123 "@FileArg($_rebased_apk_build_config:deps_info:incremental_install_scrip
t_path)", |
2098 ] | 2124 ] |
| 2125 if (defined(invoker.apk_under_test)) { |
| 2126 test_runner_args += [ |
| 2127 "--apk-under-test-incremental-install-script", |
| 2128 "@FileArg($_rebased_apk_under_test_build_config:deps_info:incremental_
install_script_path)", |
| 2129 ] |
| 2130 } |
| 2131 test_runner_args += [ "--fast-local-dev" ] |
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 } |
OLD | NEW |