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 | 15 get_default_board |
16 | 16 |
17 DEFINE_string board "$DEFAULT_BOARD" \ | 17 DEFINE_string board "$DEFAULT_BOARD" \ |
18 "The board for which you built autotest." | 18 "The board for which you built autotest." |
19 DEFINE_string image_path "" "Full path of the VM image" | 19 DEFINE_string image_path "" "Full path of the VM image" |
| 20 DEFINE_string results_dir_root "" "alternate root results directory" |
20 DEFINE_string test_case "" "Name of the test case to run" | 21 DEFINE_string test_case "" "Name of the test case to run" |
21 | 22 |
22 set -e | 23 set -e |
23 | 24 |
24 # Parse command line. | 25 # Parse command line. |
25 FLAGS "$@" || exit 1 | 26 FLAGS "$@" || exit 1 |
26 eval set -- "${FLAGS_ARGV}" | 27 eval set -- "${FLAGS_ARGV}" |
27 | 28 |
28 # Use latest if not specified. | 29 # Use latest if not specified. |
29 if [ -z "${FLAGS_image_path}" ]; then | 30 if [ -z "${FLAGS_image_path}" ]; then |
30 LATEST_IMAGE="$(${SCRIPTS_DIR}/get_latest_image.sh \ | 31 LATEST_IMAGE="$(${SCRIPTS_DIR}/get_latest_image.sh \ |
31 --board=${FLAGS_board})/${DEFAULT_QEMU_IMAGE}" | 32 --board=${FLAGS_board})/${DEFAULT_QEMU_IMAGE}" |
32 info "Using latest vm image ${LATEST_IMAGE}" | 33 info "Using latest vm image ${LATEST_IMAGE}" |
33 FLAGS_image_path=${LATEST_IMAGE} | 34 FLAGS_image_path=${LATEST_IMAGE} |
34 fi | 35 fi |
35 | 36 |
36 [ -e "${FLAGS_image_path}" ] || die "Image ${FLAGS_image_path} does not exist." | 37 [ -e "${FLAGS_image_path}" ] || die "Image ${FLAGS_image_path} does not exist." |
37 | 38 |
38 [ -n "${FLAGS_test_case}" ] || die "You must specify a test case." | 39 [ -n "${FLAGS_test_case}" ] || die "You must specify a test case." |
39 | 40 |
40 trap stop_kvm EXIT | 41 trap stop_kvm EXIT |
41 start_kvm "${FLAGS_image_path}" | 42 start_kvm "${FLAGS_image_path}" |
42 info "Checking for ssh access to virtual machine." | 43 info "Checking for ssh access to virtual machine." |
43 retry_until_ssh ${MAX_RETRIES} | 44 retry_until_ssh ${MAX_RETRIES} |
44 "$(dirname $0)"/../run_remote_tests.sh \ | 45 "$(dirname $0)"/../run_remote_tests.sh \ |
45 --board=${FLAGS_board} \ | 46 --board=${FLAGS_board} \ |
46 --ssh_port=${FLAGS_ssh_port} \ | 47 --ssh_port=${FLAGS_ssh_port} \ |
47 --remote=127.0.0.1 \ | 48 --remote=127.0.0.1 \ |
| 49 --results_dir_root="${FLAGS_results_dir_root}" \ |
48 "${FLAGS_test_case}" | 50 "${FLAGS_test_case}" |
OLD | NEW |