OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 # | 6 # |
7 # Runs a given test case under a VM. | 7 # Runs a given test case under a VM. |
8 | 8 |
9 . "$(dirname $0)/../common.sh" | 9 . "$(dirname $0)/../common.sh" |
10 . "$(dirname $0)/../lib/cros_vm_lib.sh" | 10 . "$(dirname $0)/../lib/cros_vm_lib.sh" |
11 . "$(dirname "$0")/../lib/cros_vm_constants.sh" | 11 . "$(dirname "$0")/../lib/cros_vm_constants.sh" |
12 | 12 |
13 MAX_RETRIES=3 | 13 MAX_RETRIES=3 |
14 | 14 |
| 15 get_default_board |
| 16 |
| 17 DEFINE_string board "$DEFAULT_BOARD" \ |
| 18 "The board for which you built autotest." |
15 DEFINE_string image_path "" "Full path of the VM image" | 19 DEFINE_string image_path "" "Full path of the VM image" |
16 DEFINE_string test_case "" "Name of the test case to run" | 20 DEFINE_string test_case "" "Name of the test case to run" |
17 | 21 |
18 set -e | 22 set -e |
19 | 23 |
20 # Parse command line. | 24 # Parse command line. |
21 FLAGS "$@" || exit 1 | 25 FLAGS "$@" || exit 1 |
22 eval set -- "${FLAGS_ARGV}" | 26 eval set -- "${FLAGS_ARGV}" |
23 | 27 |
24 # Use latest if not specified. | 28 # Use latest if not specified. |
25 if [ -z "${FLAGS_image_path}" ]; then | 29 if [ -z "${FLAGS_image_path}" ]; then |
26 LATEST_IMAGE="$(${SCRIPTS_DIR}/get_latest_image.sh)/${DEFAULT_QEMU_IMAGE}" | 30 LATEST_IMAGE="$(${SCRIPTS_DIR}/get_latest_image.sh \ |
| 31 --board=${FLAGS_board})/${DEFAULT_QEMU_IMAGE}" |
27 info "Using latest vm image ${LATEST_IMAGE}" | 32 info "Using latest vm image ${LATEST_IMAGE}" |
28 FLAGS_image_path=${LATEST_IMAGE} | 33 FLAGS_image_path=${LATEST_IMAGE} |
29 fi | 34 fi |
30 | 35 |
31 [ -e "${FLAGS_image_path}" ] || die "Image ${FLAGS_image_path} does not exist." | 36 [ -e "${FLAGS_image_path}" ] || die "Image ${FLAGS_image_path} does not exist." |
32 | 37 |
33 [ -n "${FLAGS_test_case}" ] || die "You must specify a test case." | 38 [ -n "${FLAGS_test_case}" ] || die "You must specify a test case." |
34 | 39 |
35 trap stop_kvm EXIT | 40 trap stop_kvm EXIT |
36 start_kvm "${FLAGS_image_path}" | 41 start_kvm "${FLAGS_image_path}" |
37 info "Checking for ssh access to virtual machine." | 42 info "Checking for ssh access to virtual machine." |
38 retry_until_ssh ${MAX_RETRIES} | 43 retry_until_ssh ${MAX_RETRIES} |
39 "$(dirname $0)"/../run_remote_tests.sh \ | 44 "$(dirname $0)"/../run_remote_tests.sh \ |
| 45 --board=${FLAGS_board} \ |
40 --ssh_port=${FLAGS_ssh_port} \ | 46 --ssh_port=${FLAGS_ssh_port} \ |
41 --remote=127.0.0.1 \ | 47 --remote=127.0.0.1 \ |
42 "${FLAGS_test_case}" | 48 "${FLAGS_test_case}" |
OLD | NEW |