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
This commit is contained in:
Handa Wang 2024-01-17 10:00:52 +08:00
commit d5e2ac94d1
2 changed files with 11 additions and 0 deletions

View file

@ -18,6 +18,7 @@ package android.net.thread;
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 com.google.common.io.BaseEncoding.base16;
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 @@ public class BorderRoutingTest {
@Test
public void infraDevicePingTheadDeviceOmr_Succeeds() throws Exception {
assumeTrue(isSimulatedThreadRadioSupported());
/*
* <pre>
* Topology:

View file

@ -25,6 +25,7 @@ import static com.google.common.util.concurrent.MoreExecutors.directExecutor;
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 @@ import java.util.function.Supplier;
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.
*