From 08145697a5e6a5d07c2ba47e28de0d3804e6980e Mon Sep 17 00:00:00 2001 From: Ken Mixter Date: Mon, 8 Nov 2010 18:10:08 -0800 Subject: [PATCH] crosutils: Add vnc view of tests running multiple tests for VM tests Change-Id: I87c41e60797848192cee1f0c165215fcec8f5bd2 BUG=8850 TEST=Ran a few tests including suite_Smoke Review URL: http://codereview.chromium.org/4647001 --- bin/cros_run_vm_test | 18 +++++++++++++++--- bin/cros_start_vm | 7 ++++++- lib/cros_vm_lib.sh | 4 ++++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/bin/cros_run_vm_test b/bin/cros_run_vm_test index cef3d115b9..6f5ded2f72 100755 --- a/bin/cros_run_vm_test +++ b/bin/cros_run_vm_test @@ -24,7 +24,6 @@ set -e # Parse command line. FLAGS "$@" || exit 1 -eval set -- "${FLAGS_ARGV}" # Use latest if not specified. if [ -z "${FLAGS_image_path}" ]; then @@ -36,7 +35,20 @@ fi [ -e "${FLAGS_image_path}" ] || die "Image ${FLAGS_image_path} does not exist." -[ -n "${FLAGS_test_case}" ] || die "You must specify a test case." +if [ -n "${FLAGS_test_case}" ]; then + warn "Use of --test_case= is being deprecated. Just pass test names \ +as separate command line arguments." +fi + +if [ -z "${FLAGS_test_case}" ] && [ -z "${FLAGS_ARGV}" ]; then + die "You must specify a test case." +fi + +tests=( ) +[ -n "${FLAGS_test_case}" ] && tests=( "${FLAGS_test_case}" ) +for test in ${FLAGS_ARGV}; do + tests=( "${tests[@]}" "$(remove_quotes "${test}")" ) +done trap stop_kvm EXIT start_kvm "${FLAGS_image_path}" @@ -47,4 +59,4 @@ retry_until_ssh ${MAX_RETRIES} --ssh_port=${FLAGS_ssh_port} \ --remote=127.0.0.1 \ --results_dir_root="${FLAGS_results_dir_root}" \ - "${FLAGS_test_case}" + "${tests[@]}" diff --git a/bin/cros_start_vm b/bin/cros_start_vm index 3ecced9f69..6307920349 100755 --- a/bin/cros_start_vm +++ b/bin/cros_start_vm @@ -10,6 +10,10 @@ . "$(dirname $0)/../lib/cros_vm_lib.sh" . "$(dirname "$0")/../lib/cros_vm_constants.sh" +get_default_board + +DEFINE_string board "${DEFAULT_BOARD}" \ + "Board for VM image (unnecessary if path given)" DEFINE_string image_path "" "Full path of the VM image" set -e @@ -20,7 +24,8 @@ eval set -- "${FLAGS_ARGV}" # Use latest if not specified. if [ -z "${FLAGS_image_path}" ]; then - LATEST_IMAGE="$(${SCRIPTS_DIR}/get_latest_image.sh)/${DEFAULT_QEMU_IMAGE}" + LATEST_IMAGE="$(${SCRIPTS_DIR}/get_latest_image.sh \ + --board=${FLAGS_board})/${DEFAULT_QEMU_IMAGE}" info "Using latest vm image ${LATEST_IMAGE}" FLAGS_image_path=${LATEST_IMAGE} fi diff --git a/lib/cros_vm_lib.sh b/lib/cros_vm_lib.sh index afa481e8fb..7a99cbebe2 100644 --- a/lib/cros_vm_lib.sh +++ b/lib/cros_vm_lib.sh @@ -10,6 +10,7 @@ DEFINE_boolean no_graphics ${FLAGS_FALSE} "Runs the KVM instance silently." DEFINE_boolean persist "${FLAGS_FALSE}" "Persist vm." DEFINE_boolean snapshot ${FLAGS_FALSE} "Don't commit changes to image." DEFINE_integer ssh_port 9222 "Port to tunnel ssh traffic over." +DEFINE_string vnc "" "VNC Server to display to instead of SDL." KVM_PID_FILE=/tmp/kvm.$$.pid LIVE_VM_IMAGE= @@ -42,6 +43,9 @@ function start_kvm() { if [ ${FLAGS_no_graphics} -eq ${FLAGS_TRUE} ]; then nographics="-nographic -serial none" fi + if [ -n "${FLAGS_vnc}" ]; then + nographics="-vnc ${FLAGS_vnc}" + fi if [ ${FLAGS_snapshot} -eq ${FLAGS_TRUE} ]; then snapshot="-snapshot"