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

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: Fix path for chroot 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
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 inside the chroot.
10 SCRIPT_ROOT=/usr/lib/crosutils 10 . "/usr/lib/crosutils/common.sh" 2> /dev/null ||
petkov 2011/03/30 14:32:16 msb changed this in a few places to just source co
sosa 2011/03/30 18:35:50 Done.
11 . "${SCRIPT_ROOT}/common.sh" || 11 (echo "Must run within chroot" && false) ||
12 (echo "Unable to load common.sh" && false) ||
13 exit 1 12 exit 1
14 . "${SCRIPT_ROOT}/lib/cros_vm_lib.sh" || die "Unable to load cros_vm_lib.sh" 13 . "/usr/lib/crosutils/lib/cros_vm_lib.sh" || die "Unable to load cros_vm_lib.sh"
petkov 2011/03/30 14:32:16 it might be worth defining CROSUTILS and using it
sosa 2011/03/30 18:35:50 Done.
15 . "${SCRIPT_ROOT}/lib/cros_vm_constants.sh" || \ 14 . "/usr/lib/crosutils/lib/cros_vm_constants.sh" || \
petkov 2011/03/30 14:32:16 no need for trailing \
sosa 2011/03/30 18:35:50 Done.
16 die "Unable to load cros_vm_constants.sh" 15 die "Unable to load cros_vm_constants.sh"
17 16
18 get_default_board 17 get_default_board
19 18
20 DEFINE_string board "$DEFAULT_BOARD" \ 19 DEFINE_string board "$DEFAULT_BOARD" \
21 "The board for which you built autotest." b 20 "The board for which you built autotest." b
22 DEFINE_string image_path "" "Full path of the VM image" 21 DEFINE_string image_path "" "Full path of the VM image"
23 DEFINE_string results_dir_root "" "alternate root results directory" 22 DEFINE_string results_dir_root "" "alternate root results directory"
24 DEFINE_string test_case "" "Name of the test case to run" 23 DEFINE_string test_case "" "Name of the test case to run"
25 DEFINE_boolean use_emerged ${FLAGS_FALSE} \ 24 DEFINE_boolean use_emerged ${FLAGS_FALSE} \
26 "Force use of emerged autotest packages" 25 "Force use of emerged autotest packages"
27 DEFINE_string verify_chrome_version "" \
28 "Verify that this chrome version matches that on vm."
29 26
30 set -e 27 set -e
31 28
32 # Returns normally if the given $1 is a valid chrome version. 29 # Returns normally if the given $1 is a valid chrome version.
33 chrome_version_is_valid() { 30 chrome_version_is_valid() {
34 local chrome_version="$1" 31 local chrome_version="$1"
35 echo ${chrome_version} | egrep '^[0-9]+.[0-9]+.[0-9]+.[0-9]+$' &> /dev/null 32 echo ${chrome_version} | egrep '^[0-9]+.[0-9]+.[0-9]+.[0-9]+$' &> /dev/null
36 } 33 }
37 34
38 # Parse command line. 35 # Parse command line.
39 FLAGS "$@" || exit 1 36 FLAGS "$@" || exit 1
40 37
41 # Use latest if not specified. 38 # Use latest if not specified.
42 if [ -z "${FLAGS_image_path}" ]; then 39 if [ -z "${FLAGS_image_path}" ]; then
43 LATEST_IMAGE="$(${SCRIPTS_DIR}/get_latest_image.sh \ 40 LATEST_IMAGE="$(/usr/lib/crosutils/get_latest_image.sh \
44 --board=${FLAGS_board})/${DEFAULT_QEMU_IMAGE}" 41 --board=${FLAGS_board})/${DEFAULT_QEMU_IMAGE}"
45 info "Using latest vm image ${LATEST_IMAGE}" 42 info "Using latest vm image ${LATEST_IMAGE}"
46 FLAGS_image_path=${LATEST_IMAGE} 43 FLAGS_image_path=${LATEST_IMAGE}
47 fi 44 fi
48 45
49 [ -e "${FLAGS_image_path}" ] || die "Image ${FLAGS_image_path} does not exist." 46 [ -e "${FLAGS_image_path}" ] || die "Image ${FLAGS_image_path} does not exist."
50 47
51 if [ -n "${FLAGS_test_case}" ]; then 48 if [ -n "${FLAGS_test_case}" ]; then
52 warn "Use of --test_case=<test> is being deprecated. Just pass test names \ 49 warn "Use of --test_case=<test> is being deprecated. Just pass test names \
53 as separate command line arguments." 50 as separate command line arguments."
(...skipping 11 matching lines...) Expand all
65 tests=( ) 62 tests=( )
66 [ -n "${FLAGS_test_case}" ] && tests=( "${FLAGS_test_case}" ) 63 [ -n "${FLAGS_test_case}" ] && tests=( "${FLAGS_test_case}" )
67 for test in ${FLAGS_ARGV}; do 64 for test in ${FLAGS_ARGV}; do
68 tests=( "${tests[@]}" "$(remove_quotes "${test}")" ) 65 tests=( "${tests[@]}" "$(remove_quotes "${test}")" )
69 done 66 done
70 67
71 trap stop_kvm EXIT 68 trap stop_kvm EXIT
72 start_kvm "${FLAGS_image_path}" 69 start_kvm "${FLAGS_image_path}"
73 retry_until_ssh 70 retry_until_ssh
74 71
75 if [ -n "${FLAGS_verify_chrome_version}" ]; then 72 run_remote_tests.sh \
sosa 2011/03/30 01:09:42 No one uses this
petkov 2011/03/30 14:32:16 you're relying on crosutils to be on the path? why
sosa 2011/03/30 18:35:50 All scripts (non-symlinks) in src/scripts are inst
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} \ 73 --board=${FLAGS_board} \
90 --ssh_port=${FLAGS_ssh_port} \ 74 --ssh_port=${FLAGS_ssh_port} \
91 --remote=127.0.0.1 \ 75 --remote=127.0.0.1 \
92 --results_dir_root="${FLAGS_results_dir_root}" \ 76 --results_dir_root="${FLAGS_results_dir_root}" \
93 ${USE_EMERGED} \ 77 ${USE_EMERGED} \
94 "${tests[@]}" 78 "${tests[@]}"
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698