From f33b6ea26108fcd1fca02d13318907c53ebc8c52 Mon Sep 17 00:00:00 2001 From: Remi NGUYEN VAN Date: Wed, 3 Jun 2020 16:10:43 +0900 Subject: [PATCH] Add CtsNetTestCasesLatestSdk to postsubmit Also exclude some tests that cannot run on cuttlefish. This is a first step to add the suite to presubmit. Having the test in presubmit is essential to avoid regressions and keep it passing. Bug: 158153057 Test: m CtsNetTestCases; this patch will provide postsubmit results Change-Id: I48b2b5490d3fd5eb6f9456825c11f3fee0ec5b67 --- tests/cts/net/Android.bp | 1 + tests/cts/net/TEST_MAPPING | 13 +++++++++++++ .../android/net/cts/ConnectivityManagerTest.java | 6 ++++++ tests/cts/net/src/android/net/cts/DnsTest.java | 3 +++ 4 files changed, 23 insertions(+) create mode 100644 tests/cts/net/TEST_MAPPING diff --git a/tests/cts/net/Android.bp b/tests/cts/net/Android.bp index 82b7413fbf..052ab263d2 100644 --- a/tests/cts/net/Android.bp +++ b/tests/cts/net/Android.bp @@ -82,6 +82,7 @@ android_test { min_sdk_version: "29", target_sdk_version: "29", test_suites: [ + "device-tests", "mts", ], test_config_template: "AndroidTestTemplate.xml", diff --git a/tests/cts/net/TEST_MAPPING b/tests/cts/net/TEST_MAPPING new file mode 100644 index 0000000000..e2a9c75778 --- /dev/null +++ b/tests/cts/net/TEST_MAPPING @@ -0,0 +1,13 @@ +{ + // TODO: move to mainline-presubmit once supported + "postsubmit": [ + { + "name": "CtsNetTestCasesLatestSdk", + "options": [ + { + "exclude-annotation": "com.android.testutils.SkipPresubmit" + } + ] + } + ] +} diff --git a/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java b/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java index d498ed9885..3880664827 100644 --- a/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java +++ b/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java @@ -96,6 +96,7 @@ import androidx.test.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; import com.android.internal.util.ArrayUtils; +import com.android.testutils.SkipPresubmit; import libcore.io.Streams; @@ -325,6 +326,7 @@ public class ConnectivityManagerTest { */ @AppModeFull(reason = "Cannot get WifiManager in instant app mode") @Test + @SkipPresubmit(reason = "Virtual devices use a single internet connection for all networks") public void testOpenConnection() throws Exception { boolean canRunTest = mPackageManager.hasSystemFeature(FEATURE_WIFI) && mPackageManager.hasSystemFeature(FEATURE_TELEPHONY); @@ -990,6 +992,7 @@ public class ConnectivityManagerTest { @AppModeFull(reason = "Cannot get WifiManager in instant app mode") @Test + @SkipPresubmit(reason = "Keepalive is not supported on virtual hardware") public void testCreateTcpKeepalive() throws Exception { if (!mPackageManager.hasSystemFeature(FEATURE_WIFI)) { Log.i(TAG, "testCreateTcpKeepalive cannot execute unless device supports WiFi"); @@ -1199,6 +1202,7 @@ public class ConnectivityManagerTest { */ @AppModeFull(reason = "Cannot get WifiManager in instant app mode") @Test + @SkipPresubmit(reason = "Keepalive is not supported on virtual hardware") public void testSocketKeepaliveLimitWifi() throws Exception { if (!mPackageManager.hasSystemFeature(FEATURE_WIFI)) { Log.i(TAG, "testSocketKeepaliveLimitWifi cannot execute unless device" @@ -1252,6 +1256,7 @@ public class ConnectivityManagerTest { */ @AppModeFull(reason = "Cannot request network in instant app mode") @Test + @SkipPresubmit(reason = "Keepalive is not supported on virtual hardware") public void testSocketKeepaliveLimitTelephony() throws Exception { if (!mPackageManager.hasSystemFeature(FEATURE_TELEPHONY)) { Log.i(TAG, "testSocketKeepaliveLimitTelephony cannot execute unless device" @@ -1294,6 +1299,7 @@ public class ConnectivityManagerTest { */ @AppModeFull(reason = "Cannot get WifiManager in instant app mode") @Test + @SkipPresubmit(reason = "Keepalive is not supported on virtual hardware") public void testSocketKeepaliveUnprivileged() throws Exception { if (!mPackageManager.hasSystemFeature(FEATURE_WIFI)) { Log.i(TAG, "testSocketKeepaliveUnprivileged cannot execute unless device" diff --git a/tests/cts/net/src/android/net/cts/DnsTest.java b/tests/cts/net/src/android/net/cts/DnsTest.java index 746dcb0a1c..fde27e9f12 100644 --- a/tests/cts/net/src/android/net/cts/DnsTest.java +++ b/tests/cts/net/src/android/net/cts/DnsTest.java @@ -27,6 +27,8 @@ import android.os.SystemClock; import android.test.AndroidTestCase; import android.util.Log; +import com.android.testutils.SkipPresubmit; + import java.net.Inet4Address; import java.net.Inet6Address; import java.net.InetAddress; @@ -68,6 +70,7 @@ public class DnsTest extends AndroidTestCase { * Perf - measure size of first and second tier caches and their effect * Assert requires network permission */ + @SkipPresubmit(reason = "IPv6 support may be missing on presubmit virtual hardware") public void testDnsWorks() throws Exception { ensureIpv6Connectivity();