Ensure the Thread integration test only run on CuttleFish devices
This is because the test case relies on **simulation** Thread radio, which is currently only available on CuttleFish.
Bug: 295843010
Test: atest android.net.thread.BorderRoutingTest
Change-Id: Icd29d91c9ec9912e27191e97fe7f58e9067c1d8c
diff --git a/thread/tests/integration/src/android/net/thread/BorderRoutingTest.java b/thread/tests/integration/src/android/net/thread/BorderRoutingTest.java
index 5d3818a..ba7e4b8 100644
--- a/thread/tests/integration/src/android/net/thread/BorderRoutingTest.java
+++ b/thread/tests/integration/src/android/net/thread/BorderRoutingTest.java
@@ -18,6 +18,7 @@
import static android.Manifest.permission.MANAGE_TEST_NETWORKS;
import static android.net.thread.IntegrationTestUtils.isExpectedIcmpv6Packet;
+import static android.net.thread.IntegrationTestUtils.isSimulatedThreadRadioSupported;
import static android.net.thread.IntegrationTestUtils.newPacketReader;
import static android.net.thread.IntegrationTestUtils.readPacketFrom;
import static android.net.thread.IntegrationTestUtils.waitFor;
@@ -33,6 +34,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assume.assumeTrue;
import android.content.Context;
import android.net.LinkProperties;
@@ -131,6 +133,8 @@
@Test
public void infraDevicePingTheadDeviceOmr_Succeeds() throws Exception {
+ assumeTrue(isSimulatedThreadRadioSupported());
+
/*
* <pre>
* Topology:
diff --git a/thread/tests/integration/src/android/net/thread/IntegrationTestUtils.java b/thread/tests/integration/src/android/net/thread/IntegrationTestUtils.java
index 9d9a4ff..c465d57 100644
--- a/thread/tests/integration/src/android/net/thread/IntegrationTestUtils.java
+++ b/thread/tests/integration/src/android/net/thread/IntegrationTestUtils.java
@@ -25,6 +25,7 @@
import android.net.TestNetworkInterface;
import android.os.Handler;
import android.os.SystemClock;
+import android.os.SystemProperties;
import com.android.net.module.util.Struct;
import com.android.net.module.util.structs.Icmpv6Header;
@@ -50,6 +51,12 @@
public final class IntegrationTestUtils {
private IntegrationTestUtils() {}
+ /** Returns whether the device supports simulated Thread radio. */
+ public static boolean isSimulatedThreadRadioSupported() {
+ // The integration test uses SIMULATION Thread radio so that it only supports CuttleFish.
+ return SystemProperties.get("ro.product.model").startsWith("Cuttlefish");
+ }
+
/**
* Waits for the given {@link Supplier} to be true until given timeout.
*