skip the country code test when the country code is not support
Setting country code is not a must support feature on all platforms.
This commit skips the country code related tests when the platform
doesn't support setting the country code.
Bug: b/401793629
Test: atest ThreadNetworkIntegrationTests
Change-Id: I6bb8444f70afb2635d7791af2128741bc02e8ff3
diff --git a/thread/tests/integration/src/android/net/thread/ThreadIntegrationTest.java b/thread/tests/integration/src/android/net/thread/ThreadIntegrationTest.java
index d41550b..8594518 100644
--- a/thread/tests/integration/src/android/net/thread/ThreadIntegrationTest.java
+++ b/thread/tests/integration/src/android/net/thread/ThreadIntegrationTest.java
@@ -40,6 +40,8 @@
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
+import static org.junit.Assume.assumeTrue;
+
import static java.util.concurrent.TimeUnit.SECONDS;
import android.content.Context;
@@ -216,6 +218,8 @@
@Test
public void otDaemonRestart_latestCountryCodeIsSetToOtDaemon() throws Exception {
+ assumeTrue(mOtCtl.isCountryCodeSupported());
+
runThreadCommand("force-country-code enabled CN");
runShellCommand("stop ot-daemon");
diff --git a/thread/tests/integration/src/android/net/thread/ThreadNetworkShellCommandTest.java b/thread/tests/integration/src/android/net/thread/ThreadNetworkShellCommandTest.java
index 2f0ab34..5f0a176 100644
--- a/thread/tests/integration/src/android/net/thread/ThreadNetworkShellCommandTest.java
+++ b/thread/tests/integration/src/android/net/thread/ThreadNetworkShellCommandTest.java
@@ -28,6 +28,7 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThrows;
+import static org.junit.Assume.assumeTrue;
import android.content.Context;
import android.net.thread.utils.FullThreadDevice;
@@ -143,6 +144,8 @@
@Test
public void forceCountryCode_setCN_getCountryCodeReturnsCN() {
+ assumeTrue(mOtCtl.isCountryCodeSupported());
+
runThreadCommand("force-country-code enabled CN");
final String result = runThreadCommand("get-country-code");
diff --git a/thread/tests/integration/src/android/net/thread/utils/OtDaemonController.java b/thread/tests/integration/src/android/net/thread/utils/OtDaemonController.java
index 9fbfa45..272685f 100644
--- a/thread/tests/integration/src/android/net/thread/utils/OtDaemonController.java
+++ b/thread/tests/integration/src/android/net/thread/utils/OtDaemonController.java
@@ -156,6 +156,12 @@
return executeCommandAndParse("extpanid").get(0);
}
+ public boolean isCountryCodeSupported() {
+ final String result = executeCommand("region");
+
+ return !result.equals("Error 12: NotImplemented\r\n");
+ }
+
public String executeCommand(String cmd) {
return SystemUtil.runShellCommand(OT_CTL + " " + cmd);
}