blob: 2593b1b5aa850f500bbe0031f073a13922664e8a [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",
Lorenzo Colitti4896e322020-03-17 01:07:47 +090022 srcs: [
23 "src/**/*.java",
24 "src/**/*.kt",
25 ],
markchien7193a1b2021-04-27 01:50:31 +080026 min_sdk_version: "30",
Lorenzo Colitti4896e322020-03-17 01:07:47 +090027 static_libs: [
28 "NetworkStackApiStableLib",
29 "androidx.test.rules",
Lorenzo Colitti4896e322020-03-17 01:07:47 +090030 "mockito-target-extended-minus-junit4",
31 "net-tests-utils",
32 "testables",
33 ],
34 libs: [
35 "android.test.runner",
36 "android.test.base",
37 "android.test.mock",
38 ],
paulhud584d2f2020-04-08 09:57:57 +080039 jni_libs: [
40 // For mockito extended
41 "libdexmakerjvmtiagent",
42 "libstaticjvmtiagent",
43 ],
Lorenzo Colitti4896e322020-03-17 01:07:47 +090044}
paulhu64632652020-04-06 14:58:12 +080045
Remi NGUYEN VAN0015f042021-07-27 14:30:14 +090046// Library including tethering integration tests targeting the latest stable SDK.
47// Use with NetworkStackJarJarRules.
paulhu64632652020-04-06 14:58:12 +080048android_library {
markchien7193a1b2021-04-27 01:50:31 +080049 name: "TetheringIntegrationTestsLatestSdkLib",
50 target_sdk_version: "30",
paulhu64632652020-04-06 14:58:12 +080051 platform_apis: true,
52 defaults: ["TetheringIntegrationTestsDefaults"],
Baligh Uddin661ae392020-11-04 05:34:06 +000053 visibility: [
Baligh Uddin661ae392020-11-04 05:34:06 +000054 "//packages/modules/Connectivity/tests/cts/tethering",
Remi NGUYEN VANfe20e132021-06-07 13:10:49 +090055 "//packages/modules/Connectivity/tests:__subpackages__",
56 "//packages/modules/Connectivity/Tethering/tests:__subpackages__",
markchien7193a1b2021-04-27 01:50:31 +080057 ]
58}
59
Remi NGUYEN VAN0015f042021-07-27 14:30:14 +090060// Library including tethering integration tests targeting current development SDK.
61// Use with NetworkStackJarJarRules.
markchien7193a1b2021-04-27 01:50:31 +080062android_library {
63 name: "TetheringIntegrationTestsLib",
64 target_sdk_version: "current",
65 platform_apis: true,
66 defaults: ["TetheringIntegrationTestsDefaults"],
67 visibility: [
68 "//packages/modules/Connectivity/tests/cts/tethering",
69 "//packages/modules/Connectivity/Tethering/tests/mts",
Baligh Uddin661ae392020-11-04 05:34:06 +000070 ]
paulhu64632652020-04-06 14:58:12 +080071}
72
73android_test {
74 name: "TetheringIntegrationTests",
75 platform_apis: true,
76 defaults: ["TetheringIntegrationTestsDefaults"],
77 test_suites: [
78 "device-tests",
79 "mts",
80 ],
81 compile_multilib: "both",
Remi NGUYEN VAN0015f042021-07-27 14:30:14 +090082 jarjar_rules: ":NetworkStackJarJarRules",
paulhu64632652020-04-06 14:58:12 +080083}
84
Remi NGUYEN VAN8ea5ee62021-06-28 18:48:43 +090085android_library {
86 name: "TetheringCoverageTestsLib",
87 min_sdk_version: "30",
88 static_libs: [
89 "NetdStaticLibTestsLib",
90 "NetworkStaticLibTestsLib",
91 "NetworkStackTestsLib",
92 "TetheringTestsLatestSdkLib",
93 "TetheringIntegrationTestsLatestSdkLib",
94 ],
Remi NGUYEN VAN0015f042021-07-27 14:30:14 +090095 // Jarjar rules should normally be applied on final artifacts and not intermediate libraries as
96 // applying different rules on intermediate libraries can cause conflicts when combining them
97 // (the resulting artifact can end up with multiple incompatible implementations of the same
98 // classes). But this library is used to combine tethering coverage tests with connectivity
99 // coverage tests into a single coverage target. The tests need to use the same jarjar rules as
100 // covered production code for coverage to be calculated properly, so jarjar is applied
101 // separately on each set of tests.
102 jarjar_rules: ":TetheringCoverageJarJarRules",
Remi NGUYEN VAN8ea5ee62021-06-28 18:48:43 +0900103 manifest: "AndroidManifest_coverage.xml",
104 visibility: [
105 "//packages/modules/Connectivity/tests:__subpackages__"
106 ],
107}
108
Remi NGUYEN VAN0015f042021-07-27 14:30:14 +0900109// Combine NetworkStack and Tethering jarjar rules for coverage target. The jarjar files are
110// simply concatenated in the order specified in srcs.
111genrule {
112 name: "TetheringCoverageJarJarRules",
113 srcs: [
114 ":TetheringTestsJarJarRules",
115 ":NetworkStackJarJarRules",
116 ],
117 out: ["jarjar-rules-tethering-coverage.txt"],
118 cmd: "cat $(in) > $(out)",
119 visibility: ["//visibility:private"],
120}
121
paulhu64632652020-04-06 14:58:12 +0800122// Special version of the tethering tests that includes all tests necessary for code coverage
123// purposes. This is currently the union of TetheringTests, TetheringIntegrationTests and
124// NetworkStackTests.
Remi NGUYEN VAN8ea5ee62021-06-28 18:48:43 +0900125// TODO: remove in favor of ConnectivityCoverageTests, which includes below tests and more
paulhu64632652020-04-06 14:58:12 +0800126android_test {
127 name: "TetheringCoverageTests",
paulhu64632652020-04-06 14:58:12 +0800128 platform_apis: true,
markchien7193a1b2021-04-27 01:50:31 +0800129 min_sdk_version: "30",
130 target_sdk_version: "30",
paulhu64632652020-04-06 14:58:12 +0800131 test_suites: ["device-tests", "mts"],
132 test_config: "AndroidTest_Coverage.xml",
133 defaults: ["libnetworkstackutilsjni_deps"],
134 static_libs: [
markchienb23e9122021-04-27 17:23:44 +0800135 "modules-utils-native-coverage-listener",
Remi NGUYEN VAN8ea5ee62021-06-28 18:48:43 +0900136 "TetheringCoverageTestsLib",
paulhu64632652020-04-06 14:58:12 +0800137 ],
138 jni_libs: [
139 // For mockito extended
140 "libdexmakerjvmtiagent",
141 "libstaticjvmtiagent",
142 // For NetworkStackUtils included in NetworkStackBase
143 "libnetworkstackutilsjni",
Maciej Żenczykowskic92e8ce2021-02-11 15:54:05 -0800144 "libtetherutilsjni",
paulhu64632652020-04-06 14:58:12 +0800145 ],
146 compile_multilib: "both",
147 manifest: "AndroidManifest_coverage.xml",
markchiene3126482020-10-26 13:53:05 +0800148}