Set logwrapper timeout to the longest test time
20 minutes should be sufficiently long for now.
Bug: b/194974010
Test: TH
Change-Id: I644edef211850f496dd054f7e8be259123cc38bb
diff --git a/tests/hostside/helper/java/android/virt/test/VirtualizationTestCaseBase.java b/tests/hostside/helper/java/android/virt/test/VirtualizationTestCaseBase.java
index 0e07c60..dc65899 100644
--- a/tests/hostside/helper/java/android/virt/test/VirtualizationTestCaseBase.java
+++ b/tests/hostside/helper/java/android/virt/test/VirtualizationTestCaseBase.java
@@ -46,9 +46,9 @@
private static final String MICRODROID_SERIAL = "localhost:" + TEST_VM_ADB_PORT;
private static final String INSTANCE_IMG = "instance.img";
- // This is really slow on GCE (2m 40s) but fast on localhost or actual Android phones (< 10s)
- // Set the maximum timeout value big enough.
- private static final long MICRODROID_BOOT_TIMEOUT_MINUTES = 5;
+ // This is really slow on GCE (2m 40s) but fast on localhost or actual Android phones (< 10s).
+ // Then there is time to run the actual task. Set the maximum timeout value big enough.
+ private static final long MICRODROID_MAX_LIFETIME_MINUTES = 20;
private static final long MICRODROID_ADB_CONNECT_TIMEOUT_MINUTES = 5;
@@ -206,9 +206,12 @@
executor.execute(
() -> {
try {
- // Keep redirecting sufficiently long enough
+ // Keep redirecting as long as the expecting maximum test time. When an adb
+ // command times out, it may trigger the device recovery process, which
+ // disconnect adb, which terminates any live adb commands. See an example at
+ // b/194974010#comment25.
android.runWithTimeout(
- MICRODROID_BOOT_TIMEOUT_MINUTES * 60 * 1000,
+ MICRODROID_MAX_LIFETIME_MINUTES * 60 * 1000,
"logwrapper",
"tail",
"-f",