Merge "Skip the test if no mainline modules installed" into rvc-dev am: a167a4774a am: f23d9637aa am: a2d38daef4 am: 8ba106aea8

Change-Id: I21e0df7325a140731b703b7cebc6303d4302078b
This commit is contained in:
JW Wang
2020-04-03 15:31:54 +00:00
committed by Automerger Merge Worker
2 changed files with 21 additions and 0 deletions

View File

@@ -477,4 +477,12 @@ public class StagedRollbackTest {
StorageManager sm = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
assertThat(sm.isCheckpointSupported()).isTrue();
}
@Test
public void hasMainlineModule() throws Exception {
String pkgName = getModuleMetadataPackageName();
boolean existed = InstrumentationRegistry.getInstrumentation().getContext()
.getPackageManager().getModuleInfo(pkgName, 0) != null;
assertThat(existed).isTrue();
}
}

View File

@@ -243,6 +243,7 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
*/
@Test
public void testRollbackWhitelistedApp() throws Exception {
assumeTrue(hasMainlineModule());
runPhase("testRollbackWhitelistedApp_Phase1");
getDevice().reboot();
runPhase("testRollbackWhitelistedApp_Phase2");
@@ -460,4 +461,16 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
return false;
}
}
/**
* True if this build has mainline modules installed.
*/
private boolean hasMainlineModule() throws Exception {
try {
runPhase("hasMainlineModule");
return true;
} catch (AssertionError ignore) {
return false;
}
}
}