Merge "Do proper cleanup" into sc-dev

This commit is contained in:
JW Wang
2021-02-23 12:42:20 +00:00
committed by Android (Google) Code Review
2 changed files with 6 additions and 10 deletions

View File

@@ -35,7 +35,6 @@ import androidx.test.platform.app.InstrumentationRegistry;
import com.android.cts.install.lib.Install;
import com.android.cts.install.lib.InstallUtils;
import com.android.cts.install.lib.TestApp;
import com.android.cts.install.lib.Uninstall;
import com.android.cts.rollback.lib.Rollback;
import com.android.cts.rollback.lib.RollbackUtils;
import com.android.internal.R;
@@ -89,7 +88,6 @@ public class StagedRollbackTest {
*/
@Test
public void testBadApkOnly_Phase1_Install() throws Exception {
Uninstall.packages(TestApp.A);
assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(-1);
Install.single(TestApp.A1).commit();
@@ -149,7 +147,6 @@ public class StagedRollbackTest {
*/
@Test
public void testNativeWatchdogTriggersRollback_Phase1_Install() throws Exception {
Uninstall.packages(TestApp.A);
Install.single(TestApp.A1).commit();
assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1);
@@ -183,7 +180,6 @@ public class StagedRollbackTest {
*/
@Test
public void testNativeWatchdogTriggersRollbackForAll_Phase1_InstallA() throws Exception {
Uninstall.packages(TestApp.A);
Install.single(TestApp.A1).commit();
assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1);
@@ -201,7 +197,6 @@ public class StagedRollbackTest {
TestApp.A)).isNotNull();
// Install another package with rollback
Uninstall.packages(TestApp.B);
Install.single(TestApp.B1).commit();
assertThat(InstallUtils.getInstalledVersion(TestApp.B)).isEqualTo(1);
@@ -238,7 +233,6 @@ public class StagedRollbackTest {
@Test
public void testPreviouslyAbandonedRollbacks_Phase1_InstallAndAbandon() throws Exception {
Uninstall.packages(TestApp.A);
Install.single(TestApp.A1).commit();
assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1);
@@ -265,7 +259,6 @@ public class StagedRollbackTest {
public void testPreviouslyAbandonedRollbacks_Phase3_VerifyRollback() throws Exception {
assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1);
InstallUtils.processUserData(TestApp.A);
Uninstall.packages(TestApp.A);
}
private static String getModuleMetadataPackageName() {
@@ -301,7 +294,6 @@ public class StagedRollbackTest {
@Test
public void testRollbackDataPolicy_Phase1_Install() throws Exception {
Uninstall.packages(TestApp.A, TestApp.B, TestApp.C);
Install.multi(TestApp.A1, TestApp.B1, TestApp.C1).commit();
// Write user data version = 1
InstallUtils.processUserData(TestApp.A);

View File

@@ -99,10 +99,16 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
"/data/apex/active/" + APK_IN_APEX_TESTAPEX_NAME + "*.apex");
runPhase("expireRollbacks");
mLogger.start(getDevice());
getDevice().uninstallPackage("com.android.cts.install.lib.testapp.A");
getDevice().uninstallPackage("com.android.cts.install.lib.testapp.B");
getDevice().uninstallPackage("com.android.cts.install.lib.testapp.C");
}
@After
public void tearDown() throws Exception {
getDevice().uninstallPackage("com.android.cts.install.lib.testapp.A");
getDevice().uninstallPackage("com.android.cts.install.lib.testapp.B");
getDevice().uninstallPackage("com.android.cts.install.lib.testapp.C");
mLogger.stop();
runPhase("expireRollbacks");
deleteFiles("/system/apex/" + APK_IN_APEX_TESTAPEX_NAME + "*.apex",
@@ -283,7 +289,6 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
*/
@Test
public void testRollbackApexWithApk() throws Exception {
getDevice().uninstallPackage("com.android.cts.install.lib.testapp.A");
pushTestApex();
runPhase("testRollbackApexWithApk_Phase1_Install");
getDevice().reboot();
@@ -297,7 +302,6 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
*/
@Test
public void testRollbackApexWithApkCrashing() throws Exception {
getDevice().uninstallPackage("com.android.cts.install.lib.testapp.A");
pushTestApex();
// Install an apex with apk that crashes