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 # --- BEGIN COMMON.SH BOILERPLATE --- | 9 # --- BEGIN COMMON.SH BOILERPLATE --- |
10 # Load common CrOS utilities. Inside the chroot this file is installed in | 10 # Load common CrOS utilities. Inside the chroot this file is installed in |
(...skipping 13 matching lines...) Expand all Loading... |
24 } | 24 } |
25 | 25 |
26 find_common_sh | 26 find_common_sh |
27 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) | 27 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) |
28 # --- END COMMON.SH BOILERPLATE --- | 28 # --- END COMMON.SH BOILERPLATE --- |
29 | 29 |
30 . "${SCRIPT_ROOT}/lib/cros_vm_lib.sh" || die "Unable to load cros_vm_lib.sh" | 30 . "${SCRIPT_ROOT}/lib/cros_vm_lib.sh" || die "Unable to load cros_vm_lib.sh" |
31 . "${SCRIPT_ROOT}/lib/cros_vm_constants.sh" || \ | 31 . "${SCRIPT_ROOT}/lib/cros_vm_constants.sh" || \ |
32 die "Unable to load cros_vm_constants.sh" | 32 die "Unable to load cros_vm_constants.sh" |
33 | 33 |
34 MAX_RETRIES=3 | |
35 | |
36 get_default_board | 34 get_default_board |
37 | 35 |
38 DEFINE_string board "$DEFAULT_BOARD" \ | 36 DEFINE_string board "$DEFAULT_BOARD" \ |
39 "The board for which you built autotest." b | 37 "The board for which you built autotest." b |
40 DEFINE_string image_path "" "Full path of the VM image" | 38 DEFINE_string image_path "" "Full path of the VM image" |
41 DEFINE_string results_dir_root "" "alternate root results directory" | 39 DEFINE_string results_dir_root "" "alternate root results directory" |
42 DEFINE_string test_case "" "Name of the test case to run" | 40 DEFINE_string test_case "" "Name of the test case to run" |
43 DEFINE_boolean use_emerged ${FLAGS_FALSE} \ | 41 DEFINE_boolean use_emerged ${FLAGS_FALSE} \ |
44 "Force use of emerged autotest packages" | 42 "Force use of emerged autotest packages" |
45 DEFINE_string verify_chrome_version "" \ | 43 DEFINE_string verify_chrome_version "" \ |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 fi | 79 fi |
82 | 80 |
83 tests=( ) | 81 tests=( ) |
84 [ -n "${FLAGS_test_case}" ] && tests=( "${FLAGS_test_case}" ) | 82 [ -n "${FLAGS_test_case}" ] && tests=( "${FLAGS_test_case}" ) |
85 for test in ${FLAGS_ARGV}; do | 83 for test in ${FLAGS_ARGV}; do |
86 tests=( "${tests[@]}" "$(remove_quotes "${test}")" ) | 84 tests=( "${tests[@]}" "$(remove_quotes "${test}")" ) |
87 done | 85 done |
88 | 86 |
89 trap stop_kvm EXIT | 87 trap stop_kvm EXIT |
90 start_kvm "${FLAGS_image_path}" | 88 start_kvm "${FLAGS_image_path}" |
91 info "Checking for ssh access to virtual machine." | 89 retry_until_ssh |
92 retry_until_ssh ${MAX_RETRIES} | |
93 | 90 |
94 if [ -n "${FLAGS_verify_chrome_version}" ]; then | 91 if [ -n "${FLAGS_verify_chrome_version}" ]; then |
95 info "Verifying version of Chrome matches what we expect." | 92 info "Verifying version of Chrome matches what we expect." |
96 if chrome_version_is_valid "${FLAGS_verify_chrome_version}"; then | 93 if chrome_version_is_valid "${FLAGS_verify_chrome_version}"; then |
97 chrome_version_on_vm=$("${SCRIPTS_DIR}/bin/cros_get_chrome_version" \ | 94 chrome_version_on_vm=$("${SCRIPTS_DIR}/bin/cros_get_chrome_version" \ |
98 --remote=127.0.0.1 \ | 95 --remote=127.0.0.1 \ |
99 --ssh_port=${FLAGS_ssh_port}) | 96 --ssh_port=${FLAGS_ssh_port}) |
100 [[ ${chrome_version_on_vm} == ${FLAGS_verify_chrome_version} ]] || \ | 97 [[ ${chrome_version_on_vm} == ${FLAGS_verify_chrome_version} ]] || \ |
101 warn "CHROME_VERSION is no longer set.This check will be removed" | 98 warn "CHROME_VERSION is no longer set.This check will be removed" |
102 else | 99 else |
103 warn "${FLAGS_verify_chrome_version} is not a valid Chrome version" | 100 warn "${FLAGS_verify_chrome_version} is not a valid Chrome version" |
104 fi | 101 fi |
105 fi | 102 fi |
106 | 103 |
107 "${SCRIPTS_DIR}/run_remote_tests.sh" \ | 104 "${SCRIPTS_DIR}/run_remote_tests.sh" \ |
108 --board=${FLAGS_board} \ | 105 --board=${FLAGS_board} \ |
109 --ssh_port=${FLAGS_ssh_port} \ | 106 --ssh_port=${FLAGS_ssh_port} \ |
110 --remote=127.0.0.1 \ | 107 --remote=127.0.0.1 \ |
111 --results_dir_root="${FLAGS_results_dir_root}" \ | 108 --results_dir_root="${FLAGS_results_dir_root}" \ |
112 ${USE_EMERGED} \ | 109 ${USE_EMERGED} \ |
113 "${tests[@]}" | 110 "${tests[@]}" |
OLD | NEW |