Remove reconnectHostAdb hack

The hack was to work around a kernel bug where adb connection is
unexpectedly lost when a VM exits. Now the bug is fixed, remove the
hack.

Bug: 192660485
Test: ComposHostTestCases
Change-Id: I732647d79efe9702fdd16f34bdbe60db6b235189
This commit is contained in:
Jiyong Park 2022-04-04 20:37:29 +09:00
parent 9f2ca1ee34
commit 16aef92759
2 changed files with 0 additions and 23 deletions

View File

@ -182,15 +182,8 @@ public final class ComposTestCase extends VirtualizationTestCaseBase {
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/*");

View File

@ -82,28 +82,12 @@ public abstract class VirtualizationTestCaseBase extends BaseHostJUnit4Test {
// 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;