Set reboot timeout for OdrefreshHostTest.
Tradefed default reboot timeout (2 mins) is too short for the low-end
devices. Override it to avoid timeout on those devices.
Skip OdrefreshHostTest early if the device doesn't allow adb root.
Fix: 227225248
Test: atest odsign_e2e_tests
Change-Id: I7ec50ca4f673512d2991beb7e688ceb55cdb641e
diff --git a/test/odsign/test-src/com/android/tests/odsign/OdrefreshHostTest.java b/test/odsign/test-src/com/android/tests/odsign/OdrefreshHostTest.java
index d060638..833a44e 100644
--- a/test/odsign/test-src/com/android/tests/odsign/OdrefreshHostTest.java
+++ b/test/odsign/test-src/com/android/tests/odsign/OdrefreshHostTest.java
@@ -60,9 +60,9 @@
@BeforeClassWithInfo
public static void beforeClassWithDevice(TestInformation testInfo) throws Exception {
OdsignTestUtils testUtils = new OdsignTestUtils(testInfo);
+ testUtils.enableAdbRootOrSkipTest();
testUtils.installTestApex();
testUtils.reboot();
- testUtils.enableAdbRootOrSkipTest();
HashSet<String> zygoteArtifacts = new HashSet<>();
for (String zygoteName : testUtils.ZYGOTE_NAMES) {
diff --git a/test/odsign/test-src/com/android/tests/odsign/OdsignTestUtils.java b/test/odsign/test-src/com/android/tests/odsign/OdsignTestUtils.java
index 2676c0d..162ad72 100644
--- a/test/odsign/test-src/com/android/tests/odsign/OdsignTestUtils.java
+++ b/test/odsign/test-src/com/android/tests/odsign/OdsignTestUtils.java
@@ -30,6 +30,7 @@
import com.android.tradefed.device.DeviceNotAvailableException;
import com.android.tradefed.device.ITestDevice;
import com.android.tradefed.device.ITestDevice.ApexInfo;
+import com.android.tradefed.device.TestDeviceOptions;
import com.android.tradefed.invoker.TestInformation;
import com.android.tradefed.result.FileInputStreamSource;
import com.android.tradefed.result.LogDataType;
@@ -242,9 +243,23 @@
}
public void reboot() throws Exception {
+ TestDeviceOptions options = mTestInfo.getDevice().getOptions();
+ // store default value and increase time-out for reboot
+ int rebootTimeout = options.getRebootTimeout();
+ long onlineTimeout = options.getOnlineTimeout();
+ options.setRebootTimeout((int)BOOT_COMPLETE_TIMEOUT.toMillis());
+ options.setOnlineTimeout(BOOT_COMPLETE_TIMEOUT.toMillis());
+ mTestInfo.getDevice().setOptions(options);
+
mTestInfo.getDevice().reboot();
boolean success =
mTestInfo.getDevice().waitForBootComplete(BOOT_COMPLETE_TIMEOUT.toMillis());
+
+ // restore default values
+ options.setRebootTimeout(rebootTimeout);
+ options.setOnlineTimeout(onlineTimeout);
+ mTestInfo.getDevice().setOptions(options);
+
assertWithMessage("Device didn't boot in %s", BOOT_COMPLETE_TIMEOUT).that(success).isTrue();
}