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>
diff --git a/devmode-test/devinstall_test.py b/devmode-test/devinstall_test.py
index f928087..4d87e8f 100755
--- a/devmode-test/devinstall_test.py
+++ b/devmode-test/devinstall_test.py
@@ -30,6 +30,7 @@
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
@@ -67,7 +68,6 @@
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,9 +75,6 @@
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
@@ -114,13 +111,13 @@
logging.info('Wiping /usr/local/bin from the image.')
self._WipeDevInstall()
- self.vm = vm.VMInstance(self.working_image_path, tempdir=self.tmpdir)
- logging.info('Starting the vm on port %d.', self.vm.port)
+ 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.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()
@@ -135,13 +132,13 @@
"""Tests that we can run dev-install and have python work afterwards."""
try:
logging.info('Running dev install in the vm.')
- self.device.RunCommand(
+ self.vm.RemoteCommand(
['bash', '-l', '-c',
'"/usr/bin/dev_install --yes --binhost %s"' % self.binhost])
logging.info('Verifying that python works on the image.')
- self.device.RunCommand(['sudo', '-u', 'chronos', '--', 'python', '-c',
- '"print \'hello world\'"'])
+ self.vm.RemoteCommand(['sudo', '-u', 'chronos', '--', 'python', '-c',
+ '"print \'hello world\'"'])
except (cros_build_lib.RunCommandError,
remote_access.SSHConnectionError) as e:
self.devserver.PrintLog()
@@ -153,7 +150,7 @@
"""Evaluates whether the test passed or failed."""
logging.info('Testing that gmerge works on the image after dev install.')
try:
- self.device.RunCommand(
+ self.vm.RemoteCommand(
['gmerge', 'gmerge', '--accept_stable', '--usepkg',
'--devserver_url', self.devserver.GetDevServerURL(
ip=self.HOST_IP_ADDRESS, port=self.devserver.port),