Skip changingDebuggability related tests on Non-pVM
These are boot tests (more precisely, they test that VM does not boot)
when debuggability is changed. Debuggability changes the initrd which is
verified by pvmfw. They dont make much sense in cases of non-protected
VM where pvmfw is not in boot seq.
Note: the test still pass for non-protected VM on devices without debug
policy, the reason for that is an extra apex 'adbd' is included in the
VM, which results in MicrodroidData 'mismatch' result in boot failure.
But that is not the point of the test.
Bug: 301014052
Test: atest #changingNonDebuggableVmDebuggableInvalidatesVmIdentity &
check that it is indeed skipped
Change-Id: Ic2818a8f513c778ad1f5217d3641398c8df1719d
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 e2795ec..b7a34ae 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
@@ -555,4 +555,8 @@
protected boolean isFeatureEnabled(String featureName) throws Exception {
return getVirtualMachineManager().isFeatureEnabled(featureName);
}
+
+ protected void assumeProtectedVM() {
+ assumeTrue("Skip on non-protected VM", mProtectedVm);
+ }
}
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 4b9f803..2500f3b 100644
--- a/tests/testapk/src/java/com/android/microdroid/test/MicrodroidTests.java
+++ b/tests/testapk/src/java/com/android/microdroid/test/MicrodroidTests.java
@@ -946,12 +946,18 @@
@Test
@CddTest(requirements = {"9.17/C-1-1", "9.17/C-2-7"})
public void changingNonDebuggableVmDebuggableInvalidatesVmIdentity() throws Exception {
+ // Debuggability changes initrd which is verified by pvmfw.
+ // Therefore, skip this on non-protected VM.
+ assumeProtectedVM();
changeDebugLevel(DEBUG_LEVEL_NONE, DEBUG_LEVEL_FULL);
}
@Test
@CddTest(requirements = {"9.17/C-1-1", "9.17/C-2-7"})
public void changingDebuggableVmNonDebuggableInvalidatesVmIdentity() throws Exception {
+ // Debuggability changes initrd which is verified by pvmfw.
+ // Therefore, skip this on non-protected VM.
+ assumeProtectedVM();
changeDebugLevel(DEBUG_LEVEL_FULL, DEBUG_LEVEL_NONE);
}