Add components to pass vm flag to dev server.

BUG=8306
TEST=Ran au_test_harness with CL for adding vm option for the devserver on the last channel release and my TOT.  All tests passed.

Review URL: http://codereview.chromium.org/4165009

Change-Id: Ia2ce305dff2911dc4008d5f6e383535e4bbd4ab0
This commit is contained in:
Chris Sosa 2010-10-28 23:46:20 -07:00
parent 695adf144a
commit 113739c109
3 changed files with 15 additions and 9 deletions

View File

@ -16,10 +16,11 @@ from cros_build_lib import ReinterpretPathForChroot
from cros_build_lib import RunCommand from cros_build_lib import RunCommand
from cros_build_lib import Warning from cros_build_lib import Warning
# VM Constants.
_KVM_PID_FILE = '/tmp/harness_pid'
_FULL_VDISK_SIZE = 6072 _FULL_VDISK_SIZE = 6072
_FULL_STATEFULFS_SIZE = 3074 _FULL_STATEFULFS_SIZE = 3074
_KVM_PID_FILE = '/tmp/harness_pid'
_VERIFY_SUITE = 'suite_Smoke'
# Globals to communicate options to unit tests. # Globals to communicate options to unit tests.
global base_image_path global base_image_path
@ -29,8 +30,6 @@ global target_image_path
global vm_graphics_flag global vm_graphics_flag
_VERIFY_SUITE = 'suite_Smoke'
class AUTest(object): class AUTest(object):
"""Abstract interface that defines an Auto Update test.""" """Abstract interface that defines an Auto Update test."""
source_image = '' source_image = ''
@ -249,11 +248,11 @@ class VirtualAUTest(unittest.TestCase, AUTest):
def PrepareBase(self): def PrepareBase(self):
"""Creates an update-able VM based on base image.""" """Creates an update-able VM based on base image."""
self.vm_image_path = '%s/chromiumos_qemu_image.bin' % os.path.dirname(
base_image_path)
self.vm_image_path = ('%s/chromiumos_qemu_image.bin' % os.path.dirname(
base_image_path))
if not os.path.exists(self.vm_image_path): if not os.path.exists(self.vm_image_path):
Info('Qemu image not found, creating one.') Info('Qemu image %s not found, creating one.' % self.vm_image_path)
RunCommand(['%s/image_to_vm.sh' % self.crosutils, RunCommand(['%s/image_to_vm.sh' % self.crosutils,
'--full', '--full',
'--from=%s' % ReinterpretPathForChroot( '--from=%s' % ReinterpretPathForChroot(
@ -263,7 +262,7 @@ class VirtualAUTest(unittest.TestCase, AUTest):
'--board=%s' % board, '--board=%s' % board,
'--test_image'], enter_chroot=True) '--test_image'], enter_chroot=True)
else: else:
Info('Using existing VM image') Info('Using existing VM image %s' % self.vm_image_path)
self.assertTrue(os.path.exists(self.vm_image_path)) self.assertTrue(os.path.exists(self.vm_image_path))
@ -317,6 +316,8 @@ if __name__ == '__main__':
parser.add_option('--no_delta', action='store_false', default=True, parser.add_option('--no_delta', action='store_false', default=True,
dest='delta', dest='delta',
help='Disable using delta updates.') help='Disable using delta updates.')
parser.add_option('-q', '--quick_test', default=False, action='store_true',
help='Use a basic test to verify image.')
# Set the usage to include flags. # Set the usage to include flags.
parser.set_usage(parser.format_help()) parser.set_usage(parser.format_help())
# Parse existing sys.argv so we can pass rest to unittest.main. # Parse existing sys.argv so we can pass rest to unittest.main.
@ -342,7 +343,7 @@ if __name__ == '__main__':
# Communicate flags to tests. # Communicate flags to tests.
vm_graphics_flag = '' vm_graphics_flag = ''
if options.no_graphics: vm_graphics_flag = '--no_graphics' if options.no_graphics: vm_graphics_flag = '--no_graphics'
if options.quick_test: _VERIFY_SUITE = 'build_RootFilesystemSize'
AUTest.use_delta_updates = options.delta AUTest.use_delta_updates = options.delta
# Only run the test harness we care about. # Only run the test harness we care about.

View File

@ -35,5 +35,6 @@ $(dirname $0)/../image_to_live.sh \
--stateful_update_flag=${FLAGS_stateful_update_flag} \ --stateful_update_flag=${FLAGS_stateful_update_flag} \
--src_image="${FLAGS_src_image}" \ --src_image="${FLAGS_src_image}" \
--verify \ --verify \
--for_vm \
--image=$(readlink -f ${FLAGS_update_image_path}) --image=$(readlink -f ${FLAGS_update_image_path})

View File

@ -32,6 +32,7 @@ DEFINE_string archive_dir "" \
"Update using the test image in the image.zip in this directory." a "Update using the test image in the image.zip in this directory." a
DEFINE_integer devserver_port 8080 \ DEFINE_integer devserver_port 8080 \
"Port to use for devserver." "Port to use for devserver."
DEFINE_boolean for_vm ${FLAGS_FALSE} "Image is for a vm."
DEFINE_string image "" \ DEFINE_string image "" \
"Update with this image path that is in this source checkout." i "Update with this image path that is in this source checkout." i
DEFINE_string src_image "" \ DEFINE_string src_image "" \
@ -129,6 +130,9 @@ function start_dev_server {
IMAGE_PATH="${IMAGE_PATH}/chromiumos_image.bin" IMAGE_PATH="${IMAGE_PATH}/chromiumos_image.bin"
fi fi
[ ${FLAGS_for_vm} -eq ${FLAGS_TRUE} ] && \
devserver_flags="${devserver_flags} --for_vm"
devserver_flags="${devserver_flags} \ devserver_flags="${devserver_flags} \
--src_image=\"$(reinterpret_path_for_chroot ${FLAGS_src_image})\"" --src_image=\"$(reinterpret_path_for_chroot ${FLAGS_src_image})\""