Merge "Skip tearDown() if tests skipped in setUp()"
diff --git a/tests/benchmark_hostside/java/android/avf/test/AVFHostTestCase.java b/tests/benchmark_hostside/java/android/avf/test/AVFHostTestCase.java
index c47e915..a19d4a3 100644
--- a/tests/benchmark_hostside/java/android/avf/test/AVFHostTestCase.java
+++ b/tests/benchmark_hostside/java/android/avf/test/AVFHostTestCase.java
@@ -95,6 +95,14 @@
@After
public void tearDown() throws Exception {
+ try {
+ testIfDeviceIsCapable(getDevice());
+ } catch (Exception e) {
+ // Suppress execption here.
+ // If we throw exceptions in both setUp() and tearDown(),
+ // then test is reported as fail with org.junit.TestCouldNotBeSkippedException.
+ return;
+ }
// Set PKVM enable and reboot to prevent previous staged session.
if (!isCuttlefish()) {
setPKVMStatusWithRebootToBootloader(true);