diff options
author | Greg Kaiser <gkaiser@google.com> | 2020-01-16 05:37:51 -0800 |
---|---|---|
committer | Greg Kaiser <gkaiser@google.com> | 2020-01-16 05:40:17 -0800 |
commit | 400124c6aecf5cfcd06f101d2260c016f3b6cae5 (patch) | |
tree | 33f9d7b06fcccbf759bdbe8335f58ff9dc4c6215 /tests/RollbackTest | |
parent | 064c79eebb4295d126913b7ff3ef3223f35d25aa (diff) |
Revert "Make RollbackPackageHealthObserver observe apk-in-apex"
This reverts commit d56ce0003926fd9ee7d358cb45f8af7f562a33d6.
This revert is to fix the wembley build.
Test: Local wembley build
Change-Id: I651f20ffc6ba11cced5a2a737fd3d77211127221
Diffstat (limited to 'tests/RollbackTest')
3 files changed, 5 insertions, 82 deletions
diff --git a/tests/RollbackTest/Android.bp b/tests/RollbackTest/Android.bp index 98e7b4e1b430..091edd4dc0d9 100644 --- a/tests/RollbackTest/Android.bp +++ b/tests/RollbackTest/Android.bp @@ -19,10 +19,7 @@ android_test { static_libs: ["androidx.test.rules", "cts-rollback-lib", "cts-install-lib"], test_suites: ["general-tests"], test_config: "RollbackTest.xml", - java_resources: [ - ":com.android.apex.apkrollback.test_v2", - ":com.android.apex.apkrollback.test_v2Crashing" - ], + java_resources: [":com.android.apex.apkrollback.test_v2"], } java_test_host { @@ -82,14 +79,4 @@ apex { key: "com.android.apex.apkrollback.test.key", apps: ["TestAppAv2"], installable: false, -} - -apex { - name: "com.android.apex.apkrollback.test_v2Crashing", - manifest: "testdata/manifest_v2.json", - androidManifest: "testdata/AndroidManifest.xml", - file_contexts: ":apex.test-file_contexts", - key: "com.android.apex.apkrollback.test.key", - apps: ["TestAppACrashingV2"], - installable: false, }
\ No newline at end of file diff --git a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java index 80491cd98bc9..ce20311170c1 100644 --- a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java +++ b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java @@ -500,9 +500,8 @@ public class StagedRollbackTest { APK_IN_APEX_TESTAPEX_NAME, 1, /*isApex*/true, APK_IN_APEX_TESTAPEX_NAME + "_v1.apex"); private static final TestApp TEST_APEX_WITH_APK_V2 = new TestApp("TestApexWithApkV2", APK_IN_APEX_TESTAPEX_NAME, 2, /*isApex*/true, APK_IN_APEX_TESTAPEX_NAME + "_v2.apex"); - private static final TestApp TEST_APEX_WITH_APK_V2_CRASHING = new TestApp( - "TestApexWithApkV2Crashing", APK_IN_APEX_TESTAPEX_NAME, 2, /*isApex*/true, - APK_IN_APEX_TESTAPEX_NAME + "_v2Crashing.apex"); + private static final TestApp TEST_APP_A_V2_UNKNOWN = new TestApp("Av2Unknown", TestApp.A, 0, + /*isApex*/false, "TestAppAv2.apk"); @Test public void testRollbackApexWithApk_Phase1() throws Exception { @@ -524,7 +523,7 @@ public class StagedRollbackTest { assertThat(available).isStaged(); assertThat(available).packagesContainsExactly( Rollback.from(TEST_APEX_WITH_APK_V2).to(TEST_APEX_WITH_APK_V1), - Rollback.from(TestApp.A, 0).to(TestApp.A1)); + Rollback.from(TEST_APP_A_V2_UNKNOWN).to(TestApp.A1)); RollbackUtils.rollback(available.getRollbackId(), TEST_APEX_WITH_APK_V2); RollbackInfo committed = RollbackUtils.getCommittedRollbackById(available.getRollbackId()); @@ -532,7 +531,7 @@ public class StagedRollbackTest { assertThat(committed).isStaged(); assertThat(committed).packagesContainsExactly( Rollback.from(TEST_APEX_WITH_APK_V2).to(TEST_APEX_WITH_APK_V1), - Rollback.from(TestApp.A, 0).to(TestApp.A1)); + Rollback.from(TEST_APP_A_V2_UNKNOWN).to(TestApp.A1)); assertThat(committed).causePackagesContainsExactly(TEST_APEX_WITH_APK_V2); assertThat(committed.getCommittedSessionId()).isNotEqualTo(-1); @@ -549,41 +548,6 @@ public class StagedRollbackTest { InstallUtils.processUserData(TestApp.A); } - /** - * Installs an apex with an apk that can crash. - */ - @Test - public void testRollbackApexWithApkCrashing_Phase1() throws Exception { - assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1); - int sessionId = Install.single(TEST_APEX_WITH_APK_V2_CRASHING).setStaged() - .setEnableRollback().commit(); - InstallUtils.waitForSessionReady(sessionId); - } - - /** - * Verifies rollback has been enabled successfully. Then makes TestApp.A crash. - */ - @Test - public void testRollbackApexWithApkCrashing_Phase2() throws Exception { - assertThat(InstallUtils.getInstalledVersion(APK_IN_APEX_TESTAPEX_NAME)).isEqualTo(2); - assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(2); - - RollbackInfo available = RollbackUtils.getAvailableRollback(APK_IN_APEX_TESTAPEX_NAME); - assertThat(available).isStaged(); - assertThat(available).packagesContainsExactly( - Rollback.from(TEST_APEX_WITH_APK_V2).to(TEST_APEX_WITH_APK_V1), - Rollback.from(TestApp.A, 0).to(TestApp.A1)); - - // Crash TestApp.A PackageWatchdog#TRIGGER_FAILURE_COUNT times to trigger rollback - RollbackUtils.sendCrashBroadcast(TestApp.A, 5); - } - - @Test - public void testRollbackApexWithApkCrashing_Phase3() throws Exception { - assertThat(InstallUtils.getInstalledVersion(APK_IN_APEX_TESTAPEX_NAME)).isEqualTo(1); - assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1); - } - private static void runShellCommand(String cmd) { ParcelFileDescriptor pfd = InstrumentationRegistry.getInstrumentation().getUiAutomation() .executeShellCommand(cmd); diff --git a/tests/RollbackTest/StagedRollbackTest/src/com/android/tests/rollback/host/StagedRollbackTest.java b/tests/RollbackTest/StagedRollbackTest/src/com/android/tests/rollback/host/StagedRollbackTest.java index 672cbb084dae..181e29a3081e 100644 --- a/tests/RollbackTest/StagedRollbackTest/src/com/android/tests/rollback/host/StagedRollbackTest.java +++ b/tests/RollbackTest/StagedRollbackTest/src/com/android/tests/rollback/host/StagedRollbackTest.java @@ -261,34 +261,6 @@ public class StagedRollbackTest extends BaseHostJUnit4Test { runPhase("testRollbackApexWithApk_Phase3"); } - /** - * Tests that RollbackPackageHealthObserver is observing apk-in-apex. - */ - @Test - public void testRollbackApexWithApkCrashing() throws Exception { - getDevice().uninstallPackage("com.android.cts.install.lib.testapp.A"); - CompatibilityBuildHelper buildHelper = new CompatibilityBuildHelper(getBuild()); - final String fileName = APK_IN_APEX_TESTAPEX_NAME + "_v1.apex"; - final File apex = buildHelper.getTestFile(fileName); - if (!getDevice().isAdbRoot()) { - getDevice().enableAdbRoot(); - } - getDevice().remountSystemWritable(); - assertTrue(getDevice().pushFile(apex, "/system/apex/" + fileName)); - getDevice().reboot(); - - // Install an apex with apk that crashes - runPhase("testRollbackApexWithApkCrashing_Phase1"); - getDevice().reboot(); - // Verify apex was installed and then crash the apk - runPhase("testRollbackApexWithApkCrashing_Phase2"); - // Wait for crash to trigger rollback - assertTrue(getDevice().waitForDeviceNotAvailable(TimeUnit.MINUTES.toMillis(5))); - getDevice().waitForDeviceAvailable(); - // Verify rollback occurred due to crash of apk-in-apex - runPhase("testRollbackApexWithApkCrashing_Phase3"); - } - private void crashProcess(String processName, int numberOfCrashes) throws Exception { String pid = ""; String lastPid = "invalid"; |