Fix skipping testBootEnableAndDisablePKVM

The previous attempt in I20435fa3619ae428c167de4195ef1acf40261057
resulted in an exception, failing the test instead of skipping it.
Move the check earlier, at the beginning of the test, and make it
an assumption, not assertion.

Bug: 236799228
Bug: 244769139
Test: atest AVFHostTestCases on oriole_pkvm-userdebug
Change-Id: Ic0f1fdea3143833d9e35b85ee9470c20a08630b9
diff --git a/tests/benchmark_hostside/java/android/avf/test/AVFHostTestCase.java b/tests/benchmark_hostside/java/android/avf/test/AVFHostTestCase.java
index ca4d1d0..045be94 100644
--- a/tests/benchmark_hostside/java/android/avf/test/AVFHostTestCase.java
+++ b/tests/benchmark_hostside/java/android/avf/test/AVFHostTestCase.java
@@ -86,7 +86,7 @@
 
     @Test
     public void testBootEnableAndDisablePKVM() throws Exception {
-        testPKVMStatusSwitchSupported();
+        skipIfPKVMStatusSwitchNotSupported();
 
         List<Double> bootWithPKVMEnableTime = new ArrayList<>(ROUND_COUNT);
         List<Double> bootWithoutPKVMEnableTime = new ArrayList<>(ROUND_COUNT);
@@ -149,7 +149,7 @@
         reportMetric(bootWithoutCompOsTime, "boot_time_without_compos", "s");
     }
 
-    private void testPKVMStatusSwitchSupported() throws Exception {
+    private void skipIfPKVMStatusSwitchNotSupported() throws Exception {
         if (!getDevice().isStateBootloaderOrFastbootd()) {
             getDevice().rebootIntoBootloader();
         }
@@ -159,6 +159,9 @@
         result = getDevice().executeFastbootCommand("oem", "pkvm", "status");
         rebootFromBootloaderAndWaitBootCompleted();
         assumeTrue(!result.getStderr().contains("Invalid oem command"));
+        // Skip the test if running on a build with pkvm_enabler. Disabling pKVM
+        // for such builds results in a bootloop.
+        assumeTrue(result.getStdout().contains("misc=auto"));
     }
 
     private void reportMetric(List<Double> data, String name, String unit) {
@@ -195,11 +198,6 @@
         }
         assertWithMessage("Failed to set PKVM status. Reason: " + result)
             .that(result.toString()).ignoringCase().contains(expectedOutput);
-
-        // Skip the test if running on a build with pkvm_enabler. Disabling
-        // pKVM for such build results in a bootloop.
-        assertWithMessage("Expected build with PKVM status misc=auto. Reason: " + result)
-            .that(result.toString()).ignoringCase().contains("misc=auto");
     }
 
     private void rebootFromBootloaderAndWaitBootCompleted() throws Exception {