Merge "Remove tests already covered by CTS." into qt-dev

am: f6ca3f4e8f

Change-Id: Ic79b1a752f6c2a1083a2222afa6c2dbfbdaf9f3b
This commit is contained in:
Dario Freni
2019-05-23 05:36:07 -07:00
committed by android-build-merger
10 changed files with 10 additions and 416 deletions

View File

@@ -14,5 +14,13 @@
}
]
}
],
"imports": [
{
"path": "cts/tests/rollback"
},
{
"path": "cts/hostsidetests/rollback"
}
]
}

View File

@@ -78,45 +78,6 @@ android_test_helper_app {
package_splits: ["anydpi"],
}
apex {
name: "com.android.tests.rollback.testapex.RollbackTestApexV1",
manifest: "TestApex/RollbackTestApexV1.json",
file_contexts: "apex.test",
prebuilts: ["RollbackTestApex.prebuilt.txt"],
key: "RollbackTestApex.key",
installable: false,
}
apex {
name: "com.android.tests.rollback.testapex.RollbackTestApexV2",
manifest: "TestApex/RollbackTestApexV2.json",
file_contexts: "apex.test",
prebuilts: ["RollbackTestApex.prebuilt.txt"],
key: "RollbackTestApex.key",
installable: false,
}
apex {
name: "com.android.tests.rollback.testapex.RollbackTestApexV3",
manifest: "TestApex/RollbackTestApexV3.json",
file_contexts: "apex.test",
prebuilts: ["RollbackTestApex.prebuilt.txt"],
key: "RollbackTestApex.key",
installable: false,
}
apex_key {
name: "RollbackTestApex.key",
public_key: "TestApex/com.android.tests.rollback.testapex.avbpubkey",
private_key: "TestApex/com.android.tests.rollback.testapex.pem",
installable: false,
}
prebuilt_etc {
name: "RollbackTestApex.prebuilt.txt",
src: "TestApex/RollbackTestApex.prebuilt.txt",
}
android_test {
name: "RollbackTest",
manifest: "RollbackTest/AndroidManifest.xml",
@@ -132,9 +93,6 @@ android_test {
":RollbackTestAppBv2",
":RollbackTestAppASplitV1",
":RollbackTestAppASplitV2",
":com.android.tests.rollback.testapex.RollbackTestApexV1",
":com.android.tests.rollback.testapex.RollbackTestApexV2",
":com.android.tests.rollback.testapex.RollbackTestApexV3",
],
test_config: "RollbackTest.xml",
sdk_version: "test_current",

View File

@@ -17,7 +17,6 @@
package com.android.tests.rollback;
import static com.android.tests.rollback.RollbackTestUtils.assertRollbackInfoEquals;
import static com.android.tests.rollback.RollbackTestUtils.getRecentlyCommittedRollbackInfoById;
import static com.android.tests.rollback.RollbackTestUtils.getUniqueRollbackInfoForPackage;
import android.Manifest;
@@ -31,7 +30,6 @@ import androidx.test.InstrumentationRegistry;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -55,15 +53,7 @@ public class StagedRollbackTest {
private static final String TAG = "RollbackTest";
private static final String TEST_APP_A = "com.android.tests.rollback.testapp.A";
private static final String TEST_APP_A_V1 = "RollbackTestAppAv1.apk";
private static final String TEST_APP_A_V2 = "RollbackTestAppAv2.apk";
private static final String TEST_APP_A_CRASHING_V2 = "RollbackTestAppACrashingV2.apk";
private static final String TEST_APEX_PKG = "com.android.tests.rollback.testapex";
private static final String TEST_APEX_V1 =
"com.android.tests.rollback.testapex.RollbackTestApexV1.apex";
private static final String TEST_APEX_V2 =
"com.android.tests.rollback.testapex.RollbackTestApexV2.apex";
private static final String TEST_APEX_V3 =
"com.android.tests.rollback.testapex.RollbackTestApexV3.apex";
/**
* Adopts common shell permissions needed for rollback tests.
@@ -85,59 +75,6 @@ public class StagedRollbackTest {
RollbackTestUtils.dropShellPermissionIdentity();
}
/**
* Test rollbacks of staged installs involving only apks.
* Enable rollback phase.
*/
@Test
public void testApkOnlyEnableRollback() throws Exception {
RollbackTestUtils.uninstall(TEST_APP_A);
assertEquals(-1, RollbackTestUtils.getInstalledVersion(TEST_APP_A));
RollbackTestUtils.install(TEST_APP_A_V1, false);
assertEquals(1, RollbackTestUtils.getInstalledVersion(TEST_APP_A));
RollbackTestUtils.processUserData(TEST_APP_A);
RollbackTestUtils.installStaged(true, TEST_APP_A_V2);
// At this point, the host test driver will reboot the device and run
// testApkOnlyCommitRollback().
}
/**
* Test rollbacks of staged installs involving only apks.
* Commit rollback phase.
*/
@Test
public void testApkOnlyCommitRollback() throws Exception {
assertEquals(2, RollbackTestUtils.getInstalledVersion(TEST_APP_A));
RollbackTestUtils.processUserData(TEST_APP_A);
RollbackManager rm = RollbackTestUtils.getRollbackManager();
RollbackInfo rollback = getUniqueRollbackInfoForPackage(
rm.getAvailableRollbacks(), TEST_APP_A);
assertRollbackInfoEquals(TEST_APP_A, 2, 1, rollback);
assertTrue(rollback.isStaged());
RollbackTestUtils.rollback(rollback.getRollbackId(),
new VersionedPackage(TEST_APP_A, 2));
rollback = getUniqueRollbackInfoForPackage(
rm.getRecentlyCommittedRollbacks(), TEST_APP_A);
assertRollbackInfoEquals(TEST_APP_A, 2, 1, rollback, new VersionedPackage(TEST_APP_A, 2));
assertTrue(rollback.isStaged());
assertNotEquals(-1, rollback.getCommittedSessionId());
RollbackTestUtils.waitForSessionReady(rollback.getCommittedSessionId());
// The app should not be rolled back until after reboot.
assertEquals(2, RollbackTestUtils.getInstalledVersion(TEST_APP_A));
// At this point, the host test driver will reboot the device and run
// testApkOnlyConfirmRollback().
}
/**
* Test rollbacks of staged installs involving only apks with bad update.
* Enable rollback phase.
@@ -209,7 +146,7 @@ public class StagedRollbackTest {
* Confirm rollback phase.
*/
@Test
public void testApkOnlyConfirmRollback() throws Exception {
public void testBadApkOnlyConfirmRollback() throws Exception {
assertEquals(1, RollbackTestUtils.getInstalledVersion(TEST_APP_A));
RollbackTestUtils.processUserData(TEST_APP_A);
@@ -220,171 +157,4 @@ public class StagedRollbackTest {
assertTrue(rollback.isStaged());
assertNotEquals(-1, rollback.getCommittedSessionId());
}
/**
* Test rollbacks of staged installs an apk and an apex.
* Enable rollback phase.
*/
@Test
public void testApkAndApexEnableRollback() throws Exception {
RollbackTestUtils.uninstall(TEST_APP_A);
RollbackTestUtils.install(TEST_APP_A_V1, false);
assertEquals(1, RollbackTestUtils.getInstalledVersion(TEST_APEX_PKG));
assertEquals(1, RollbackTestUtils.getInstalledVersion(TEST_APP_A));
RollbackTestUtils.installStaged(true, TEST_APP_A_V2, TEST_APEX_V2);
// At this point, the host test driver will reboot the device and run
// testApkAndApexCommitRollback().
}
/**
* Test rollbacks of staged installs an apk and an apex.
* Commit rollback phase.
*/
@Test
public void testApkAndApexCommitRollback() throws Exception {
assertEquals(2, RollbackTestUtils.getInstalledVersion(TEST_APEX_PKG));
assertEquals(2, RollbackTestUtils.getInstalledVersion(TEST_APP_A));
RollbackTestUtils.processUserData(TEST_APP_A);
RollbackManager rm = RollbackTestUtils.getRollbackManager();
RollbackInfo rollback = getUniqueRollbackInfoForPackage(
rm.getAvailableRollbacks(), TEST_APP_A);
String[] packagesNames = {TEST_APEX_PKG, TEST_APP_A};
assertRollbackInfoEquals(packagesNames, 2, 1, rollback);
assertTrue(rollback.isStaged());
RollbackTestUtils.rollback(rollback.getRollbackId());
RollbackInfo committed = getRecentlyCommittedRollbackInfoById(rollback.getRollbackId());
assertRollbackInfoEquals(packagesNames, 2, 1, committed);
assertTrue(committed.isStaged());
assertNotEquals(-1, committed.getCommittedSessionId());
RollbackTestUtils.waitForSessionReady(committed.getCommittedSessionId());
// The apex and apk should not be rolled back until after reboot.
assertEquals(2, RollbackTestUtils.getInstalledVersion(TEST_APEX_PKG));
assertEquals(2, RollbackTestUtils.getInstalledVersion(TEST_APP_A));
// At this point, the host test driver will reboot the device and run
// testApkAndApexConfirmRollback().
}
/**
* Test rollbacks of staged installs an apk and an apex.
* Confirm rollback phase.
*/
@Test
public void testApkAndApexConfirmRollback() throws Exception {
assertEquals(1, RollbackTestUtils.getInstalledVersion(TEST_APEX_PKG));
assertEquals(1, RollbackTestUtils.getInstalledVersion(TEST_APP_A));
RollbackTestUtils.processUserData(TEST_APP_A);
}
/**
* Test rollbacks of staged installs involving only apex.
* Enable rollback phase.
*/
@Test
public void testApexOnlyEnableRollback() throws Exception {
assertEquals(1, RollbackTestUtils.getInstalledVersion(TEST_APEX_PKG));
RollbackTestUtils.installStaged(true, TEST_APEX_V2);
// At this point, the host test driver will reboot the device and run
// testApexOnlyCommitRollback().
}
/**
* Test rollbacks of staged installs involving only apex.
* Commit rollback phase.
*/
@Test
public void testApexOnlyCommitRollback() throws Exception {
assertEquals(2, RollbackTestUtils.getInstalledVersion(TEST_APEX_PKG));
RollbackManager rm = RollbackTestUtils.getRollbackManager();
RollbackInfo rollback = getUniqueRollbackInfoForPackage(
rm.getAvailableRollbacks(), TEST_APEX_PKG);
assertRollbackInfoEquals(TEST_APEX_PKG, 2, 1, rollback);
assertTrue(rollback.isStaged());
RollbackTestUtils.rollback(rollback.getRollbackId());
RollbackInfo committed = getRecentlyCommittedRollbackInfoById(rollback.getRollbackId());
assertRollbackInfoEquals(TEST_APEX_PKG, 2, 1, committed);
assertTrue(committed.isStaged());
assertNotEquals(-1, committed.getCommittedSessionId());
RollbackTestUtils.waitForSessionReady(committed.getCommittedSessionId());
// The apex should not be rolled back until after reboot.
assertEquals(2, RollbackTestUtils.getInstalledVersion(TEST_APEX_PKG));
// At this point, the host test driver will reboot the device and run
// testApexOnlyConfirmRollback().
}
/**
* Test rollbacks of staged installs involving only apex.
* Confirm rollback phase.
*/
@Test
public void testApexOnlyConfirmRollback() throws Exception {
assertEquals(1, RollbackTestUtils.getInstalledVersion(TEST_APEX_PKG));
}
/**
* Tests that apex update expires existing rollbacks for that apex.
* Enable rollback phase.
*/
@Test
public void testApexRollbackExpirationEnableRollback() throws Exception {
assertEquals(1, RollbackTestUtils.getInstalledVersion(TEST_APEX_PKG));
RollbackTestUtils.installStaged(true, TEST_APEX_V2);
// At this point, the host test driver will reboot the device and run
// testApexRollbackExpirationUpdateApex().
}
/**
* Tests that apex update expires existing rollbacks for that apex.
* Update apex phase.
*/
@Test
public void testApexRollbackExpirationUpdateApex() throws Exception {
assertEquals(2, RollbackTestUtils.getInstalledVersion(TEST_APEX_PKG));
RollbackTestUtils.installStaged(false, TEST_APEX_V3);
// At this point, the host test driver will reboot the device and run
// testApexRollbackExpirationConfirmExpiration().
}
/**
* Tests that apex update expires existing rollbacks for that apex.
* Confirm expiration phase.
*/
@Test
public void testApexRollbackExpirationConfirmExpiration() throws Exception {
assertEquals(3, RollbackTestUtils.getInstalledVersion(TEST_APEX_PKG));
RollbackManager rm = RollbackTestUtils.getRollbackManager();
assertNull(getUniqueRollbackInfoForPackage(rm.getAvailableRollbacks(), TEST_APEX_PKG));
}
/**
* Helper function called by the host test to install v1 of the test apex,
* assuming the test apex is not installed.
*/
@Test
public void installTestApexV1() throws Exception {
RollbackTestUtils.installStaged(false, TEST_APEX_V1);
}
}

View File

@@ -19,7 +19,6 @@ package com.android.tests.rollback.host;
import static org.junit.Assert.assertTrue;
import com.android.ddmlib.Log.LogLevel;
import com.android.tradefed.device.ITestDevice;
import com.android.tradefed.log.LogUtil.CLog;
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
@@ -32,9 +31,6 @@ import org.junit.runner.RunWith;
*/
@RunWith(DeviceJUnit4ClassRunner.class)
public class StagedRollbackTest extends BaseHostJUnit4Test {
private static final String TEST_APEX_PKG = "com.android.tests.rollback.testapex";
/**
* Runs the given phase of a test by calling into the device.
* Throws an exception if the test phase fails.
@@ -47,18 +43,6 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
phase));
}
/**
* Tests staged rollbacks involving only apks.
*/
@Test
public void testApkOnly() throws Exception {
runPhase("testApkOnlyEnableRollback");
getDevice().reboot();
runPhase("testApkOnlyCommitRollback");
getDevice().reboot();
runPhase("testApkOnlyConfirmRollback");
}
/**
* Tests watchdog triggered staged rollbacks involving only apks.
*/
@@ -79,66 +63,6 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
}
getDevice().waitForDeviceAvailable();
runPhase("testApkOnlyConfirmRollback");
}
/**
* Tests staged rollbacks involving only apex.
*/
@Test
public void testApexOnly() throws Exception {
installTestApexV1();
runPhase("testApexOnlyEnableRollback");
getDevice().reboot();
runPhase("testApexOnlyCommitRollback");
getDevice().reboot();
runPhase("testApexOnlyConfirmRollback");
}
/**
* Tests staged rollbacks involving apk and apex.
*/
@Test
public void testApkAndApex() throws Exception {
installTestApexV1();
runPhase("testApkAndApexEnableRollback");
getDevice().reboot();
runPhase("testApkAndApexCommitRollback");
getDevice().reboot();
runPhase("testApkAndApexConfirmRollback");
}
/**
* Tests that apex update expires existing rollbacks for that apex.
*/
@Test
public void testApexRollbackExpiration() throws Exception {
installTestApexV1();
runPhase("testApexRollbackExpirationEnableRollback");
getDevice().reboot();
runPhase("testApexRollbackExpirationUpdateApex");
getDevice().reboot();
runPhase("testApexRollbackExpirationConfirmExpiration");
}
/**
* Do whatever is necessary to get version 1 of the test apex installed on
* the device. Try to do so without extra reboots where possible to keep
* the test execution time down.
*/
private void installTestApexV1() throws Exception {
for (ITestDevice.ApexInfo apexInfo : getDevice().getActiveApexes()) {
if (TEST_APEX_PKG.equals(apexInfo.name)) {
if (apexInfo.versionCode == 1) {
return;
}
getDevice().uninstallPackage(TEST_APEX_PKG);
getDevice().reboot();
break;
}
}
runPhase("installTestApexV1");
getDevice().reboot();
runPhase("testBadApkOnlyConfirmRollback");
}
}

View File

@@ -1,3 +0,0 @@
This file contains dummy content to include in the RollbackTestApex.

View File

@@ -1,4 +0,0 @@
{
"name": "com.android.tests.rollback.testapex",
"version": 1
}

View File

@@ -1,4 +0,0 @@
{
"name": "com.android.tests.rollback.testapex",
"version": 2
}

View File

@@ -1,4 +0,0 @@
{
"name": "com.android.tests.rollback.testapex",
"version": 3
}

View File

@@ -1,51 +0,0 @@
-----BEGIN RSA PRIVATE KEY-----
MIIJKQIBAAKCAgEArBLX+v6RMiK6soQFgbc0RZ+wticTD5sCbu9Q5B5WT7UnV1Wt
cNI/n2bjks3UYNxTneOzMQOVjd4ln0BYZoNvoDtrc1BsYABpt4FywSq1zz/3sp3L
3Vp8vaUyRsx0Da+PcOdYHPFs1WPX3Shw3MSPhUO/72KTm6GhO/cHEPEzSQLaw/zO
8FiPpDdRqILqVJlu1DZ+i1DO+To9mKt59uLlxy3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