Create CtsNetTestCasesMaxTargetSdk31.

This APK will only run tests that require target SDK 31 or below.

Bug: 233553525
Test: test-only change
Change-Id: Ia86187de50107748d8053194d3f7a55b7947412e
This commit is contained in:
Lorenzo Colitti
2022-05-28 00:20:06 +09:00
parent 875daa69eb
commit 9e61b82404
3 changed files with 66 additions and 9 deletions

View File

@@ -34,6 +34,18 @@
}
]
},
// CTS tests that target older SDKs.
{
"name": "CtsNetTestCasesMaxTargetSdk31",
"options": [
{
"exclude-annotation": "com.android.testutils.SkipPresubmit"
},
{
"exclude-annotation": "androidx.test.filters.RequiresDevice"
}
]
},
{
"name": "bpf_existence_test"
},
@@ -90,6 +102,17 @@
}
]
},
{
"name": "CtsNetTestCasesMaxTargetSdk31[CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex+com.google.android.tethering.apex]",
"options": [
{
"exclude-annotation": "com.android.testutils.SkipPresubmit"
},
{
"exclude-annotation": "androidx.test.filters.RequiresDevice"
}
]
},
{
"name": "bpf_existence_test[CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex+com.google.android.tethering.apex]"
},

View File

@@ -62,6 +62,7 @@ java_defaults {
// sdk_version: "current",
platform_apis: true,
required: ["ConnectivityChecker"],
test_config_template: "AndroidTestTemplate.xml",
}
// Networking CTS tests for development and release. These tests always target the platform SDK
@@ -79,7 +80,16 @@ android_test {
"cts",
"general-tests",
],
test_config_template: "AndroidTestTemplate.xml",
}
java_defaults {
name: "CtsNetTestCasesApiStableDefaults",
// TODO: CTS should not depend on the entirety of the networkstack code.
static_libs: [
"NetworkStackApiStableLib",
],
jni_uses_sdk_apis: true,
min_sdk_version: "29",
}
// Networking CTS tests that target the latest released SDK. These tests can be installed on release
@@ -87,13 +97,10 @@ android_test {
// on release devices.
android_test {
name: "CtsNetTestCasesLatestSdk",
defaults: ["CtsNetTestCasesDefaults"],
// TODO: CTS should not depend on the entirety of the networkstack code.
static_libs: [
"NetworkStackApiStableLib",
defaults: [
"CtsNetTestCasesDefaults",
"CtsNetTestCasesApiStableDefaults",
],
jni_uses_sdk_apis: true,
min_sdk_version: "29",
target_sdk_version: "33",
test_suites: [
"general-tests",
@@ -102,5 +109,21 @@ android_test {
"mts-tethering",
"mts-wifi",
],
test_config_template: "AndroidTestTemplate.xml",
}
android_test {
name: "CtsNetTestCasesMaxTargetSdk31", // Must match CtsNetTestCasesMaxTargetSdk31 annotation.
defaults: [
"CtsNetTestCasesDefaults",
"CtsNetTestCasesApiStableDefaults",
],
target_sdk_version: "31",
package_name: "android.net.cts.maxtargetsdk31", // CTS package names must be unique.
instrumentation_target_package: "android.net.cts.maxtargetsdk31",
test_suites: [
"cts",
"general-tests",
"mts-networking",
],
}

View File

@@ -33,10 +33,21 @@
<target_preparer class="com.android.testutils.DisableConfigSyncTargetPreparer">
</target_preparer>
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
<option name="package" value="android.net.cts" />
<option name="package" value="{PACKAGE}" />
<option name="runtime-hint" value="9m4s" />
<option name="hidden-api-checks" value="false" />
<option name="isolated-storage" value="false" />
<!-- Test filter that allows test APKs to select which tests they want to run by annotating
those tests with an annotation matching the name of the APK.
This allows us to maintain one AndroidTestTemplate.xml for all CtsNetTestCases*.apk,
and have CtsNetTestCases and CtsNetTestCasesLatestSdk run all tests, but have
CtsNetTestCasesMaxTargetSdk31 run only tests that require target SDK 31.
This relies on the fact that if the class specified in include-annotation exists, then
the runner will only run the tests annotated with that annotation, but if it does not,
the runner will run all the tests. -->
<option name="include-annotation" value="com.android.testutils.filters.{MODULE}" />
</test>
<!-- When this test is run in a Mainline context (e.g. with `mts-tradefed`), only enable it if
one of the Mainline modules below is present on the device used for testing. -->