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
This commit is contained in:
Ken Mixter 2010-11-08 18:10:08 -08:00
parent ec5d7f0d2d
commit 08145697a5
3 changed files with 25 additions and 4 deletions

View File

@ -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=<test> 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[@]}"

View File

@ -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

View File

@ -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"