Handle broken MicrodroidTests by VM reference DT
After introducing VM reference DT, now vendor hashtree digest is
delivered from DT of host device. In testing with current approach, it
uses distinguished image just for testing, and its hashtree digest is
untrustable.
So we'll suspend bootsWithVendorPartition, and resume when we can inject
vendor hashtree digest for testing purpose.
Also, creationFailsWithUnsignedVendorPartition is changed, since using
VM reference DT changed the point where error occurs. Before introducing
VM reference DT, it's caught while parsing hashtree digest in host's
process. But now it's caught in guest VM.
Bug: 323503597
Test: atest MicrodroidTests#bootsWithVendorPartition
Test: atest MicrodroidTests#creationFailsWithUnsignedVendorPartition
Test: atest MicrodroidTests#configuringVendorDiskImageRequiresCustomPermission
Change-Id: I71791e49875596bd078f5a2a19fcd2a7fafacddb
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 33d41ab..6fd109b 100644
--- a/tests/testapk/src/java/com/android/microdroid/test/MicrodroidTests.java
+++ b/tests/testapk/src/java/com/android/microdroid/test/MicrodroidTests.java
@@ -73,6 +73,7 @@
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.function.ThrowingRunnable;
@@ -2132,6 +2133,10 @@
.contains("android.permission.USE_CUSTOM_VIRTUAL_MACHINE permission");
}
+ // TODO(b/323768068): Enable this test when we can inject vendor hashkey for test purpose.
+ // After introducing VM reference DT, non-pVM cannot trust test_microdroid_vendor_image.img
+ // as well, because it doesn't pass the hashtree digest of testing image into VM.
+ @Ignore
@Test
public void bootsWithVendorPartition() throws Exception {
assumeSupportedDevice();
@@ -2142,10 +2147,6 @@
// after introducing verification based on DT and fstab in microdroid vendor partition.
assumeFalse(
"Boot with vendor partition is failing in HWASAN enabled Microdroid.", isHwasan());
- assumeFalse(
- "Skip test for protected VM, pvmfw config data doesn't contain any information of"
- + " test images, such as root digest.",
- isProtectedVm());
assumeFeatureEnabled(VirtualMachineManager.FEATURE_VENDOR_MODULES);
grantPermission(VirtualMachine.USE_CUSTOM_VIRTUAL_MACHINE_PERMISSION);
@@ -2197,8 +2198,9 @@
.build();
VirtualMachine vm = forceCreateNewVirtualMachine("test_boot_with_unsigned_vendor", config);
- assertThrowsVmExceptionContaining(
- () -> vm.run(), "Failed to get vbmeta from microdroid-vendor.img");
+ BootResult bootResult = tryBootVm(TAG, "test_boot_with_unsigned_vendor");
+ assertThat(bootResult.payloadStarted).isFalse();
+ assertThat(bootResult.deathReason).isEqualTo(VirtualMachineCallback.STOP_REASON_REBOOT);
}
@Test