| Remi NGUYEN VAN | 31022d6 | 2021-05-11 13:37:06 +0000 | [diff] [blame] | 1 | // | 
|  | 2 | // Copyright (C) 2019 The Android Open Source Project | 
|  | 3 | // | 
|  | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 5 | // you may not use this file except in compliance with the License. | 
|  | 6 | // You may obtain a copy of the License at | 
|  | 7 | // | 
|  | 8 | //      http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 9 | // | 
|  | 10 | // Unless required by applicable law or agreed to in writing, software | 
|  | 11 | // distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 13 | // See the License for the specific language governing permissions and | 
|  | 14 | // limitations under the License. | 
|  | 15 | // | 
|  | 16 |  | 
|  | 17 | // Tests in this folder are included both in unit tests and CTS. | 
|  | 18 | // They must be fast and stable, and exercise public or test APIs. | 
|  | 19 | package { | 
| Aditya Choudhary | 01b5ede | 2024-01-31 11:08:57 +0000 | [diff] [blame] | 20 | default_team: "trendy_team_fwk_core_networking", | 
| Remi NGUYEN VAN | 31022d6 | 2021-05-11 13:37:06 +0000 | [diff] [blame] | 21 | // See: http://go/android-license-faq | 
| Baligh Uddin | 3684713 | 2021-05-23 16:38:40 +0000 | [diff] [blame] | 22 | default_applicable_licenses: ["Android-Apache-2.0"], | 
| Remi NGUYEN VAN | 31022d6 | 2021-05-11 13:37:06 +0000 | [diff] [blame] | 23 | } | 
|  | 24 |  | 
| Lorenzo Colitti | cc5054b | 2022-07-22 12:37:17 +0900 | [diff] [blame] | 25 | // The target SDK version of the "latest released SDK" CTS tests. | 
|  | 26 | // This should be updated soon after a new SDK level is finalized. | 
|  | 27 | // It is different from the target SDK version of production code (e.g., the Tethering, | 
|  | 28 | // NetworkStack, and CaptivePortalLogin APKs): | 
|  | 29 | // - The target SDK of production code influences the behaviour of the production code. | 
|  | 30 | // - The target SDK of the CTS tests validates the behaviour seen by apps that call production APIs. | 
|  | 31 | // - The behaviour seen by apps that target previous SDKs is tested by previous CTS versions | 
|  | 32 | //   (currently, CTS 10, 11, and 12). | 
|  | 33 | java_defaults { | 
|  | 34 | name: "ConnectivityTestsLatestSdkDefaults", | 
| Yuyang Huang | 79a245e | 2023-05-24 15:28:21 +0900 | [diff] [blame] | 35 | target_sdk_version: "34", | 
| Lorenzo Colitti | cc5054b | 2022-07-22 12:37:17 +0900 | [diff] [blame] | 36 | } | 
|  | 37 |  | 
| Remi NGUYEN VAN | 31022d6 | 2021-05-11 13:37:06 +0000 | [diff] [blame] | 38 | java_library { | 
|  | 39 | name: "FrameworksNetCommonTests", | 
| Remi NGUYEN VAN | e55a88d | 2022-04-20 15:59:16 +0900 | [diff] [blame] | 40 | defaults: ["framework-connectivity-internal-test-defaults"], | 
| Remi NGUYEN VAN | 3912c80 | 2021-03-16 01:31:07 +0000 | [diff] [blame] | 41 | srcs: [ | 
|  | 42 | "java/**/*.java", | 
|  | 43 | "java/**/*.kt", | 
|  | 44 | ], | 
| Remi NGUYEN VAN | 31022d6 | 2021-05-11 13:37:06 +0000 | [diff] [blame] | 45 | static_libs: [ | 
|  | 46 | "androidx.core_core", | 
|  | 47 | "androidx.test.rules", | 
|  | 48 | "junit", | 
|  | 49 | "mockito-target-minus-junit4", | 
|  | 50 | "modules-utils-build", | 
|  | 51 | "net-tests-utils", | 
|  | 52 | "net-utils-framework-common", | 
| Taras Antoshchuk | 30d41e5 | 2021-08-02 18:06:35 +0200 | [diff] [blame] | 53 | "platform-compat-test-rules", | 
| Remi NGUYEN VAN | 31022d6 | 2021-05-11 13:37:06 +0000 | [diff] [blame] | 54 | "platform-test-annotations", | 
|  | 55 | ], | 
|  | 56 | libs: [ | 
|  | 57 | "android.test.base.stubs", | 
|  | 58 | ], | 
|  | 59 | } | 
| Remi NGUYEN VAN | 679a8e0 | 2021-05-14 07:24:53 +0000 | [diff] [blame] | 60 |  | 
| markchien | e59f5e3 | 2022-04-02 00:45:53 +0800 | [diff] [blame] | 61 | // Combine Connectivity, NetworkStack and Tethering jarjar rules for coverage target. | 
|  | 62 | // The jarjar files are simply concatenated in the order specified in srcs. | 
|  | 63 | // jarjar stops at the first matching rule, so order of concatenation affects the output. | 
|  | 64 | genrule { | 
|  | 65 | name: "ConnectivityCoverageJarJarRules", | 
| Remi NGUYEN VAN | e55a88d | 2022-04-20 15:59:16 +0900 | [diff] [blame] | 66 | defaults: ["jarjar-rules-combine-defaults"], | 
| markchien | e59f5e3 | 2022-04-02 00:45:53 +0800 | [diff] [blame] | 67 | srcs: [ | 
|  | 68 | "tethering-jni-jarjar-rules.txt", | 
| Mark | 53e71c3 | 2023-01-13 07:00:25 +0000 | [diff] [blame] | 69 | ":frameworks-net-tests-jarjar-rules", | 
| markchien | e59f5e3 | 2022-04-02 00:45:53 +0800 | [diff] [blame] | 70 | ":TetheringTestsJarJarRules", | 
|  | 71 | ":NetworkStackJarJarRules", | 
|  | 72 | ], | 
|  | 73 | out: ["jarjar-rules-connectivity-coverage.txt"], | 
| markchien | e59f5e3 | 2022-04-02 00:45:53 +0800 | [diff] [blame] | 74 | visibility: ["//visibility:private"], | 
|  | 75 | } | 
|  | 76 |  | 
| Remi NGUYEN VAN | 8ea5ee6 | 2021-06-28 18:48:43 +0900 | [diff] [blame] | 77 | android_library { | 
|  | 78 | name: "ConnectivityCoverageTestsLib", | 
|  | 79 | min_sdk_version: "30", | 
|  | 80 | static_libs: [ | 
|  | 81 | "FrameworksNetTestsLib", | 
|  | 82 | "NetdStaticLibTestsLib", | 
|  | 83 | "NetworkStaticLibTestsLib", | 
| markchien | e59f5e3 | 2022-04-02 00:45:53 +0800 | [diff] [blame] | 84 | "NetworkStackTestsLib", | 
|  | 85 | "TetheringTestsLatestSdkLib", | 
|  | 86 | "TetheringIntegrationTestsLatestSdkLib", | 
| Remi NGUYEN VAN | 8ea5ee6 | 2021-06-28 18:48:43 +0900 | [diff] [blame] | 87 | ], | 
| markchien | e59f5e3 | 2022-04-02 00:45:53 +0800 | [diff] [blame] | 88 | jarjar_rules: ":ConnectivityCoverageJarJarRules", | 
| Remi NGUYEN VAN | 8ea5ee6 | 2021-06-28 18:48:43 +0900 | [diff] [blame] | 89 | manifest: "AndroidManifest_coverage.xml", | 
|  | 90 | visibility: ["//visibility:private"], | 
|  | 91 | } | 
|  | 92 |  | 
| Remi NGUYEN VAN | fe20e13 | 2021-06-07 13:10:49 +0900 | [diff] [blame] | 93 | android_test { | 
|  | 94 | name: "ConnectivityCoverageTests", | 
|  | 95 | // Tethering started on SDK 30 | 
|  | 96 | min_sdk_version: "30", | 
| Aditya Choudhary | 01b5ede | 2024-01-31 11:08:57 +0000 | [diff] [blame] | 97 | test_suites: [ | 
|  | 98 | "general-tests", | 
|  | 99 | "mts-tethering", | 
|  | 100 | ], | 
| Remi NGUYEN VAN | fe20e13 | 2021-06-07 13:10:49 +0900 | [diff] [blame] | 101 | defaults: [ | 
| Lorenzo Colitti | cc5054b | 2022-07-22 12:37:17 +0900 | [diff] [blame] | 102 | "ConnectivityTestsLatestSdkDefaults", | 
| Remi NGUYEN VAN | e55a88d | 2022-04-20 15:59:16 +0900 | [diff] [blame] | 103 | "framework-connectivity-internal-test-defaults", | 
| Remi NGUYEN VAN | fe20e13 | 2021-06-07 13:10:49 +0900 | [diff] [blame] | 104 | "FrameworksNetTests-jni-defaults", | 
|  | 105 | "libnetworkstackutilsjni_deps", | 
|  | 106 | ], | 
|  | 107 | manifest: "AndroidManifest_coverage.xml", | 
|  | 108 | test_config: "AndroidTest_Coverage.xml", | 
|  | 109 | static_libs: [ | 
|  | 110 | // Added first so all tests use extended mockito, instead of all tests using regular mockito | 
|  | 111 | // (some tests would fail). | 
|  | 112 | // TODO: consider removing extended mockito usage in tests that use it, for performance | 
|  | 113 | "mockito-target-extended-minus-junit4", | 
| Remi NGUYEN VAN | fe20e13 | 2021-06-07 13:10:49 +0900 | [diff] [blame] | 114 | "modules-utils-native-coverage-listener", | 
| Remi NGUYEN VAN | 8ea5ee6 | 2021-06-28 18:48:43 +0900 | [diff] [blame] | 115 | "ConnectivityCoverageTestsLib", | 
| Remi NGUYEN VAN | fe20e13 | 2021-06-07 13:10:49 +0900 | [diff] [blame] | 116 | ], | 
|  | 117 | jni_libs: [ | 
|  | 118 | // For mockito extended | 
|  | 119 | "libdexmakerjvmtiagent", | 
|  | 120 | "libstaticjvmtiagent", | 
|  | 121 | // For NetworkStackUtils included in NetworkStackBase | 
|  | 122 | "libnetworkstackutilsjni", | 
| Remi NGUYEN VAN | 2ba9dbe | 2022-02-01 23:07:33 +0900 | [diff] [blame] | 123 | "libandroid_net_connectivity_com_android_net_module_util_jni", | 
| markchien | f967b11 | 2021-11-09 16:56:23 +0800 | [diff] [blame] | 124 | "libcom_android_networkstack_tethering_util_jni", | 
| Remi NGUYEN VAN | fe20e13 | 2021-06-07 13:10:49 +0900 | [diff] [blame] | 125 | // For framework tests | 
|  | 126 | "libservice-connectivity", | 
|  | 127 | ], | 
|  | 128 | libs: [ | 
|  | 129 | // Although not required to compile the static libs together, the "libs" used to build each | 
|  | 130 | // of the common static test libs are necessary for R8 to avoid "Missing class" warnings and | 
|  | 131 | // incorrect optimizations | 
|  | 132 | "framework-tethering.impl", | 
|  | 133 | "framework-wifi.stubs.module_lib", | 
|  | 134 | ], | 
|  | 135 | compile_multilib: "both", | 
|  | 136 | } | 
|  | 137 |  | 
| Remi NGUYEN VAN | 679a8e0 | 2021-05-14 07:24:53 +0000 | [diff] [blame] | 138 | // defaults for tests that need to build against framework-connectivity's @hide APIs | 
|  | 139 | // Only usable from targets that have visibility on framework-connectivity.impl. | 
|  | 140 | // Instead of using this, consider avoiding to depend on hidden connectivity APIs in | 
|  | 141 | // tests. | 
|  | 142 | java_defaults { | 
|  | 143 | name: "framework-connectivity-test-defaults", | 
|  | 144 | sdk_version: "core_platform", // tests can use @CorePlatformApi's | 
|  | 145 | libs: [ | 
|  | 146 | // order matters: classes in framework-connectivity are resolved before framework, | 
|  | 147 | // meaning @hide APIs in framework-connectivity are resolved before @SystemApi | 
|  | 148 | // stubs in framework | 
|  | 149 | "framework-connectivity.impl", | 
| paulhu | 537f720 | 2022-02-08 21:25:28 +0800 | [diff] [blame] | 150 | "framework-connectivity-t.impl", | 
| markchien | 2fbd3e7 | 2021-08-17 23:59:09 +0800 | [diff] [blame] | 151 | "framework-tethering.impl", | 
| Remi NGUYEN VAN | 679a8e0 | 2021-05-14 07:24:53 +0000 | [diff] [blame] | 152 | "framework", | 
|  | 153 |  | 
|  | 154 | // if sdk_version="" this gets automatically included, but here we need to add manually. | 
|  | 155 | "framework-res", | 
|  | 156 | ], | 
|  | 157 | } | 
| Lorenzo Colitti | da0c43e | 2022-01-14 11:13:15 +0900 | [diff] [blame] | 158 |  | 
| Remi NGUYEN VAN | 1a8ee10 | 2022-05-30 12:42:24 +0900 | [diff] [blame] | 159 | // defaults for tests that need to build against framework-connectivity's @hide APIs, but also | 
|  | 160 | // using fully @hide classes that are jarjared (because they have no API member). Similar to | 
|  | 161 | // framework-connectivity-test-defaults above but uses pre-jarjar class names. | 
|  | 162 | // Only usable from targets that have visibility on framework-connectivity-pre-jarjar, and apply | 
|  | 163 | // connectivity jarjar rules so that references to jarjared classes still match: this is limited to | 
|  | 164 | // connectivity internal tests only. | 
|  | 165 | java_defaults { | 
|  | 166 | name: "framework-connectivity-internal-test-defaults", | 
|  | 167 | sdk_version: "core_platform", // tests can use @CorePlatformApi's | 
|  | 168 | libs: [ | 
|  | 169 | // order matters: classes in framework-connectivity are resolved before framework, | 
|  | 170 | // meaning @hide APIs in framework-connectivity are resolved before @SystemApi | 
|  | 171 | // stubs in framework | 
|  | 172 | "framework-connectivity-pre-jarjar", | 
|  | 173 | "framework-connectivity-t-pre-jarjar", | 
|  | 174 | "framework-tethering.impl", | 
|  | 175 | "framework", | 
|  | 176 |  | 
|  | 177 | // if sdk_version="" this gets automatically included, but here we need to add manually. | 
|  | 178 | "framework-res", | 
|  | 179 | ], | 
|  | 180 | defaults_visibility: ["//packages/modules/Connectivity/tests:__subpackages__"], | 
|  | 181 | } | 
|  | 182 |  | 
| Lorenzo Colitti | be53da1 | 2022-01-18 00:27:59 +0900 | [diff] [blame] | 183 | // Defaults for tests that want to run in mainline-presubmit. | 
|  | 184 | // Not widely used because many of our tests have AndroidTest.xml files and | 
| Lorenzo Colitti | da0c43e | 2022-01-14 11:13:15 +0900 | [diff] [blame] | 185 | // use the mainline-param config-descriptor metadata in AndroidTest.xml. | 
| Lorenzo Colitti | be53da1 | 2022-01-18 00:27:59 +0900 | [diff] [blame] | 186 |  | 
|  | 187 | // test_mainline_modules is an array of strings. Each element in the array is a list of modules | 
|  | 188 | // separated by "+". The modules in this list must be in alphabetical order. | 
|  | 189 | // See SuiteModuleLoader.java. | 
|  | 190 | // TODO: why are the modules separated by + instead of being separate entries in the array? | 
|  | 191 | mainline_presubmit_modules = [ | 
| Aditya Choudhary | 01b5ede | 2024-01-31 11:08:57 +0000 | [diff] [blame] | 192 | "CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex+com.google.android.tethering.apex", | 
| Lorenzo Colitti | be53da1 | 2022-01-18 00:27:59 +0900 | [diff] [blame] | 193 | ] | 
|  | 194 |  | 
| Lorenzo Colitti | da0c43e | 2022-01-14 11:13:15 +0900 | [diff] [blame] | 195 | cc_defaults { | 
|  | 196 | name: "connectivity-mainline-presubmit-cc-defaults", | 
| Lorenzo Colitti | be53da1 | 2022-01-18 00:27:59 +0900 | [diff] [blame] | 197 | test_mainline_modules: mainline_presubmit_modules, | 
|  | 198 | } | 
|  | 199 |  | 
|  | 200 | java_defaults { | 
|  | 201 | name: "connectivity-mainline-presubmit-java-defaults", | 
|  | 202 | test_mainline_modules: mainline_presubmit_modules, | 
| Lorenzo Colitti | da0c43e | 2022-01-14 11:13:15 +0900 | [diff] [blame] | 203 | } |