Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Side by Side Diff: cros_run_vm_test

Issue 6736023: Install test scripts into chroot. (Closed) Base URL: http://git.chromium.org/git/crostestutils.git@master
Patch Set: Remove vm scripts from makefile Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « au_test_harness/vm_au_worker.py ('k') | cros_run_vm_update » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "$(readlink -f "$0")")/outside_chroot_common.sh 2> /dev/null || 9 # This can only run outside the chroot.
10 SCRIPT_ROOT=/usr/lib/crosutils 10 . $(dirname "$(readlink -f "$0")")/outside_chroot_common.sh || exit 1
11 . "${SCRIPT_ROOT}/common.sh" || 11 . "${SCRIPT_ROOT}/common.sh" || exit 1
12 (echo "Unable to load common.sh" && false) ||
13 exit 1
14 . "${SCRIPT_ROOT}/lib/cros_vm_lib.sh" || die "Unable to load cros_vm_lib.sh" 12 . "${SCRIPT_ROOT}/lib/cros_vm_lib.sh" || die "Unable to load cros_vm_lib.sh"
15 . "${SCRIPT_ROOT}/lib/cros_vm_constants.sh" || \ 13 . "${SCRIPT_ROOT}/lib/cros_vm_constants.sh" ||
16 die "Unable to load cros_vm_constants.sh" 14 die "Unable to load cros_vm_constants.sh"
17 15
18 get_default_board 16 get_default_board
19 17
20 DEFINE_string board "$DEFAULT_BOARD" \ 18 DEFINE_string board "$DEFAULT_BOARD" \
21 "The board for which you built autotest." b 19 "The board for which you built autotest." b
22 DEFINE_string image_path "" "Full path of the VM image" 20 DEFINE_string image_path "" "Full path of the VM image"
23 DEFINE_string results_dir_root "" "alternate root results directory" 21 DEFINE_string results_dir_root "" "alternate root results directory"
24 DEFINE_string test_case "" "Name of the test case to run" 22 DEFINE_string test_case "" "Name of the test case to run"
25 DEFINE_boolean use_emerged ${FLAGS_FALSE} \ 23 DEFINE_boolean use_emerged ${FLAGS_FALSE} \
26 "Force use of emerged autotest packages" 24 "Force use of emerged autotest packages"
27 DEFINE_string verify_chrome_version "" \
28 "Verify that this chrome version matches that on vm."
29 25
30 set -e 26 set -e
31 27
32 # Returns normally if the given $1 is a valid chrome version. 28 # Returns normally if the given $1 is a valid chrome version.
33 chrome_version_is_valid() { 29 chrome_version_is_valid() {
34 local chrome_version="$1" 30 local chrome_version="$1"
35 echo ${chrome_version} | egrep '^[0-9]+.[0-9]+.[0-9]+.[0-9]+$' &> /dev/null 31 echo ${chrome_version} | egrep '^[0-9]+.[0-9]+.[0-9]+.[0-9]+$' &> /dev/null
36 } 32 }
37 33
38 # Parse command line. 34 # Parse command line.
39 FLAGS "$@" || exit 1 35 FLAGS "$@" || exit 1
40 36
41 # Use latest if not specified. 37 # Use latest if not specified.
42 if [ -z "${FLAGS_image_path}" ]; then 38 if [ -z "${FLAGS_image_path}" ]; then
43 LATEST_IMAGE="$(${SCRIPTS_DIR}/get_latest_image.sh \ 39 LATEST_IMAGE="$("${SCRIPT_ROOT}/get_latest_image.sh" \
44 --board=${FLAGS_board})/${DEFAULT_QEMU_IMAGE}" 40 --board=${FLAGS_board})/${DEFAULT_QEMU_IMAGE}"
45 info "Using latest vm image ${LATEST_IMAGE}" 41 info "Using latest vm image ${LATEST_IMAGE}"
46 FLAGS_image_path=${LATEST_IMAGE} 42 FLAGS_image_path=${LATEST_IMAGE}
47 fi 43 fi
48 44
49 [ -e "${FLAGS_image_path}" ] || die "Image ${FLAGS_image_path} does not exist." 45 [ -e "${FLAGS_image_path}" ] || die "Image ${FLAGS_image_path} does not exist."
50 46
51 if [ -n "${FLAGS_test_case}" ]; then 47 if [ -n "${FLAGS_test_case}" ]; then
52 warn "Use of --test_case=<test> is being deprecated. Just pass test names \ 48 warn "Use of --test_case=<test> is being deprecated. Just pass test names \
53 as separate command line arguments." 49 as separate command line arguments."
(...skipping 11 matching lines...) Expand all
65 tests=( ) 61 tests=( )
66 [ -n "${FLAGS_test_case}" ] && tests=( "${FLAGS_test_case}" ) 62 [ -n "${FLAGS_test_case}" ] && tests=( "${FLAGS_test_case}" )
67 for test in ${FLAGS_ARGV}; do 63 for test in ${FLAGS_ARGV}; do
68 tests=( "${tests[@]}" "$(remove_quotes "${test}")" ) 64 tests=( "${tests[@]}" "$(remove_quotes "${test}")" )
69 done 65 done
70 66
71 trap stop_kvm EXIT 67 trap stop_kvm EXIT
72 start_kvm "${FLAGS_image_path}" 68 start_kvm "${FLAGS_image_path}"
73 retry_until_ssh 69 retry_until_ssh
74 70
75 if [ -n "${FLAGS_verify_chrome_version}" ]; then 71 "${SCRIPT_ROOT}/enter_chroot.sh" -- run_remote_tests.sh \
76 info "Verifying version of Chrome matches what we expect."
77 if chrome_version_is_valid "${FLAGS_verify_chrome_version}"; then
78 chrome_version_on_vm=$("${SCRIPTS_DIR}/bin/cros_get_chrome_version" \
79 --remote=127.0.0.1 \
80 --ssh_port=${FLAGS_ssh_port})
81 [[ ${chrome_version_on_vm} == ${FLAGS_verify_chrome_version} ]] || \
82 warn "CHROME_VERSION is no longer set.This check will be removed"
83 else
84 warn "${FLAGS_verify_chrome_version} is not a valid Chrome version"
85 fi
86 fi
87
88 "${SCRIPTS_DIR}/run_remote_tests.sh" \
89 --board=${FLAGS_board} \ 72 --board=${FLAGS_board} \
90 --ssh_port=${FLAGS_ssh_port} \ 73 --ssh_port=${FLAGS_ssh_port} \
91 --remote=127.0.0.1 \ 74 --remote=127.0.0.1 \
92 --results_dir_root="${FLAGS_results_dir_root}" \ 75 --results_dir_root="${FLAGS_results_dir_root}" \
93 ${USE_EMERGED} \ 76 ${USE_EMERGED} \
94 "${tests[@]}" 77 "${tests[@]}"
OLDNEW
« no previous file with comments | « au_test_harness/vm_au_worker.py ('k') | cros_run_vm_update » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698