Skip minimum RAM test on Cuttlefish
Postsubmit tests listed in TEST_MAPPING have a hard time limit (1
minute). The minimum RAM test is too slow to run within 1 minute. This
change disables the test on Cuttlefish to fix the test breakage.
Our main use case is running benchmark tests on Pixel devices, and they
are not affected due to having a different .gcl config.
Bug: 237840870
Test: atest MicrodroidBenchmarks on cuttlefish
Change-Id: I4b923f7e39d673a2533e3b1bfdb5a64bf4020779
diff --git a/tests/benchmark/src/java/com/android/microdroid/benchmark/MicrodroidBenchmarks.java b/tests/benchmark/src/java/com/android/microdroid/benchmark/MicrodroidBenchmarks.java
index bc99e6e..53b1d8e 100644
--- a/tests/benchmark/src/java/com/android/microdroid/benchmark/MicrodroidBenchmarks.java
+++ b/tests/benchmark/src/java/com/android/microdroid/benchmark/MicrodroidBenchmarks.java
@@ -65,6 +65,15 @@
private static final String KERNEL_VERSION = SystemProperties.get("ro.kernel.version");
+ private boolean isCuttlefish() {
+ String productName = SystemProperties.get("ro.product.name");
+ return (null != productName)
+ && (productName.startsWith("aosp_cf_x86")
+ || productName.startsWith("aosp_cf_arm")
+ || productName.startsWith("cf_x86")
+ || productName.startsWith("cf_arm"));
+ }
+
/** Copy output from the VM to logcat. This is helpful when things go wrong. */
private static void logVmOutput(InputStream vmOutputStream, String name) {
new Thread(
@@ -254,12 +263,14 @@
@Test
public void testMinimumRequiredRAM()
throws VirtualMachineException, InterruptedException, IOException {
- int lo = 16, hi = 512, minimum = 0;
- boolean found = false;
+ assume().withMessage("Skip on CF; too slow").that(isCuttlefish()).isFalse();
// TODO(b/236672526): giving inefficient memory to pVM sometimes causes host crash.
assume().withMessage("Skip on pVM. b/236672526").that(mProtectedVm).isFalse();
+ int lo = 16, hi = 512, minimum = 0;
+ boolean found = false;
+
while (lo <= hi) {
int mid = (lo + hi) / 2;
if (canBootMicrodroidWithMemory(mid)) {