Delete artifacts after test
The test generates a CompOS image and odrefresh compiled artifacts. It
turns out that these cause acloud instances to fail to boot on the
next reboot. I'm not entirely clear why, although I suspect odsign
will not like them.
In any case, cleaning up is proper test hygiene.
I also increased how persistent we are in trying to reconnect adb,
since we've seen cases where the current number of retries fails -
b/202585958#comment23.
Bug: 202585958
Bug: 200924405
Test: on acloud, aosp build:
Test: android.compos.test.ComposTestCase#testOdrefresh
Test: adb reboot
Test: Verify device successfuly reboots
Change-Id: Ia2dbcc5f531f79d8c8caf8e0d7b943dca158f864
diff --git a/compos/tests/java/android/compos/test/ComposTestCase.java b/compos/tests/java/android/compos/test/ComposTestCase.java
index 01d8ff1..81e78ab 100644
--- a/compos/tests/java/android/compos/test/ComposTestCase.java
+++ b/compos/tests/java/android/compos/test/ComposTestCase.java
@@ -66,6 +66,14 @@
@After
public void tearDown() throws Exception {
killVmAndReconnectAdb();
+
+ CommandRunner android = new CommandRunner(getDevice());
+
+ // Clear up any CompOS instance files we created
+ android.tryRun("rm", "-rf", COMPOS_CURRENT_ROOT);
+
+ // And any artifacts generated by odrefresh
+ android.tryRun("rm", "-rf", ODREFRESH_OUTPUT_DIR);
}
@Test
diff --git a/tests/hostside/helper/java/android/virt/test/VirtualizationTestCaseBase.java b/tests/hostside/helper/java/android/virt/test/VirtualizationTestCaseBase.java
index d62892c..5b7de58 100644
--- a/tests/hostside/helper/java/android/virt/test/VirtualizationTestCaseBase.java
+++ b/tests/hostside/helper/java/android/virt/test/VirtualizationTestCaseBase.java
@@ -87,7 +87,7 @@
// Make sure we're connected to the host adb; this connection seems to get dropped when a VM
// exits.
- for (int retry = 0; retry < 3; ++retry) {
+ for (int retry = 0; retry < 10; ++retry) {
if (android.tryRun("true") != null) {
break;
}