| 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 # --- BEGIN COMMON.SH BOILERPLATE --- | 
| 10 . "$(dirname $0)/../lib/cros_vm_lib.sh" | 10 # Load common CrOS utilities.  Inside the chroot this file is installed in | 
| 11 . "$(dirname "$0")/../lib/cros_vm_constants.sh" | 11 # /usr/lib/crosutils.  Outside the chroot we find it relative to the script's | 
|  | 12 # location. | 
|  | 13 find_common_sh() { | 
|  | 14   local common_paths=(/usr/lib/crosutils "$(dirname "$(readlink -f "$0")")/..") | 
|  | 15   local path | 
|  | 16 | 
|  | 17   SCRIPT_ROOT= | 
|  | 18   for path in "${common_paths[@]}"; do | 
|  | 19     if [ -r "${path}/common.sh" ]; then | 
|  | 20       SCRIPT_ROOT=${path} | 
|  | 21       break | 
|  | 22     fi | 
|  | 23   done | 
|  | 24 } | 
|  | 25 | 
|  | 26 find_common_sh | 
|  | 27 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) | 
|  | 28 # --- END COMMON.SH BOILERPLATE --- | 
|  | 29 | 
|  | 30 . "${SCRIPT_ROOT}/lib/cros_vm_lib.sh" || die "Unable to load cros_vm_lib.sh" | 
|  | 31 . "${SCRIPT_ROOT}/lib/cros_vm_constants.sh" || \ | 
|  | 32   die "Unable to load cros_vm_constants.sh" | 
| 12 | 33 | 
| 13 MAX_RETRIES=3 | 34 MAX_RETRIES=3 | 
| 14 | 35 | 
| 15 get_default_board | 36 get_default_board | 
| 16 | 37 | 
| 17 DEFINE_string board "$DEFAULT_BOARD" \ | 38 DEFINE_string board "$DEFAULT_BOARD" \ | 
| 18     "The board for which you built autotest." b | 39     "The board for which you built autotest." b | 
| 19 DEFINE_string image_path "" "Full path of the VM image" | 40 DEFINE_string image_path "" "Full path of the VM image" | 
| 20 DEFINE_string results_dir_root "" "alternate root results directory" | 41 DEFINE_string results_dir_root "" "alternate root results directory" | 
| 21 DEFINE_string test_case "" "Name of the test case to run" | 42 DEFINE_string test_case "" "Name of the test case to run" | 
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 66 done | 87 done | 
| 67 | 88 | 
| 68 trap stop_kvm EXIT | 89 trap stop_kvm EXIT | 
| 69 start_kvm "${FLAGS_image_path}" | 90 start_kvm "${FLAGS_image_path}" | 
| 70 info "Checking for ssh access to virtual machine." | 91 info "Checking for ssh access to virtual machine." | 
| 71 retry_until_ssh ${MAX_RETRIES} | 92 retry_until_ssh ${MAX_RETRIES} | 
| 72 | 93 | 
| 73 if [ -n "${FLAGS_verify_chrome_version}" ]; then | 94 if [ -n "${FLAGS_verify_chrome_version}" ]; then | 
| 74   info "Verifying version of Chrome matches what we expect." | 95   info "Verifying version of Chrome matches what we expect." | 
| 75   if chrome_version_is_valid "${FLAGS_verify_chrome_version}"; then | 96   if chrome_version_is_valid "${FLAGS_verify_chrome_version}"; then | 
| 76     chrome_version_on_vm=$("$(dirname $0)/cros_get_chrome_version" \ | 97     chrome_version_on_vm=$("${SCRIPTS_DIR}/bin/cros_get_chrome_version" \ | 
| 77         --remote=127.0.0.1 \ | 98         --remote=127.0.0.1 \ | 
| 78         --ssh_port=${FLAGS_ssh_port}) | 99         --ssh_port=${FLAGS_ssh_port}) | 
| 79     [[ ${chrome_version_on_vm} == ${FLAGS_verify_chrome_version} ]] || \ | 100     [[ ${chrome_version_on_vm} == ${FLAGS_verify_chrome_version} ]] || \ | 
| 80         warn "CHROME_VERSION is no longer set.This check will be removed" | 101         warn "CHROME_VERSION is no longer set.This check will be removed" | 
| 81   else | 102   else | 
| 82     warn "${FLAGS_verify_chrome_version} is not a valid Chrome version" | 103     warn "${FLAGS_verify_chrome_version} is not a valid Chrome version" | 
| 83   fi | 104   fi | 
| 84 fi | 105 fi | 
| 85 | 106 | 
| 86 "$(dirname $0)"/../run_remote_tests.sh \ | 107 "${SCRIPTS_DIR}/run_remote_tests.sh" \ | 
| 87     --board=${FLAGS_board} \ | 108     --board=${FLAGS_board} \ | 
| 88     --ssh_port=${FLAGS_ssh_port} \ | 109     --ssh_port=${FLAGS_ssh_port} \ | 
| 89     --remote=127.0.0.1 \ | 110     --remote=127.0.0.1 \ | 
| 90     --results_dir_root="${FLAGS_results_dir_root}" \ | 111     --results_dir_root="${FLAGS_results_dir_root}" \ | 
| 91     ${USE_EMERGED} \ | 112     ${USE_EMERGED} \ | 
| 92     "${tests[@]}" | 113     "${tests[@]}" | 
| OLD | NEW | 
|---|