diff options
| author | 2022-03-29 19:01:31 -0700 | |
|---|---|---|
| committer | 2022-03-30 09:52:56 +0000 | |
| commit | 4583bedf159ae0e4cc6a54aea1b4a56eca7b672c (patch) | |
| tree | e77a814373aa37f7698c6de7320ba500aba89323 | |
| parent | cae2a5bddac223d811d6fbb3d9f595ffdb118086 (diff) | |
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
| -rw-r--r-- | test/odsign/test-src/com/android/tests/odsign/OdrefreshHostTest.java | 2 | ||||
| -rw-r--r-- | test/odsign/test-src/com/android/tests/odsign/OdsignTestUtils.java | 15 |
2 files changed, 16 insertions, 1 deletions
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 d060638c06..833a44ed70 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 @@ public class OdrefreshHostTest extends BaseHostJUnit4Test { @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 2676c0df74..162ad72fff 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 android.cts.install.lib.host.InstallUtilsHost; 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 class OdsignTestUtils { } 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(); } |