Revert "devinstall_test: Use cros_vm instead."
This reverts commit 2b725fd122c700afca8b5c67ca8d370e9154f77e.
Reason for revert: crbug.com/851073
Original change's description:
> devinstall_test: Use cros_vm instead.
>
> Use cros_vm instead of chromite/vm to remove a dependence on
> cros_start_vm.
>
> BUG=chromium:782664
> TEST=Run devinstall_test.py
> CQ-DEPEND=CL:982819
>
> Change-Id: I7fe665d5d0df8e5caef9ce5f3ec1369e1e56be88
> Reviewed-on: https://chromium-review.googlesource.com/982748
> Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
> Tested-by: Achuith Bhandarkar <achuith@chromium.org>
> Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Bug: chromium:782664
Change-Id: I49e349148a2e47f71afa9373844bc7588288fb50
Reviewed-on: https://chromium-review.googlesource.com/1093276
Reviewed-by: Achuith Bhandarkar <achuith@chromium.org>
Commit-Queue: Achuith Bhandarkar <achuith@chromium.org>
Tested-by: Achuith Bhandarkar <achuith@chromium.org>
Trybot-Ready: Achuith Bhandarkar <achuith@chromium.org>
diff --git a/devmode-test/devinstall_test.py b/devmode-test/devinstall_test.py
index 4d87e8f..f928087 100755
--- a/devmode-test/devinstall_test.py
+++ b/devmode-test/devinstall_test.py
@@ -30,7 +30,6 @@
from chromite.lib import osutils
from chromite.lib import remote_access
from chromite.lib import vm
-from chromite.scripts import cros_vm
from crostestutils.lib import mount_helper
from crostestutils.lib import test_helper
@@ -68,6 +67,7 @@
self.working_image_path = None
self.devserver = None
self.vm = None
+ self.device = None
def Cleanup(self):
"""Cleans up any state at the end of the test."""
@@ -75,6 +75,9 @@
if self.devserver:
self.devserver.Stop()
self.devserver = None
+ if self.device:
+ self.device.Cleanup()
+ self.device = None
if self.vm:
self.vm.Stop()
self.vm = None
@@ -111,13 +114,13 @@
logging.info('Wiping /usr/local/bin from the image.')
self._WipeDevInstall()
- vm_opts = cros_vm.VM.GetParser().parse_args(
- ['--image-path', self.working_image_path, '--vm-dir',
- os.path.join(self.tmpdir, 'cros_vm')])
- self.vm = cros_vm.VM(vm_opts)
- logging.info('Starting the vm on port %d.', self.vm.ssh_port)
+ self.vm = vm.VMInstance(self.working_image_path, tempdir=self.tmpdir)
+ logging.info('Starting the vm on port %d.', self.vm.port)
self.vm.Start()
+ self.device = remote_access.ChromiumOSDevice(
+ remote_access.LOCALHOST, port=self.vm.port, base_dir=self.tmpdir)
+
if not self.binhost:
logging.info('Starting the devserver.')
self.devserver = dev_server_wrapper.DevServerWrapper()
@@ -132,13 +135,13 @@
"""Tests that we can run dev-install and have python work afterwards."""
try:
logging.info('Running dev install in the vm.')
- self.vm.RemoteCommand(
+ self.device.RunCommand(
['bash', '-l', '-c',
'"/usr/bin/dev_install --yes --binhost %s"' % self.binhost])
logging.info('Verifying that python works on the image.')
- self.vm.RemoteCommand(['sudo', '-u', 'chronos', '--', 'python', '-c',
- '"print \'hello world\'"'])
+ self.device.RunCommand(['sudo', '-u', 'chronos', '--', 'python', '-c',
+ '"print \'hello world\'"'])
except (cros_build_lib.RunCommandError,
remote_access.SSHConnectionError) as e:
self.devserver.PrintLog()
@@ -150,7 +153,7 @@
"""Evaluates whether the test passed or failed."""
logging.info('Testing that gmerge works on the image after dev install.')
try:
- self.vm.RemoteCommand(
+ self.device.RunCommand(
['gmerge', 'gmerge', '--accept_stable', '--usepkg',
'--devserver_url', self.devserver.GetDevServerURL(
ip=self.HOST_IP_ADDRESS, port=self.devserver.port),