Autodetect NetworkStack path in rollback test

The network stack module may be implemented by NetworkStack (updatable
version built against stable SDK) or NetworkStackNext (test version
shipped only in system images, built against in-development SDK).

Bug: 144168912
Test: atest RollbackTest
Change-Id: I1788e323f763ca88b69b082f38078bee3bfe480d
This commit is contained in:
Remi NGUYEN VAN
2019-11-11 12:47:25 +09:00
parent a46b9ca083
commit ce4cad87d2
2 changed files with 15 additions and 3 deletions

View File

@@ -79,8 +79,15 @@ public class StagedRollbackTest {
private static final String MODULE_META_DATA_PACKAGE = getModuleMetadataPackageName(); private static final String MODULE_META_DATA_PACKAGE = getModuleMetadataPackageName();
private static final TestApp NETWORK_STACK = new TestApp("NetworkStack", private static final TestApp NETWORK_STACK = new TestApp("NetworkStack",
getNetworkStackPackageName(), -1, false, getNetworkStackPackageName(), -1, false, findNetworkStackApk());
new File("/system/priv-app/NetworkStack/NetworkStack.apk"));
private static File findNetworkStackApk() {
final File apk = new File("/system/priv-app/NetworkStack/NetworkStack.apk");
if (apk.isFile()) {
return apk;
}
return new File("/system/priv-app/NetworkStackNext/NetworkStackNext.apk");
}
/** /**
* Adopts common shell permissions needed for rollback tests. * Adopts common shell permissions needed for rollback tests.

View File

@@ -144,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);
@@ -193,4 +193,9 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
lastPid = pid; lastPid = pid;
} }
} }
private String getNetworkStackPath() throws Exception {
// Find the NetworkStack path (can be NetworkStack.apk or NetworkStackNext.apk)
return getDevice().executeShellCommand("ls /system/priv-app/NetworkStack*/*.apk");
}
} }