Support MicrodroidBenchmark to test boot time with custom vendor image
Bug: 325555638
Test: atest MicrodroidBenchmarks#testMicrodroidDebugBootTime_withVendorPartition
Test: atest MicrodroidBenchmarks#testMicrodroidDebugBootTime_withCustomVendorPartition
Change-Id: I801ff6fd5a1410635d8a61e014f5dc492fc900b7
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 77cae32..ba02067 100644
--- a/tests/benchmark/src/java/com/android/microdroid/benchmark/MicrodroidBenchmarks.java
+++ b/tests/benchmark/src/java/com/android/microdroid/benchmark/MicrodroidBenchmarks.java
@@ -276,9 +276,9 @@
(builder) -> builder);
}
- @Test
- public void testMicrodroidDebugBootTime_withVendorPartition() throws Exception {
- assume().withMessage("Cuttlefish doesn't support device tree under" + " /proc/device-tree")
+ private void testMicrodroidDebugBootTime_withVendorBase(File vendorDiskImage) throws Exception {
+ // TODO(b/325094712): Boot fails with vendor partition in Cuttlefish.
+ assume().withMessage("Cuttlefish doesn't support device tree under /proc/device-tree")
.that(isCuttlefish())
.isFalse();
// TODO(b/317567210): Boots fails with vendor partition in HWASAN enabled microdroid
@@ -287,11 +287,6 @@
.that(isHwasan())
.isFalse();
assumeFeatureEnabled(VirtualMachineManager.FEATURE_VENDOR_MODULES);
-
- File vendorDiskImage = new File("/vendor/etc/avf/microdroid/microdroid_vendor.img");
- assume().withMessage("Microdroid vendor image doesn't exist, skip")
- .that(vendorDiskImage.exists())
- .isTrue();
runBootTimeTest(
"test_vm_boot_time_debug_with_vendor_partition",
"assets/" + os() + "/vm_config.json",
@@ -300,6 +295,27 @@
}
@Test
+ public void testMicrodroidDebugBootTime_withVendorPartition() throws Exception {
+ File vendorDiskImage = new File("/vendor/etc/avf/microdroid/microdroid_vendor.img");
+ assume().withMessage("Microdroid vendor image doesn't exist, skip")
+ .that(vendorDiskImage.exists())
+ .isTrue();
+ testMicrodroidDebugBootTime_withVendorBase(vendorDiskImage);
+ }
+
+ @Test
+ public void testMicrodroidDebugBootTime_withCustomVendorPartition() throws Exception {
+ assume().withMessage(
+ "Skip test for protected VM, pvmfw config data doesn't contain any"
+ + " information of test images, such as root digest.")
+ .that(mProtectedVm)
+ .isFalse();
+ File vendorDiskImage =
+ new File("/data/local/tmp/microdroid-bench/microdroid_vendor_image.img");
+ testMicrodroidDebugBootTime_withVendorBase(vendorDiskImage);
+ }
+
+ @Test
public void testMicrodroidImageSize() throws IOException {
Bundle bundle = new Bundle();
for (File file : new File(APEX_ETC_FS).listFiles()) {