Ensure that kernel is >= 5.15
Bug: 252917978
Test: watch TH
Change-Id: Iebe456151a616894abe385e41c7a51bc62889f9f
diff --git a/tests/testapk/src/java/com/android/microdroid/test/MicrodroidTests.java b/tests/testapk/src/java/com/android/microdroid/test/MicrodroidTests.java
index 542f595..e78b7f1 100644
--- a/tests/testapk/src/java/com/android/microdroid/test/MicrodroidTests.java
+++ b/tests/testapk/src/java/com/android/microdroid/test/MicrodroidTests.java
@@ -30,6 +30,7 @@
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
import static org.junit.Assume.assumeFalse;
import static org.junit.Assert.assertThrows;
+import static org.junit.Assert.assertTrue;
import com.google.common.base.Strings;
import com.google.common.truth.BooleanSubject;
@@ -56,6 +57,7 @@
import android.util.Log;
import com.android.compatibility.common.util.CddTest;
+import com.android.compatibility.common.util.VsrTest;
import com.android.microdroid.test.device.MicrodroidDeviceTestBase;
import com.android.microdroid.test.vmshare.IVmShareTestService;
import com.android.microdroid.testservice.IAppCallback;
@@ -1951,6 +1953,25 @@
.isEqualTo(MS_NOEXEC);
}
+ @Test
+ @VsrTest(requirements = {"VSR-7.1-001.003"})
+ public void kernelVersionRequirement() throws Exception {
+ int firstApiLevel = SystemProperties.getInt("ro.product.first_api_level", 0);
+ assume().withMessage("Skip on devices launched before Android 14 (API level 34)")
+ .that(firstApiLevel)
+ .isAtLeast(34);
+
+ String[] tokens = KERNEL_VERSION.split("\\.");
+ int major = Integer.parseInt(tokens[0]);
+ int minor = Integer.parseInt(tokens[1]);
+
+ // Check kernel version >= 5.15
+ assertTrue(major >= 5);
+ if (major == 5) {
+ assertTrue(minor >= 15);
+ }
+ }
+
private static class VmShareServiceConnection implements ServiceConnection {
private final CountDownLatch mLatch = new CountDownLatch(1);