| Index: bin/cros_run_vm_test
|
| diff --git a/bin/cros_run_vm_test b/bin/cros_run_vm_test
|
| index 82b3b8fcd41ca0ed7db56a30f8be8e574682e195..6981745ac46e49da1d67e3a470985c993fb39739 100755
|
| --- a/bin/cros_run_vm_test
|
| +++ b/bin/cros_run_vm_test
|
| @@ -7,43 +7,14 @@
|
| # Runs a given test case under a VM.
|
|
|
| . "$(dirname $0)/../common.sh"
|
| +. "$(dirname $0)/../lib/cros_vm_lib.sh"
|
|
|
| DEFINE_string image_path "" "Full path of the VM image"
|
| -DEFINE_boolean no_graphics ${FLAGS_FALSE} "Runs the KVM instance silently"
|
| -DEFINE_integer ssh_port 9222 "Port to tunnel ssh traffic over"
|
| DEFINE_string test_case "" "Name of the test case to run"
|
|
|
| set -e
|
|
|
| -KVM_PID_FILE=/tmp/kvm.$$.pid
|
| -
|
| -# TODO(rtc): These flags assume that we'll be using KVM on Lucid and won't work
|
| -# on Hardy.
|
| -function start_kvm {
|
| - echo "Starting the KVM instance"
|
| - local nographics=""
|
| - if [ ${FLAGS_no_graphics} -eq ${FLAGS_TRUE} ]; then
|
| - nographics="-nographic"
|
| - fi
|
| - sudo kvm -m 1024 \
|
| - -vga std \
|
| - -pidfile "${KVM_PID_FILE}" \
|
| - -daemonize \
|
| - -net nic \
|
| - ${nographics} \
|
| - -net user,hostfwd=tcp::${FLAGS_ssh_port}-:22 \
|
| - -hda "${FLAGS_image_path}"
|
| -}
|
| -
|
| -function stop_kvm {
|
| - echo "Stopping the KVM instance"
|
| - local pid=$(sudo cat "${KVM_PID_FILE}")
|
| - echo "Killing ${pid}"
|
| - sudo kill ${pid}
|
| - sudo rm "${KVM_PID_FILE}"
|
| -}
|
| -
|
| -# Parse command line
|
| +# Parse command line.
|
| FLAGS "$@" || exit 1
|
| eval set -- "${FLAGS_ARGV}"
|
|
|
| @@ -51,7 +22,7 @@ eval set -- "${FLAGS_ARGV}"
|
| [ -n "${FLAGS_test_case}" ] || die "You must specify a test case"
|
|
|
| trap stop_kvm EXIT
|
| -start_kvm
|
| +start_kvm "${FLAGS_image_path}"
|
| "$(dirname $0)"/../run_remote_tests.sh \
|
| --ssh_port=${FLAGS_ssh_port} \
|
| --remote="${HOSTNAME}" \
|
|
|