Microdroid low memory test.
There was a recent issue related to this.
The test takes 1m40s to complete.
Bug: 185586693
Test: atest MicrodroidTestApp
Change-Id: I4c40b680c24ebc7c1eefe67c7f654c35828ff6b3
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 f2d325c..448f150 100644
--- a/tests/testapk/src/java/com/android/microdroid/test/MicrodroidTests.java
+++ b/tests/testapk/src/java/com/android/microdroid/test/MicrodroidTests.java
@@ -163,6 +163,26 @@
}
@Test
+ public void bootFailsWhenLowMem() throws VirtualMachineException, InterruptedException {
+ VirtualMachineConfig lowMemConfig = mInner.newVmConfigBuilder("assets/vm_config.json")
+ .memoryMib(20)
+ .debugLevel(DebugLevel.NONE)
+ .build();
+ VirtualMachine vm = mInner.forceCreateNewVirtualMachine("low_mem", lowMemConfig);
+ final CompletableFuture<Integer> exception = new CompletableFuture<>();
+ VmEventListener listener =
+ new VmEventListener() {
+ @Override
+ public void onDied(VirtualMachine vm, @DeathReason int reason) {
+ exception.complete(reason);
+ super.onDied(vm, reason);
+ }
+ };
+ listener.runToFinish(TAG, vm);
+ assertThat(exception.getNow(0)).isAnyOf(DeathReason.REBOOT, DeathReason.HANGUP);
+ }
+
+ @Test
public void changingDebugLevelInvalidatesVmIdentity()
throws VirtualMachineException, InterruptedException, IOException {
assume()