Lorenzo Colitti | 4896e32 | 2020-03-17 01:07:47 +0900 | [diff] [blame] | 1 | // |
| 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 Badour | 97e6be2 | 2021-02-12 14:45:04 -0800 | [diff] [blame] | 16 | package { |
| 17 | default_applicable_licenses: ["Android-Apache-2.0"], |
| 18 | } |
| 19 | |
paulhu | 6463265 | 2020-04-06 14:58:12 +0800 | [diff] [blame] | 20 | java_defaults { |
| 21 | name: "TetheringIntegrationTestsDefaults", |
Lorenzo Colitti | 4896e32 | 2020-03-17 01:07:47 +0900 | [diff] [blame] | 22 | srcs: [ |
| 23 | "src/**/*.java", |
| 24 | "src/**/*.kt", |
| 25 | ], |
markchien | 7193a1b | 2021-04-27 01:50:31 +0800 | [diff] [blame] | 26 | min_sdk_version: "30", |
Lorenzo Colitti | 4896e32 | 2020-03-17 01:07:47 +0900 | [diff] [blame] | 27 | static_libs: [ |
| 28 | "NetworkStackApiStableLib", |
| 29 | "androidx.test.rules", |
Lorenzo Colitti | 4896e32 | 2020-03-17 01:07:47 +0900 | [diff] [blame] | 30 | "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 | ], |
paulhu | d584d2f | 2020-04-08 09:57:57 +0800 | [diff] [blame] | 39 | jni_libs: [ |
| 40 | // For mockito extended |
| 41 | "libdexmakerjvmtiagent", |
| 42 | "libstaticjvmtiagent", |
| 43 | ], |
Lorenzo Colitti | 4896e32 | 2020-03-17 01:07:47 +0900 | [diff] [blame] | 44 | } |
paulhu | 6463265 | 2020-04-06 14:58:12 +0800 | [diff] [blame] | 45 | |
Remi NGUYEN VAN | 0015f04 | 2021-07-27 14:30:14 +0900 | [diff] [blame] | 46 | // Library including tethering integration tests targeting the latest stable SDK. |
| 47 | // Use with NetworkStackJarJarRules. |
paulhu | 6463265 | 2020-04-06 14:58:12 +0800 | [diff] [blame] | 48 | android_library { |
markchien | 7193a1b | 2021-04-27 01:50:31 +0800 | [diff] [blame] | 49 | name: "TetheringIntegrationTestsLatestSdkLib", |
| 50 | target_sdk_version: "30", |
paulhu | 6463265 | 2020-04-06 14:58:12 +0800 | [diff] [blame] | 51 | platform_apis: true, |
| 52 | defaults: ["TetheringIntegrationTestsDefaults"], |
Baligh Uddin | 661ae39 | 2020-11-04 05:34:06 +0000 | [diff] [blame] | 53 | visibility: [ |
Baligh Uddin | 661ae39 | 2020-11-04 05:34:06 +0000 | [diff] [blame] | 54 | "//packages/modules/Connectivity/tests/cts/tethering", |
Remi NGUYEN VAN | fe20e13 | 2021-06-07 13:10:49 +0900 | [diff] [blame] | 55 | "//packages/modules/Connectivity/tests:__subpackages__", |
| 56 | "//packages/modules/Connectivity/Tethering/tests:__subpackages__", |
markchien | 7193a1b | 2021-04-27 01:50:31 +0800 | [diff] [blame] | 57 | ] |
| 58 | } |
| 59 | |
Remi NGUYEN VAN | 0015f04 | 2021-07-27 14:30:14 +0900 | [diff] [blame] | 60 | // Library including tethering integration tests targeting current development SDK. |
| 61 | // Use with NetworkStackJarJarRules. |
markchien | 7193a1b | 2021-04-27 01:50:31 +0800 | [diff] [blame] | 62 | android_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 Uddin | 661ae39 | 2020-11-04 05:34:06 +0000 | [diff] [blame] | 70 | ] |
paulhu | 6463265 | 2020-04-06 14:58:12 +0800 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | android_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 VAN | 0015f04 | 2021-07-27 14:30:14 +0900 | [diff] [blame] | 82 | jarjar_rules: ":NetworkStackJarJarRules", |
paulhu | 6463265 | 2020-04-06 14:58:12 +0800 | [diff] [blame] | 83 | } |
| 84 | |
Remi NGUYEN VAN | 8ea5ee6 | 2021-06-28 18:48:43 +0900 | [diff] [blame] | 85 | android_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 VAN | 0015f04 | 2021-07-27 14:30:14 +0900 | [diff] [blame] | 95 | // 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 VAN | 8ea5ee6 | 2021-06-28 18:48:43 +0900 | [diff] [blame] | 103 | manifest: "AndroidManifest_coverage.xml", |
| 104 | visibility: [ |
| 105 | "//packages/modules/Connectivity/tests:__subpackages__" |
| 106 | ], |
| 107 | } |
| 108 | |
Remi NGUYEN VAN | 0015f04 | 2021-07-27 14:30:14 +0900 | [diff] [blame] | 109 | // Combine NetworkStack and Tethering jarjar rules for coverage target. The jarjar files are |
| 110 | // simply concatenated in the order specified in srcs. |
| 111 | genrule { |
| 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 | |
paulhu | 6463265 | 2020-04-06 14:58:12 +0800 | [diff] [blame] | 122 | // 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 VAN | 8ea5ee6 | 2021-06-28 18:48:43 +0900 | [diff] [blame] | 125 | // TODO: remove in favor of ConnectivityCoverageTests, which includes below tests and more |
paulhu | 6463265 | 2020-04-06 14:58:12 +0800 | [diff] [blame] | 126 | android_test { |
| 127 | name: "TetheringCoverageTests", |
paulhu | 6463265 | 2020-04-06 14:58:12 +0800 | [diff] [blame] | 128 | platform_apis: true, |
markchien | 7193a1b | 2021-04-27 01:50:31 +0800 | [diff] [blame] | 129 | min_sdk_version: "30", |
| 130 | target_sdk_version: "30", |
paulhu | 6463265 | 2020-04-06 14:58:12 +0800 | [diff] [blame] | 131 | test_suites: ["device-tests", "mts"], |
| 132 | test_config: "AndroidTest_Coverage.xml", |
| 133 | defaults: ["libnetworkstackutilsjni_deps"], |
| 134 | static_libs: [ |
markchien | b23e912 | 2021-04-27 17:23:44 +0800 | [diff] [blame] | 135 | "modules-utils-native-coverage-listener", |
Remi NGUYEN VAN | 8ea5ee6 | 2021-06-28 18:48:43 +0900 | [diff] [blame] | 136 | "TetheringCoverageTestsLib", |
paulhu | 6463265 | 2020-04-06 14:58:12 +0800 | [diff] [blame] | 137 | ], |
| 138 | jni_libs: [ |
| 139 | // For mockito extended |
| 140 | "libdexmakerjvmtiagent", |
| 141 | "libstaticjvmtiagent", |
| 142 | // For NetworkStackUtils included in NetworkStackBase |
| 143 | "libnetworkstackutilsjni", |
Maciej Żenczykowski | c92e8ce | 2021-02-11 15:54:05 -0800 | [diff] [blame] | 144 | "libtetherutilsjni", |
paulhu | 6463265 | 2020-04-06 14:58:12 +0800 | [diff] [blame] | 145 | ], |
| 146 | compile_multilib: "both", |
| 147 | manifest: "AndroidManifest_coverage.xml", |
markchien | e312648 | 2020-10-26 13:53:05 +0800 | [diff] [blame] | 148 | } |