From 73da478927f39da89335e0ee54d8eb482b98e5cd Mon Sep 17 00:00:00 2001 From: Remi NGUYEN VAN Date: Wed, 16 Feb 2022 20:34:31 +0900 Subject: [PATCH] Cleanup and refine connectivity test config Remove the include for Connectivity/Tethering TEST_MAPPING as there is no such file in that directory, add comments on ConnectivityModuleTest usage, and skip the whole NetworkAgentTest on non-connectivity module MTS runs. Bug: 218611855 Test: atest CtsNetTestCasesLatestSdk Change-Id: Id96ab8a5ae631b0c64f20faedd4a0430eb9318d4 --- TEST_MAPPING | 8 ++++---- .../cts/net/src/android/net/cts/IpConfigurationTest.java | 6 +++++- tests/cts/net/src/android/net/cts/NetworkAgentTest.kt | 5 ++++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/TEST_MAPPING b/TEST_MAPPING index 1b2c0ed58c..b1e6a9fca4 100644 --- a/TEST_MAPPING +++ b/TEST_MAPPING @@ -111,7 +111,10 @@ ] }, // TODO: move to mainline-presubmit when known green. - // Test with connectivity/tethering module only, to catch integration issues with older versions of other modules + // Test with connectivity/tethering module only, to catch integration issues with older versions of other modules. + // "new tethering + old NetworkStack" is not a configuration that should really exist in the field, but + // there is no strong guarantee, and it is required by MTS testing for module qualification, where modules + // are tested independently. { "name": "CtsNetTestCasesLatestSdk[com.google.android.tethering.apex]", "options": [ @@ -160,9 +163,6 @@ }, { "path": "packages/modules/CaptivePortalLogin" - }, - { - "path": "packages/modules/Connectivity/Tethering" } ] } diff --git a/tests/cts/net/src/android/net/cts/IpConfigurationTest.java b/tests/cts/net/src/android/net/cts/IpConfigurationTest.java index 23744eb34f..1d19d26bca 100644 --- a/tests/cts/net/src/android/net/cts/IpConfigurationTest.java +++ b/tests/cts/net/src/android/net/cts/IpConfigurationTest.java @@ -107,7 +107,11 @@ public final class IpConfigurationTest { assertIpConfigurationEqual(ipConfig, new IpConfiguration(ipConfig)); } - @ConnectivityModuleTest @DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.R) + @ConnectivityModuleTest // The builder was added in an S+ module update. + // This whole class is not skipped (marked @ConnectivityModuleTest) in MTS for non-connectivity + // modules like NetworkStack, as NetworkStack uses IpConfiguration a lot on Q+, so tests that + // cover older APIs are still useful to provide used API coverage for NetworkStack. + @DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.R) @Test public void testBuilder() { final IpConfiguration c = new IpConfiguration.Builder() diff --git a/tests/cts/net/src/android/net/cts/NetworkAgentTest.kt b/tests/cts/net/src/android/net/cts/NetworkAgentTest.kt index bf973393c6..810d1c6c3d 100644 --- a/tests/cts/net/src/android/net/cts/NetworkAgentTest.kt +++ b/tests/cts/net/src/android/net/cts/NetworkAgentTest.kt @@ -154,6 +154,10 @@ private fun Message(what: Int, arg1: Int, arg2: Int, obj: Any?) = Message.obtain // NetworkAgent is not updatable in R-, so this test does not need to be compatible with older // versions. NetworkAgent was also based on AsyncChannel before S so cannot be tested the same way. @IgnoreUpTo(Build.VERSION_CODES.R) +// NetworkAgent is updated as part of the connectivity module, and running NetworkAgent tests in MTS +// for modules other than Connectivity does not provide much value. Only run them in connectivity +// module MTS, so the tests only need to cover the case of an updated NetworkAgent. +@ConnectivityModuleTest class NetworkAgentTest { private val LOCAL_IPV4_ADDRESS = InetAddresses.parseNumericAddress("192.0.2.1") private val REMOTE_IPV4_ADDRESS = InetAddresses.parseNumericAddress("192.0.2.2") @@ -466,7 +470,6 @@ class NetworkAgentTest { .addTransportType(TRANSPORT_TEST) .setAccessUids(uids.toSet()).build() - @ConnectivityModuleTest // Functionality was added post-S via connectivity module update @Test fun testRejectedUpdates() { val callback = TestableNetworkCallback()