blob: a2bd1a5e2d01b73198ff7ad31ed25dde32ce6d82 [file] [log] [blame]
Lorenzo Colitti4896e322020-03-17 01:07:47 +09001//
2// Copyright (C) 2020 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//
Bob Badour97e6be22021-02-12 14:45:04 -080016package {
17 default_applicable_licenses: ["Android-Apache-2.0"],
18}
19
paulhu64632652020-04-06 14:58:12 +080020java_defaults {
21 name: "TetheringIntegrationTestsDefaults",
markchien2fbd3e72021-08-17 23:59:09 +080022 defaults: ["framework-connectivity-test-defaults"],
Lorenzo Colitti4896e322020-03-17 01:07:47 +090023 srcs: [
24 "src/**/*.java",
25 "src/**/*.kt",
26 ],
markchien7193a1b2021-04-27 01:50:31 +080027 min_sdk_version: "30",
Lorenzo Colitti4896e322020-03-17 01:07:47 +090028 static_libs: [
29 "NetworkStackApiStableLib",
30 "androidx.test.rules",
Lorenzo Colitti4896e322020-03-17 01:07:47 +090031 "mockito-target-extended-minus-junit4",
32 "net-tests-utils",
33 "testables",
34 ],
35 libs: [
36 "android.test.runner",
37 "android.test.base",
38 "android.test.mock",
39 ],
paulhud584d2f2020-04-08 09:57:57 +080040 jni_libs: [
41 // For mockito extended
42 "libdexmakerjvmtiagent",
43 "libstaticjvmtiagent",
44 ],
Lorenzo Colitti4896e322020-03-17 01:07:47 +090045}
paulhu64632652020-04-06 14:58:12 +080046
Remi NGUYEN VAN0015f042021-07-27 14:30:14 +090047// Library including tethering integration tests targeting the latest stable SDK.
48// Use with NetworkStackJarJarRules.
paulhu64632652020-04-06 14:58:12 +080049android_library {
markchien7193a1b2021-04-27 01:50:31 +080050 name: "TetheringIntegrationTestsLatestSdkLib",
51 target_sdk_version: "30",
paulhu64632652020-04-06 14:58:12 +080052 platform_apis: true,
53 defaults: ["TetheringIntegrationTestsDefaults"],
Baligh Uddin661ae392020-11-04 05:34:06 +000054 visibility: [
Baligh Uddin661ae392020-11-04 05:34:06 +000055 "//packages/modules/Connectivity/tests/cts/tethering",
Remi NGUYEN VANfe20e132021-06-07 13:10:49 +090056 "//packages/modules/Connectivity/tests:__subpackages__",
57 "//packages/modules/Connectivity/Tethering/tests:__subpackages__",
markchien7193a1b2021-04-27 01:50:31 +080058 ]
59}
60
Remi NGUYEN VAN0015f042021-07-27 14:30:14 +090061// Library including tethering integration tests targeting current development SDK.
62// Use with NetworkStackJarJarRules.
markchien7193a1b2021-04-27 01:50:31 +080063android_library {
64 name: "TetheringIntegrationTestsLib",
65 target_sdk_version: "current",
66 platform_apis: true,
67 defaults: ["TetheringIntegrationTestsDefaults"],
68 visibility: [
69 "//packages/modules/Connectivity/tests/cts/tethering",
70 "//packages/modules/Connectivity/Tethering/tests/mts",
Baligh Uddin661ae392020-11-04 05:34:06 +000071 ]
paulhu64632652020-04-06 14:58:12 +080072}
73
74android_test {
75 name: "TetheringIntegrationTests",
76 platform_apis: true,
77 defaults: ["TetheringIntegrationTestsDefaults"],
78 test_suites: [
79 "device-tests",
Kimberly Kreiderc5b3f342021-10-20 18:16:59 +000080 "mts-tethering",
paulhu64632652020-04-06 14:58:12 +080081 ],
82 compile_multilib: "both",
Remi NGUYEN VAN0015f042021-07-27 14:30:14 +090083 jarjar_rules: ":NetworkStackJarJarRules",
paulhu64632652020-04-06 14:58:12 +080084}
85
Remi NGUYEN VAN8ea5ee62021-06-28 18:48:43 +090086android_library {
87 name: "TetheringCoverageTestsLib",
88 min_sdk_version: "30",
89 static_libs: [
90 "NetdStaticLibTestsLib",
91 "NetworkStaticLibTestsLib",
92 "NetworkStackTestsLib",
93 "TetheringTestsLatestSdkLib",
94 "TetheringIntegrationTestsLatestSdkLib",
95 ],
Remi NGUYEN VAN0015f042021-07-27 14:30:14 +090096 // Jarjar rules should normally be applied on final artifacts and not intermediate libraries as
97 // applying different rules on intermediate libraries can cause conflicts when combining them
98 // (the resulting artifact can end up with multiple incompatible implementations of the same
99 // classes). But this library is used to combine tethering coverage tests with connectivity
100 // coverage tests into a single coverage target. The tests need to use the same jarjar rules as
101 // covered production code for coverage to be calculated properly, so jarjar is applied
102 // separately on each set of tests.
103 jarjar_rules: ":TetheringCoverageJarJarRules",
Remi NGUYEN VAN8ea5ee62021-06-28 18:48:43 +0900104 manifest: "AndroidManifest_coverage.xml",
105 visibility: [
106 "//packages/modules/Connectivity/tests:__subpackages__"
107 ],
108}
109
Remi NGUYEN VAN0015f042021-07-27 14:30:14 +0900110// Combine NetworkStack and Tethering jarjar rules for coverage target. The jarjar files are
111// simply concatenated in the order specified in srcs.
112genrule {
113 name: "TetheringCoverageJarJarRules",
114 srcs: [
115 ":TetheringTestsJarJarRules",
116 ":NetworkStackJarJarRules",
117 ],
118 out: ["jarjar-rules-tethering-coverage.txt"],
119 cmd: "cat $(in) > $(out)",
120 visibility: ["//visibility:private"],
121}
122
paulhu64632652020-04-06 14:58:12 +0800123// Special version of the tethering tests that includes all tests necessary for code coverage
124// purposes. This is currently the union of TetheringTests, TetheringIntegrationTests and
125// NetworkStackTests.
Remi NGUYEN VAN8ea5ee62021-06-28 18:48:43 +0900126// TODO: remove in favor of ConnectivityCoverageTests, which includes below tests and more
paulhu64632652020-04-06 14:58:12 +0800127android_test {
128 name: "TetheringCoverageTests",
paulhu64632652020-04-06 14:58:12 +0800129 platform_apis: true,
markchien7193a1b2021-04-27 01:50:31 +0800130 min_sdk_version: "30",
131 target_sdk_version: "30",
Kimberly Kreiderc5b3f342021-10-20 18:16:59 +0000132 test_suites: ["device-tests", "mts-tethering"],
paulhu64632652020-04-06 14:58:12 +0800133 test_config: "AndroidTest_Coverage.xml",
134 defaults: ["libnetworkstackutilsjni_deps"],
135 static_libs: [
markchienb23e9122021-04-27 17:23:44 +0800136 "modules-utils-native-coverage-listener",
Remi NGUYEN VAN8ea5ee62021-06-28 18:48:43 +0900137 "TetheringCoverageTestsLib",
paulhu64632652020-04-06 14:58:12 +0800138 ],
139 jni_libs: [
140 // For mockito extended
141 "libdexmakerjvmtiagent",
142 "libstaticjvmtiagent",
143 // For NetworkStackUtils included in NetworkStackBase
144 "libnetworkstackutilsjni",
markchienf967b112021-11-09 16:56:23 +0800145 "libcom_android_networkstack_tethering_util_jni",
paulhu64632652020-04-06 14:58:12 +0800146 ],
147 compile_multilib: "both",
148 manifest: "AndroidManifest_coverage.xml",
markchiene3126482020-10-26 13:53:05 +0800149}