Add NetHttpCoverageTests to mainline presubmit

Mainline presubmit runs on older images. So we need to set:
- min_sdk_version to the minimum sdk we support otherwise
it would default to current
- enforce_default_target_sdk_version since mainline needs
all modules to target the latest sdk

Test: presubmit
Bug: 263294440
Change-Id: I20757b13ab9ab45908dae088c6cb6b0bbc51989d
This commit is contained in:
Chidera Olibie
2023-01-24 20:22:56 +00:00
parent 6477d7b697
commit d66799a20c
7 changed files with 18 additions and 3 deletions

View File

@@ -27,7 +27,9 @@ package {
android_test { android_test {
name: "NetHttpCoverageTests", name: "NetHttpCoverageTests",
defaults: ["CronetTestJavaDefaults"], defaults: ["CronetTestJavaDefaults"],
enforce_default_target_sdk_version: true,
sdk_version: "test_current", sdk_version: "test_current",
min_sdk_version: "30",
test_suites: ["general-tests", "mts-tethering"], test_suites: ["general-tests", "mts-tethering"],
static_libs: [ static_libs: [
"modules-utils-native-coverage-listener", "modules-utils-native-coverage-listener",

View File

@@ -18,6 +18,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="com.android.net.http.tests.coverage"> package="com.android.net.http.tests.coverage">
<!-- NetHttpCoverageTests combines CtsNetHttpTestCases and NetHttpTests targets, <!-- NetHttpCoverageTests combines CtsNetHttpTestCases and NetHttpTests targets,
so permissions and others are declared in their respective manifests --> so permissions and others are declared in their respective manifests -->
<application tools:replace="android:label" <application tools:replace="android:label"

View File

@@ -20,8 +20,11 @@
</target_preparer> </target_preparer>
<option name="test-tag" value="NetHttpCoverageTests" /> <option name="test-tag" value="NetHttpCoverageTests" />
<!-- Tethering/Connectivity is a SDK 30+ module --> <!-- Tethering/Connectivity is a SDK 30+ module -->
<!-- TODO Switch back to Sdk30 when b/270049141 is fixed -->
<object type="module_controller" <object type="module_controller"
class="com.android.tradefed.testtype.suite.module.Sdk30ModuleController" /> class="com.android.tradefed.testtype.suite.module.Sdk31ModuleController" />
<option name="config-descriptor:metadata" key="mainline-param"
value="CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex+com.google.android.tethering.apex" />
<test class="com.android.tradefed.testtype.AndroidJUnitTest" > <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
<option name="package" value="com.android.net.http.tests.coverage" /> <option name="package" value="com.android.net.http.tests.coverage" />
<option name="runner" value="androidx.test.runner.AndroidJUnitRunner" /> <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />

View File

@@ -44,6 +44,7 @@ java_defaults {
android_library { android_library {
name: "CtsNetHttpTestsLib", name: "CtsNetHttpTestsLib",
sdk_version: "test_current", sdk_version: "test_current",
min_sdk_version: "30",
srcs: [ srcs: [
"src/**/*.java", "src/**/*.java",
"src/**/*.kt", "src/**/*.kt",
@@ -62,6 +63,7 @@ android_library {
"framework-tethering", "framework-tethering",
"org.apache.http.legacy", "org.apache.http.legacy",
], ],
lint: { test: true }
} }
android_test { android_test {

View File

@@ -20,6 +20,8 @@ package {
android_library { android_library {
name: "NetHttpTestsLibPreJarJar", name: "NetHttpTestsLibPreJarJar",
srcs: [":cronet_aml_javatests_sources"], srcs: [":cronet_aml_javatests_sources"],
sdk_version: "test_current",
min_sdk_version: "30",
static_libs: [ static_libs: [
"androidx.test.ext.junit", "androidx.test.ext.junit",
"androidx.test.rules", "androidx.test.rules",
@@ -28,7 +30,8 @@ android_library {
libs: [ libs: [
"android.test.base", "android.test.base",
"framework-tethering-pre-jarjar", "framework-tethering-pre-jarjar",
] ],
lint: { test: true }
} }
android_test { android_test {

View File

@@ -16,8 +16,9 @@
--> -->
<configuration description="Runs NetHttp Mainline Tests."> <configuration description="Runs NetHttp Mainline Tests.">
<!-- Only run tests if the device under test is SDK version 30 or above. --> <!-- Only run tests if the device under test is SDK version 30 or above. -->
<!-- TODO Switch back to Sdk30 when b/270049141 is fixed -->
<object type="module_controller" <object type="module_controller"
class="com.android.tradefed.testtype.suite.module.Sdk30ModuleController" /> class="com.android.tradefed.testtype.suite.module.Sdk31ModuleController" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="test-file-name" value="NetHttpTests.apk" /> <option name="test-file-name" value="NetHttpTests.apk" />

View File

@@ -213,6 +213,9 @@
}, },
{ {
"name": "libnetworkstats_test[CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex+com.google.android.tethering.apex]" "name": "libnetworkstats_test[CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex+com.google.android.tethering.apex]"
},
{
"name": "NetHttpCoverageTests[CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex+com.google.android.tethering.apex]"
} }
], ],
"mainline-postsubmit": [ "mainline-postsubmit": [