Merge "microdroid: remove unnecessary modules"
diff --git a/compos/tests/java/android/compos/test/ComposTestCase.java b/compos/tests/java/android/compos/test/ComposTestCase.java
index 6773eb7..eec9e39 100644
--- a/compos/tests/java/android/compos/test/ComposTestCase.java
+++ b/compos/tests/java/android/compos/test/ComposTestCase.java
@@ -182,15 +182,8 @@
private void killVmAndReconnectAdb() throws Exception {
CommandRunner android = new CommandRunner(getDevice());
- // When a VM exits, we tend to see adb disconnecting. So we attempt to reconnect
- // when we kill it to avoid problems. Of course VirtualizationService may exit anyway
- // (it's an on-demand service and all its clients have gone), taking the VM with it,
- // which makes this a bit unpredictable.
- reconnectHostAdb(getDevice());
android.tryRun("killall", "crosvm");
- reconnectHostAdb(getDevice());
android.tryRun("stop", "virtualizationservice");
- reconnectHostAdb(getDevice());
// Delete stale data
android.tryRun("rm", "-rf", "/data/misc/virtualizationservice/*");
diff --git a/tests/hostside/helper/java/android/virt/test/VirtualizationTestCaseBase.java b/tests/hostside/helper/java/android/virt/test/VirtualizationTestCaseBase.java
index 40be248..d5c5d62 100644
--- a/tests/hostside/helper/java/android/virt/test/VirtualizationTestCaseBase.java
+++ b/tests/hostside/helper/java/android/virt/test/VirtualizationTestCaseBase.java
@@ -82,28 +82,12 @@
// disconnect from microdroid
tryRunOnHost("adb", "disconnect", MICRODROID_SERIAL);
- reconnectHostAdb(androidDevice);
-
// kill stale VMs and directories
android.tryRun("killall", "crosvm");
android.tryRun("stop", "virtualizationservice");
android.tryRun("rm", "-rf", "/data/misc/virtualizationservice/*");
}
- public static void reconnectHostAdb(ITestDevice androidDevice)
- throws DeviceNotAvailableException {
- CommandRunner android = new CommandRunner(androidDevice);
-
- // Make sure we're connected to the host adb; this connection seems to get dropped when a VM
- // exits.
- for (int retry = 0; retry < 10; ++retry) {
- if (android.tryRun("true") != null) {
- break;
- }
- androidDevice.waitForDeviceOnline(1000);
- }
- }
-
public static void testIfDeviceIsCapable(ITestDevice androidDevice) throws Exception {
assumeTrue("Need an actual TestDevice", androidDevice instanceof TestDevice);
TestDevice testDevice = (TestDevice) androidDevice;
@@ -344,34 +328,17 @@
// Shutdown the VM
android.run(VIRT_APEX + "bin/vm", "stop", cid);
-
- // TODO(192660485): Figure out why shutting down the VM disconnects adb on cuttlefish
- // temporarily. Without this wait, the rest of `runOnAndroid/skipIfFail` fails due to the
- // connection loss, and results in assumption error exception for the rest of the tests.
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- }
}
public static void rootMicrodroid() {
runOnHost("adb", "-s", MICRODROID_SERIAL, "root");
- // TODO(192660959): Figure out the root cause and remove the sleep. For unknown reason,
- // even though `adb root` actually wait-for-disconnect then wait-for-device, the next
- // `adb -s $MICRODROID_SERIAL shell ...` often fails with "adb: device offline".
- try {
- Thread.sleep(1000);
- runOnHostWithTimeout(
- MICRODROID_ADB_CONNECT_TIMEOUT_MINUTES * 60 * 1000,
- "adb",
- "-s",
- MICRODROID_SERIAL,
- "wait-for-device");
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- }
+ runOnHostWithTimeout(
+ MICRODROID_ADB_CONNECT_TIMEOUT_MINUTES * 60 * 1000,
+ "adb",
+ "-s",
+ MICRODROID_SERIAL,
+ "wait-for-device");
}
// Establish an adb connection to microdroid by letting Android forward the connection to
diff --git a/tests/testapk/src/java/com/android/microdroid/test/MicrodroidTests.java b/tests/testapk/src/java/com/android/microdroid/test/MicrodroidTests.java
index 36bea72..f7261d3 100644
--- a/tests/testapk/src/java/com/android/microdroid/test/MicrodroidTests.java
+++ b/tests/testapk/src/java/com/android/microdroid/test/MicrodroidTests.java
@@ -262,11 +262,6 @@
public void changingDebugLevelInvalidatesVmIdentity()
throws VirtualMachineException, InterruptedException, IOException {
assume()
- .withMessage("Skip on Cuttlefish. b/195765441")
- .that(android.os.Build.DEVICE)
- .isNotEqualTo("vsoc_x86_64");
-
- assume()
.withMessage("SKip on 5.4 kernel. b/218303240")
.that(KERNEL_VERSION)
.isNotEqualTo("5.4");
@@ -344,11 +339,6 @@
public void instancesOfSameVmHaveDifferentCdis()
throws VirtualMachineException, InterruptedException {
assume()
- .withMessage("Skip on Cuttlefish. b/195765441")
- .that(android.os.Build.DEVICE)
- .isNotEqualTo("vsoc_x86_64");
-
- assume()
.withMessage("SKip on 5.4 kernel. b/218303240")
.that(KERNEL_VERSION)
.isNotEqualTo("5.4");
@@ -368,11 +358,6 @@
public void sameInstanceKeepsSameCdis()
throws VirtualMachineException, InterruptedException {
assume()
- .withMessage("Skip on Cuttlefish. b/195765441")
- .that(android.os.Build.DEVICE)
- .isNotEqualTo("vsoc_x86_64");
-
- assume()
.withMessage("SKip on 5.4 kernel. b/218303240")
.that(KERNEL_VERSION)
.isNotEqualTo("5.4");
@@ -389,11 +374,6 @@
public void bccIsSuperficiallyWellFormed()
throws VirtualMachineException, InterruptedException, CborException {
assume()
- .withMessage("Skip on Cuttlefish. b/195765441")
- .that(android.os.Build.DEVICE)
- .isNotEqualTo("vsoc_x86_64");
-
- assume()
.withMessage("SKip on 5.4 kernel. b/218303240")
.that(KERNEL_VERSION)
.isNotEqualTo("5.4");
@@ -529,20 +509,12 @@
@Test
public void bootFailsWhenMicrodroidDataIsCompromised()
throws VirtualMachineException, InterruptedException, IOException {
- assume().withMessage("Skip on Cuttlefish. b/195765441")
- .that(android.os.Build.DEVICE)
- .isNotEqualTo("vsoc_x86_64");
-
assertThatBootFailsAfterCompromisingPartition(MICRODROID_PARTITION_UUID);
}
@Test
public void bootFailsWhenUBootAvbDataIsCompromised()
throws VirtualMachineException, InterruptedException, IOException {
- assume().withMessage("Skip on Cuttlefish. b/195765441")
- .that(android.os.Build.DEVICE)
- .isNotEqualTo("vsoc_x86_64");
-
if (mProtectedVm) {
assertThatBootFailsAfterCompromisingPartition(U_BOOT_AVB_PARTITION_UUID);
} else {
@@ -554,10 +526,6 @@
@Test
public void bootFailsWhenUBootEnvDataIsCompromised()
throws VirtualMachineException, InterruptedException, IOException {
- assume().withMessage("Skip on Cuttlefish. b/195765441")
- .that(android.os.Build.DEVICE)
- .isNotEqualTo("vsoc_x86_64");
-
if (mProtectedVm) {
assertThatBootFailsAfterCompromisingPartition(U_BOOT_ENV_PARTITION_UUID);
} else {
@@ -569,10 +537,6 @@
@Test
public void bootFailsWhenPvmFwDataIsCompromised()
throws VirtualMachineException, InterruptedException, IOException {
- assume().withMessage("Skip on Cuttlefish. b/195765441")
- .that(android.os.Build.DEVICE)
- .isNotEqualTo("vsoc_x86_64");
-
if (mProtectedVm) {
assertThatBootFailsAfterCompromisingPartition(PVM_FW_PARTITION_UUID);
} else {