Merge "Detect NetworkStack path in rollback test"

am: 5d4d3c178f

Change-Id: Ibfdc04ee71c85b3923bb3996b2150fe3637d1553
This commit is contained in:
Remi NGUYEN VAN
2019-11-11 09:10:00 -08:00
committed by android-build-merger

View File

@@ -19,6 +19,7 @@ package com.android.tests.rollback.host;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import com.android.ddmlib.Log.LogLevel; import com.android.ddmlib.Log.LogLevel;
import com.android.tradefed.device.DeviceNotAvailableException;
import com.android.tradefed.log.LogUtil.CLog; import com.android.tradefed.log.LogUtil.CLog;
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner; import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test; import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
@@ -97,7 +98,7 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
+ "watchdog_request_timeout_millis 300000"); + "watchdog_request_timeout_millis 300000");
// Simulate re-installation of new NetworkStack with rollbacks enabled // Simulate re-installation of new NetworkStack with rollbacks enabled
getDevice().executeShellCommand("pm install -r --staged --enable-rollback " getDevice().executeShellCommand("pm install -r --staged --enable-rollback "
+ "/system/priv-app/NetworkStack/NetworkStack.apk"); + getNetworkStackPath());
// Sleep to allow writes to disk before reboot // Sleep to allow writes to disk before reboot
Thread.sleep(5000); Thread.sleep(5000);
@@ -143,7 +144,7 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
+ "watchdog_request_timeout_millis 300000"); + "watchdog_request_timeout_millis 300000");
// Simulate re-installation of new NetworkStack with rollbacks enabled // Simulate re-installation of new NetworkStack with rollbacks enabled
getDevice().executeShellCommand("pm install -r --staged --enable-rollback " getDevice().executeShellCommand("pm install -r --staged --enable-rollback "
+ "/system/priv-app/NetworkStack/NetworkStack.apk"); + getNetworkStackPath());
// Sleep to allow writes to disk before reboot // Sleep to allow writes to disk before reboot
Thread.sleep(5000); Thread.sleep(5000);
@@ -167,4 +168,9 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
// Verify rollback was not executed after health check deadline // Verify rollback was not executed after health check deadline
runPhase("assertNoNetworkStackRollbackCommitted"); runPhase("assertNoNetworkStackRollbackCommitted");
} }
private String getNetworkStackPath() throws DeviceNotAvailableException {
// Find the NetworkStack path (can be NetworkStack.apk or NetworkStackNext.apk)
return getDevice().executeShellCommand("ls /system/priv-app/NetworkStack*/*.apk");
}
} }