Skip protected VM tests on GSI
To correctly test the protected VMs on GSI, pvmfw has to be replaced
with a GSI-compatible pvmfw. However, replacing of the pvmfw partition
is not a part of the GSI process.
Until we have it as part of the process, let's skip testing protected
VMs on GSI.
Bug: 340429921
Bug: 272443823
Test: run the test with GSI and observe assumption failures with
protected VMs.
(cherry picked from https://android-review.googlesource.com/q/commit:09ae09469d3caaab37322e708a2a04c12e4ec755)
Merged-In: I1c1ad7eb7d773ffcf91ad0e9b54b5b7c2c1c03b4
Change-Id: I1c1ad7eb7d773ffcf91ad0e9b54b5b7c2c1c03b4
diff --git a/tests/helper/src/java/com/android/microdroid/test/device/MicrodroidDeviceTestBase.java b/tests/helper/src/java/com/android/microdroid/test/device/MicrodroidDeviceTestBase.java
index 6474965..1627af7 100644
--- a/tests/helper/src/java/com/android/microdroid/test/device/MicrodroidDeviceTestBase.java
+++ b/tests/helper/src/java/com/android/microdroid/test/device/MicrodroidDeviceTestBase.java
@@ -191,6 +191,9 @@
assume().withMessage("Skip where protected VMs aren't supported")
.that(capabilities & VirtualMachineManager.CAPABILITY_PROTECTED_VM)
.isNotEqualTo(0);
+ assume().withMessage("Testing protected VMs on GSI isn't supported. b/272443823")
+ .that(isGsi())
+ .isFalse();
} else {
assume().withMessage("Skip where VMs aren't supported")
.that(capabilities & VirtualMachineManager.CAPABILITY_NON_PROTECTED_VM)
@@ -212,13 +215,17 @@
.that(mCtx.getPackageManager().hasSystemFeature(FEATURE_VIRTUALIZATION_FRAMEWORK))
.isTrue();
int vendorApiLevel = getVendorApiLevel();
- boolean isGsi = new File("/system/system_ext/etc/init/init.gsi.rc").exists();
+ boolean isGsi = isGsi();
Log.i(TAG, "isGsi = " + isGsi + ", vendor api level = " + vendorApiLevel);
assume().withMessage("GSI with vendor API level < 202404 may not support AVF")
.that(isGsi && vendorApiLevel < 202404)
.isFalse();
}
+ protected boolean isGsi() {
+ return new File("/system/system_ext/etc/init/init.gsi.rc").exists();
+ }
+
protected static int getVendorApiLevel() {
return SystemProperties.getInt("ro.board.api_level", 0);
}