Add TetheringCoverageTests
Bug: 148636687
Test: atest TetheringCoverageTests
atest TetheringTests
atest TetheringIntegrationTests
atest NetworkStackTests
atest CtsTetheringTest
Change-Id: I1f2a50f16894b05e988476520ba25baba0b60d88
Merged-In: I1f2a50f16894b05e988476520ba25baba0b60d88
This commit is contained in:
@@ -13,19 +13,12 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
java_defaults {
|
||||||
android_test {
|
name: "TetheringIntegrationTestsDefaults",
|
||||||
name: "TetheringIntegrationTests",
|
|
||||||
certificate: "platform",
|
|
||||||
platform_apis: true,
|
|
||||||
srcs: [
|
srcs: [
|
||||||
"src/**/*.java",
|
"src/**/*.java",
|
||||||
"src/**/*.kt",
|
"src/**/*.kt",
|
||||||
],
|
],
|
||||||
test_suites: [
|
|
||||||
"device-tests",
|
|
||||||
"mts",
|
|
||||||
],
|
|
||||||
static_libs: [
|
static_libs: [
|
||||||
"NetworkStackApiStableLib",
|
"NetworkStackApiStableLib",
|
||||||
"androidx.test.rules",
|
"androidx.test.rules",
|
||||||
@@ -44,4 +37,49 @@ android_test {
|
|||||||
"libdexmakerjvmtiagent",
|
"libdexmakerjvmtiagent",
|
||||||
"libstaticjvmtiagent",
|
"libstaticjvmtiagent",
|
||||||
],
|
],
|
||||||
|
jarjar_rules: ":NetworkStackJarJarRules",
|
||||||
|
}
|
||||||
|
|
||||||
|
android_library {
|
||||||
|
name: "TetheringIntegrationTestsLib",
|
||||||
|
platform_apis: true,
|
||||||
|
defaults: ["TetheringIntegrationTestsDefaults"],
|
||||||
|
visibility: ["//cts/tests/tests/tethering"]
|
||||||
|
}
|
||||||
|
|
||||||
|
android_test {
|
||||||
|
name: "TetheringIntegrationTests",
|
||||||
|
platform_apis: true,
|
||||||
|
defaults: ["TetheringIntegrationTestsDefaults"],
|
||||||
|
test_suites: [
|
||||||
|
"device-tests",
|
||||||
|
"mts",
|
||||||
|
],
|
||||||
|
compile_multilib: "both",
|
||||||
|
}
|
||||||
|
|
||||||
|
// Special version of the tethering tests that includes all tests necessary for code coverage
|
||||||
|
// purposes. This is currently the union of TetheringTests, TetheringIntegrationTests and
|
||||||
|
// NetworkStackTests.
|
||||||
|
android_test {
|
||||||
|
name: "TetheringCoverageTests",
|
||||||
|
certificate: "platform",
|
||||||
|
platform_apis: true,
|
||||||
|
test_suites: ["device-tests", "mts"],
|
||||||
|
test_config: "AndroidTest_Coverage.xml",
|
||||||
|
defaults: ["libnetworkstackutilsjni_deps"],
|
||||||
|
static_libs: [
|
||||||
|
"NetworkStackTestsLib",
|
||||||
|
"TetheringTestsLib",
|
||||||
|
"TetheringIntegrationTestsLib",
|
||||||
|
],
|
||||||
|
jni_libs: [
|
||||||
|
// For mockito extended
|
||||||
|
"libdexmakerjvmtiagent",
|
||||||
|
"libstaticjvmtiagent",
|
||||||
|
// For NetworkStackUtils included in NetworkStackBase
|
||||||
|
"libnetworkstackutilsjni",
|
||||||
|
],
|
||||||
|
compile_multilib: "both",
|
||||||
|
manifest: "AndroidManifest_coverage.xml",
|
||||||
}
|
}
|
||||||
@@ -17,7 +17,6 @@
|
|||||||
package="com.android.networkstack.tethering.tests.integration">
|
package="com.android.networkstack.tethering.tests.integration">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
<uses-permission android:name="android.permission.TETHER_PRIVILEGED"/>
|
|
||||||
|
|
||||||
<application android:debuggable="true">
|
<application android:debuggable="true">
|
||||||
<uses-library android:name="android.test.runner" />
|
<uses-library android:name="android.test.runner" />
|
||||||
|
|||||||
29
Tethering/tests/integration/AndroidManifest_coverage.xml
Normal file
29
Tethering/tests/integration/AndroidManifest_coverage.xml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2020 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
package="com.android.networkstack.tethering.tests.coverage">
|
||||||
|
|
||||||
|
<application tools:replace="android:label"
|
||||||
|
android:debuggable="true"
|
||||||
|
android:label="Tethering coverage tests">
|
||||||
|
<uses-library android:name="android.test.runner" />
|
||||||
|
</application>
|
||||||
|
<instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
android:targetPackage="com.android.networkstack.tethering.tests.coverage"
|
||||||
|
android:label="Tethering coverage tests">
|
||||||
|
</instrumentation>
|
||||||
|
</manifest>
|
||||||
12
Tethering/tests/integration/AndroidTest_Coverage.xml
Normal file
12
Tethering/tests/integration/AndroidTest_Coverage.xml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<configuration description="Runs coverage tests for Tethering">
|
||||||
|
<target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup">
|
||||||
|
<option name="test-file-name" value="TetheringCoverageTests.apk" />
|
||||||
|
</target_preparer>
|
||||||
|
|
||||||
|
<option name="test-tag" value="TetheringCoverageTests" />
|
||||||
|
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
|
||||||
|
<option name="package" value="com.android.networkstack.tethering.tests.coverage" />
|
||||||
|
<option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
|
||||||
|
<option name="hidden-api-checks" value="false"/>
|
||||||
|
</test>
|
||||||
|
</configuration>
|
||||||
@@ -18,6 +18,7 @@ package android.net;
|
|||||||
|
|
||||||
import static android.Manifest.permission.MANAGE_TEST_NETWORKS;
|
import static android.Manifest.permission.MANAGE_TEST_NETWORKS;
|
||||||
import static android.Manifest.permission.NETWORK_SETTINGS;
|
import static android.Manifest.permission.NETWORK_SETTINGS;
|
||||||
|
import static android.Manifest.permission.TETHER_PRIVILEGED;
|
||||||
import static android.net.TetheringManager.TETHERING_ETHERNET;
|
import static android.net.TetheringManager.TETHERING_ETHERNET;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
@@ -109,7 +110,8 @@ public class EthernetTetheringTest {
|
|||||||
mTetheredInterfaceRequester = new TetheredInterfaceRequester(mHandler, mEm);
|
mTetheredInterfaceRequester = new TetheredInterfaceRequester(mHandler, mEm);
|
||||||
// Needed to create a TestNetworkInterface, to call requestTetheredInterface, and to receive
|
// Needed to create a TestNetworkInterface, to call requestTetheredInterface, and to receive
|
||||||
// tethered client callbacks.
|
// tethered client callbacks.
|
||||||
mUiAutomation.adoptShellPermissionIdentity(MANAGE_TEST_NETWORKS, NETWORK_SETTINGS);
|
mUiAutomation.adoptShellPermissionIdentity(
|
||||||
|
MANAGE_TEST_NETWORKS, NETWORK_SETTINGS, TETHER_PRIVILEGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cleanUp() throws Exception {
|
private void cleanUp() throws Exception {
|
||||||
|
|||||||
@@ -14,36 +14,30 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
|
||||||
android_test {
|
java_defaults {
|
||||||
name: "TetheringTests",
|
name: "TetheringTestsDefaults",
|
||||||
certificate: "platform",
|
|
||||||
srcs: [
|
srcs: [
|
||||||
"src/**/*.java",
|
"src/**/*.java",
|
||||||
"src/**/*.kt",
|
"src/**/*.kt",
|
||||||
],
|
],
|
||||||
test_suites: [
|
|
||||||
"device-tests",
|
|
||||||
"mts",
|
|
||||||
],
|
|
||||||
compile_multilib: "both",
|
|
||||||
static_libs: [
|
static_libs: [
|
||||||
|
"TetheringApiCurrentLib",
|
||||||
"androidx.test.rules",
|
"androidx.test.rules",
|
||||||
"frameworks-base-testutils",
|
"frameworks-base-testutils",
|
||||||
"net-tests-utils",
|
|
||||||
"mockito-target-extended-minus-junit4",
|
"mockito-target-extended-minus-junit4",
|
||||||
"TetheringApiCurrentLib",
|
"net-tests-utils",
|
||||||
"testables",
|
"testables",
|
||||||
],
|
],
|
||||||
// TODO(b/147200698) change sdk_version to module-current and
|
// TODO(b/147200698) change sdk_version to module-current and
|
||||||
// remove framework-minus-apex, ext, and framework-res
|
// remove framework-minus-apex, ext, and framework-res
|
||||||
sdk_version: "core_platform",
|
sdk_version: "core_platform",
|
||||||
libs: [
|
libs: [
|
||||||
"framework-minus-apex",
|
|
||||||
"ext",
|
|
||||||
"framework-res",
|
|
||||||
"android.test.runner",
|
"android.test.runner",
|
||||||
"android.test.base",
|
"android.test.base",
|
||||||
"android.test.mock",
|
"android.test.mock",
|
||||||
|
"ext",
|
||||||
|
"framework-minus-apex",
|
||||||
|
"framework-res",
|
||||||
"framework-tethering",
|
"framework-tethering",
|
||||||
],
|
],
|
||||||
jni_libs: [
|
jni_libs: [
|
||||||
@@ -53,3 +47,25 @@ android_test {
|
|||||||
],
|
],
|
||||||
jarjar_rules: "jarjar-rules.txt",
|
jarjar_rules: "jarjar-rules.txt",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Library containing the unit tests. This is used by the coverage test target to pull in the
|
||||||
|
// unit test code. It is not currently used by the tests themselves because all the build
|
||||||
|
// configuration needed by the tests is in the TetheringTestsDefaults rule.
|
||||||
|
android_library {
|
||||||
|
name: "TetheringTestsLib",
|
||||||
|
defaults: ["TetheringTestsDefaults"],
|
||||||
|
visibility: [
|
||||||
|
"//frameworks/base/packages/Tethering/tests/integration",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
android_test {
|
||||||
|
name: "TetheringTests",
|
||||||
|
certificate: "platform",
|
||||||
|
test_suites: [
|
||||||
|
"device-tests",
|
||||||
|
"mts",
|
||||||
|
],
|
||||||
|
defaults: ["TetheringTestsDefaults"],
|
||||||
|
compile_multilib: "both",
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user