mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-11 06:56:58 +02:00
Add option to check version of Chrome on target.
Change-Id: I34e9d64656e04d4f5c477914512219d9b8563b78 BUG=chromium-os:9137 TEST=Ran with both wrong and right versions against a Google Chrome and Chromium build Review URL: http://codereview.chromium.org/4942001
This commit is contained in:
parent
b94e40293d
commit
4e75efa930
25
bin/cros_get_chrome_version
Executable file
25
bin/cros_get_chrome_version
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# Returns the version of Chrome running on a remote machine.
|
||||
|
||||
. "$(dirname $0)/../common.sh"
|
||||
. "$(dirname $0)/../remote_access.sh"
|
||||
|
||||
FLAGS "$@" || exit 1
|
||||
|
||||
set -e
|
||||
|
||||
# TMP necessary for remote_access_init.
|
||||
TMP=$(mktemp -d /tmp/cros_check_chrome_version.XXXX)
|
||||
trap "rm -rf ${TMP}" EXIT
|
||||
|
||||
remote_access_init &> /dev/null
|
||||
|
||||
remote_sh "/opt/google/chrome/chrome --version"
|
||||
CHROME_VERSION=$(echo ${REMOTE_OUT} | \
|
||||
sed 's/.* \([0-9]\+.[0-9]\+.[0-9]\+.[0-9]\+\).*/\1/')
|
||||
echo "${CHROME_VERSION}"
|
@ -21,9 +21,17 @@ DEFINE_string results_dir_root "" "alternate root results directory"
|
||||
DEFINE_string test_case "" "Name of the test case to run"
|
||||
DEFINE_boolean use_emerged ${FLAGS_FALSE} \
|
||||
"Force use of emerged autotest packages"
|
||||
DEFINE_string verify_chrome_version "" \
|
||||
"Verify that this chrome version matches that on vm."
|
||||
|
||||
set -e
|
||||
|
||||
# Returns normally if the given $1 is a valid chrome version.
|
||||
chrome_version_is_valid() {
|
||||
local chrome_version="$1"
|
||||
echo ${chrome_version} | egrep '^[0-9]+.[0-9]+.[0-9]+.[0-9]+$' &> /dev/null
|
||||
}
|
||||
|
||||
# Parse command line.
|
||||
FLAGS "$@" || exit 1
|
||||
|
||||
@ -61,6 +69,20 @@ trap stop_kvm EXIT
|
||||
start_kvm "${FLAGS_image_path}"
|
||||
info "Checking for ssh access to virtual machine."
|
||||
retry_until_ssh ${MAX_RETRIES}
|
||||
|
||||
if [ -n "${FLAGS_verify_chrome_version}" ]; then
|
||||
info "Verifying version of Chrome matches what we expect."
|
||||
if chrome_version_is_valid "${FLAGS_verify_chrome_version}"; then
|
||||
chrome_version_on_vm=$("$(dirname $0)/cros_get_chrome_version" \
|
||||
--remote=127.0.0.1 \
|
||||
--ssh_port=${FLAGS_ssh_port})
|
||||
[[ ${chrome_version_on_vm} == ${FLAGS_verify_chrome_version} ]] || \
|
||||
die "Chrome version mismatch. VM reported ${chrome_version_on_vm}"
|
||||
else
|
||||
warn "${FLAGS_verify_chrome_version} is not a valid Chrome version"
|
||||
fi
|
||||
fi
|
||||
|
||||
"$(dirname $0)"/../run_remote_tests.sh \
|
||||
--board=${FLAGS_board} \
|
||||
--ssh_port=${FLAGS_ssh_port} \
|
||||
|
Loading…
Reference in New Issue
Block a user