| 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", |
| Jimi Chen | f8264fb | 2025-06-24 13:27:02 +0000 | [diff] [blame] | 48 | "flag-junit", |
| Remi NGUYEN VAN | 31022d6 | 2021-05-11 13:37:06 +0000 | [diff] [blame] | 49 | "junit", |
| 50 | "mockito-target-minus-junit4", |
| 51 | "modules-utils-build", |
| 52 | "net-tests-utils", |
| 53 | "net-utils-framework-common", |
| Taras Antoshchuk | 30d41e5 | 2021-08-02 18:06:35 +0200 | [diff] [blame] | 54 | "platform-compat-test-rules", |
| Remi NGUYEN VAN | 31022d6 | 2021-05-11 13:37:06 +0000 | [diff] [blame] | 55 | "platform-test-annotations", |
| 56 | ], |
| 57 | libs: [ |
| 58 | "android.test.base.stubs", |
| 59 | ], |
| 60 | } |
| Remi NGUYEN VAN | 679a8e0 | 2021-05-14 07:24:53 +0000 | [diff] [blame] | 61 | |
| markchien | e59f5e3 | 2022-04-02 00:45:53 +0800 | [diff] [blame] | 62 | // Combine Connectivity, NetworkStack and Tethering jarjar rules for coverage target. |
| 63 | // The jarjar files are simply concatenated in the order specified in srcs. |
| 64 | // jarjar stops at the first matching rule, so order of concatenation affects the output. |
| Cole Faust | 9ff8f4c | 2024-10-22 16:31:00 -0700 | [diff] [blame] | 65 | java_genrule { |
| markchien | e59f5e3 | 2022-04-02 00:45:53 +0800 | [diff] [blame] | 66 | name: "ConnectivityCoverageJarJarRules", |
| Remi NGUYEN VAN | e55a88d | 2022-04-20 15:59:16 +0900 | [diff] [blame] | 67 | defaults: ["jarjar-rules-combine-defaults"], |
| markchien | e59f5e3 | 2022-04-02 00:45:53 +0800 | [diff] [blame] | 68 | srcs: [ |
| 69 | "tethering-jni-jarjar-rules.txt", |
| Mark | 53e71c3 | 2023-01-13 07:00:25 +0000 | [diff] [blame] | 70 | ":frameworks-net-tests-jarjar-rules", |
| markchien | e59f5e3 | 2022-04-02 00:45:53 +0800 | [diff] [blame] | 71 | ":TetheringTestsJarJarRules", |
| 72 | ":NetworkStackJarJarRules", |
| 73 | ], |
| 74 | out: ["jarjar-rules-connectivity-coverage.txt"], |
| markchien | e59f5e3 | 2022-04-02 00:45:53 +0800 | [diff] [blame] | 75 | visibility: ["//visibility:private"], |
| 76 | } |
| 77 | |
| Remi NGUYEN VAN | 8ea5ee6 | 2021-06-28 18:48:43 +0900 | [diff] [blame] | 78 | android_library { |
| 79 | name: "ConnectivityCoverageTestsLib", |
| 80 | min_sdk_version: "30", |
| 81 | static_libs: [ |
| Remi NGUYEN VAN | 96267ec | 2024-10-16 09:56:17 +0900 | [diff] [blame] | 82 | "ConnectivityUnitTestsLib", |
| Remi NGUYEN VAN | 8ea5ee6 | 2021-06-28 18:48:43 +0900 | [diff] [blame] | 83 | "NetdStaticLibTestsLib", |
| 84 | "NetworkStaticLibTestsLib", |
| markchien | e59f5e3 | 2022-04-02 00:45:53 +0800 | [diff] [blame] | 85 | "NetworkStackTestsLib", |
| 86 | "TetheringTestsLatestSdkLib", |
| 87 | "TetheringIntegrationTestsLatestSdkLib", |
| Remi NGUYEN VAN | 8ea5ee6 | 2021-06-28 18:48:43 +0900 | [diff] [blame] | 88 | ], |
| markchien | e59f5e3 | 2022-04-02 00:45:53 +0800 | [diff] [blame] | 89 | jarjar_rules: ":ConnectivityCoverageJarJarRules", |
| Remi NGUYEN VAN | 8ea5ee6 | 2021-06-28 18:48:43 +0900 | [diff] [blame] | 90 | manifest: "AndroidManifest_coverage.xml", |
| 91 | visibility: ["//visibility:private"], |
| 92 | } |
| 93 | |
| Remi NGUYEN VAN | fe20e13 | 2021-06-07 13:10:49 +0900 | [diff] [blame] | 94 | android_test { |
| 95 | name: "ConnectivityCoverageTests", |
| 96 | // Tethering started on SDK 30 |
| 97 | min_sdk_version: "30", |
| Aditya Choudhary | 01b5ede | 2024-01-31 11:08:57 +0000 | [diff] [blame] | 98 | test_suites: [ |
| 99 | "general-tests", |
| 100 | "mts-tethering", |
| 101 | ], |
| Remi NGUYEN VAN | fe20e13 | 2021-06-07 13:10:49 +0900 | [diff] [blame] | 102 | defaults: [ |
| Lorenzo Colitti | cc5054b | 2022-07-22 12:37:17 +0900 | [diff] [blame] | 103 | "ConnectivityTestsLatestSdkDefaults", |
| Remi NGUYEN VAN | e55a88d | 2022-04-20 15:59:16 +0900 | [diff] [blame] | 104 | "framework-connectivity-internal-test-defaults", |
| Remi NGUYEN VAN | fe20e13 | 2021-06-07 13:10:49 +0900 | [diff] [blame] | 105 | "FrameworksNetTests-jni-defaults", |
| 106 | "libnetworkstackutilsjni_deps", |
| 107 | ], |
| 108 | manifest: "AndroidManifest_coverage.xml", |
| 109 | test_config: "AndroidTest_Coverage.xml", |
| 110 | static_libs: [ |
| 111 | // Added first so all tests use extended mockito, instead of all tests using regular mockito |
| 112 | // (some tests would fail). |
| 113 | // TODO: consider removing extended mockito usage in tests that use it, for performance |
| 114 | "mockito-target-extended-minus-junit4", |
| Remi NGUYEN VAN | fe20e13 | 2021-06-07 13:10:49 +0900 | [diff] [blame] | 115 | "modules-utils-native-coverage-listener", |
| Remi NGUYEN VAN | 8ea5ee6 | 2021-06-28 18:48:43 +0900 | [diff] [blame] | 116 | "ConnectivityCoverageTestsLib", |
| Hao Liu | 5561498 | 2025-06-23 19:53:02 +0000 | [diff] [blame] | 117 | "com.android.tethering.mainline.beta.flags-aconfig-java", |
| 118 | "flag-junit", |
| Remi NGUYEN VAN | fe20e13 | 2021-06-07 13:10:49 +0900 | [diff] [blame] | 119 | ], |
| 120 | jni_libs: [ |
| 121 | // For mockito extended |
| 122 | "libdexmakerjvmtiagent", |
| 123 | "libstaticjvmtiagent", |
| 124 | // For NetworkStackUtils included in NetworkStackBase |
| 125 | "libnetworkstackutilsjni", |
| Remi NGUYEN VAN | 2ba9dbe | 2022-02-01 23:07:33 +0900 | [diff] [blame] | 126 | "libandroid_net_connectivity_com_android_net_module_util_jni", |
| Jimi Chen | e5a4e6b | 2025-06-11 23:46:57 +0000 | [diff] [blame] | 127 | "libandroid_net_connectivity_com_android_net_module_util_jni_CommonConnectivityJni", |
| markchien | f967b11 | 2021-11-09 16:56:23 +0800 | [diff] [blame] | 128 | "libcom_android_networkstack_tethering_util_jni", |
| Remi NGUYEN VAN | fe20e13 | 2021-06-07 13:10:49 +0900 | [diff] [blame] | 129 | // For framework tests |
| 130 | "libservice-connectivity", |
| 131 | ], |
| 132 | libs: [ |
| 133 | // Although not required to compile the static libs together, the "libs" used to build each |
| 134 | // of the common static test libs are necessary for R8 to avoid "Missing class" warnings and |
| 135 | // incorrect optimizations |
| 136 | "framework-tethering.impl", |
| 137 | "framework-wifi.stubs.module_lib", |
| 138 | ], |
| 139 | compile_multilib: "both", |
| 140 | } |
| 141 | |
| Remi NGUYEN VAN | 679a8e0 | 2021-05-14 07:24:53 +0000 | [diff] [blame] | 142 | // defaults for tests that need to build against framework-connectivity's @hide APIs |
| 143 | // Only usable from targets that have visibility on framework-connectivity.impl. |
| 144 | // Instead of using this, consider avoiding to depend on hidden connectivity APIs in |
| 145 | // tests. |
| 146 | java_defaults { |
| 147 | name: "framework-connectivity-test-defaults", |
| 148 | sdk_version: "core_platform", // tests can use @CorePlatformApi's |
| 149 | libs: [ |
| 150 | // order matters: classes in framework-connectivity are resolved before framework, |
| 151 | // meaning @hide APIs in framework-connectivity are resolved before @SystemApi |
| 152 | // stubs in framework |
| 153 | "framework-connectivity.impl", |
| Yan Yan | 587f996 | 2024-10-02 22:38:10 +0000 | [diff] [blame] | 154 | "framework-connectivity-b.impl", |
| paulhu | 537f720 | 2022-02-08 21:25:28 +0800 | [diff] [blame] | 155 | "framework-connectivity-t.impl", |
| markchien | 2fbd3e7 | 2021-08-17 23:59:09 +0800 | [diff] [blame] | 156 | "framework-tethering.impl", |
| Remi NGUYEN VAN | 679a8e0 | 2021-05-14 07:24:53 +0000 | [diff] [blame] | 157 | "framework", |
| 158 | |
| 159 | // if sdk_version="" this gets automatically included, but here we need to add manually. |
| 160 | "framework-res", |
| 161 | ], |
| Chalard Jean | 87df372 | 2025-05-09 13:19:11 +0900 | [diff] [blame] | 162 | // Tests must check a large number of deprecated methods and warning about it |
| 163 | // sends hundreds of warning lines flooding the useful warnings. |
| 164 | kotlincflags: ["-Xsuppress-warning=DEPRECATION"], |
| Chalard Jean | ebaef12 | 2025-05-09 13:20:31 +0900 | [diff] [blame] | 165 | // TODO: add "-Xwarning-level=CheckResult:error" when Kotlin 2.2.0 is out |
| Remi NGUYEN VAN | 679a8e0 | 2021-05-14 07:24:53 +0000 | [diff] [blame] | 166 | } |
| Lorenzo Colitti | da0c43e | 2022-01-14 11:13:15 +0900 | [diff] [blame] | 167 | |
| Remi NGUYEN VAN | 1a8ee10 | 2022-05-30 12:42:24 +0900 | [diff] [blame] | 168 | // defaults for tests that need to build against framework-connectivity's @hide APIs, but also |
| 169 | // using fully @hide classes that are jarjared (because they have no API member). Similar to |
| 170 | // framework-connectivity-test-defaults above but uses pre-jarjar class names. |
| 171 | // Only usable from targets that have visibility on framework-connectivity-pre-jarjar, and apply |
| 172 | // connectivity jarjar rules so that references to jarjared classes still match: this is limited to |
| 173 | // connectivity internal tests only. |
| 174 | java_defaults { |
| 175 | name: "framework-connectivity-internal-test-defaults", |
| 176 | sdk_version: "core_platform", // tests can use @CorePlatformApi's |
| 177 | libs: [ |
| 178 | // order matters: classes in framework-connectivity are resolved before framework, |
| 179 | // meaning @hide APIs in framework-connectivity are resolved before @SystemApi |
| 180 | // stubs in framework |
| 181 | "framework-connectivity-pre-jarjar", |
| 182 | "framework-connectivity-t-pre-jarjar", |
| 183 | "framework-tethering.impl", |
| 184 | "framework", |
| 185 | |
| 186 | // if sdk_version="" this gets automatically included, but here we need to add manually. |
| 187 | "framework-res", |
| 188 | ], |
| Chalard Jean | 87df372 | 2025-05-09 13:19:11 +0900 | [diff] [blame] | 189 | // Tests must check a large number of deprecated methods and warning about it |
| 190 | // sends hundreds of warning lines flooding the useful warnings. |
| 191 | kotlincflags: ["-Xsuppress-warning=DEPRECATION"], |
| Chalard Jean | ebaef12 | 2025-05-09 13:20:31 +0900 | [diff] [blame] | 192 | // TODO: add "-Xwarning-level=CheckResult:error" when Kotlin 2.2.0 is out |
| Remi NGUYEN VAN | 1a8ee10 | 2022-05-30 12:42:24 +0900 | [diff] [blame] | 193 | defaults_visibility: ["//packages/modules/Connectivity/tests:__subpackages__"], |
| 194 | } |
| 195 | |
| Lorenzo Colitti | be53da1 | 2022-01-18 00:27:59 +0900 | [diff] [blame] | 196 | // Defaults for tests that want to run in mainline-presubmit. |
| 197 | // 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] | 198 | // use the mainline-param config-descriptor metadata in AndroidTest.xml. |
| Lorenzo Colitti | be53da1 | 2022-01-18 00:27:59 +0900 | [diff] [blame] | 199 | |
| 200 | // test_mainline_modules is an array of strings. Each element in the array is a list of modules |
| 201 | // separated by "+". The modules in this list must be in alphabetical order. |
| 202 | // See SuiteModuleLoader.java. |
| 203 | // TODO: why are the modules separated by + instead of being separate entries in the array? |
| 204 | mainline_presubmit_modules = [ |
| Aditya Choudhary | 01b5ede | 2024-01-31 11:08:57 +0000 | [diff] [blame] | 205 | "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] | 206 | ] |
| 207 | |
| Lorenzo Colitti | da0c43e | 2022-01-14 11:13:15 +0900 | [diff] [blame] | 208 | cc_defaults { |
| 209 | name: "connectivity-mainline-presubmit-cc-defaults", |
| Lorenzo Colitti | be53da1 | 2022-01-18 00:27:59 +0900 | [diff] [blame] | 210 | test_mainline_modules: mainline_presubmit_modules, |
| 211 | } |
| 212 | |
| 213 | java_defaults { |
| 214 | name: "connectivity-mainline-presubmit-java-defaults", |
| 215 | test_mainline_modules: mainline_presubmit_modules, |
| Lorenzo Colitti | da0c43e | 2022-01-14 11:13:15 +0900 | [diff] [blame] | 216 | } |
| Ryan Prichard | 3ae062d | 2024-05-20 15:34:32 -0700 | [diff] [blame] | 217 | |
| 218 | filegroup { |
| 219 | name: "connectivity_mainline_test_map", |
| 220 | srcs: ["connectivity_mainline_test.map"], |
| 221 | } |