Make run_remote_tests also update the chroot autotest

Don't punish the good people trying to write python-only autotests by
requiring them to sit through a long build_autotest run to test
every change.  run_remote_tests and build_autotest both update
the chroot copy now.

Review URL: http://codereview.chromium.org/578027
This commit is contained in:
Ken Mixter 2010-02-05 19:22:35 -08:00
parent 1cca01402a
commit 8a4af3a999
3 changed files with 30 additions and 14 deletions

18
autotest_lib.sh Normal file
View File

@ -0,0 +1,18 @@
# 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.
#
# Provides common commands for dealing running/building autotest
# Populates the chroot's /usr/local/autotest directory based on
# the given source directory.
# args:
# $1 - original source directory
function update_chroot_autotest() {
local original=$1
echo "Updating chroot Autotest from ${original}..."
local autotest_dir="${DEFAULT_CHROOT_DIR}/usr/local/autotest"
sudo mkdir -p "${autotest_dir}"
sudo chmod 777 "${autotest_dir}"
cp -fpru ${original}/{client,conmux,server,tko,utils,global_config.ini,shadow_config.ini} ${autotest_dir}
}

View File

@ -14,6 +14,7 @@
# mod_image_for_test.sh.
. "$(dirname "$0")/common.sh"
. "$(dirname "$0")/autotest_lib.sh"
# Script must be run inside the chroot
assert_inside_chroot
@ -37,12 +38,7 @@ AUTOTEST_DEST="/usr/local/autotest"
# Copy a local "installation" of autotest into the chroot, to avoid
# polluting the src dir with tmp files, results, etc.
echo "Installing Autotest..."
sudo mkdir -p ${AUTOTEST_DEST}
sudo chmod 777 ${AUTOTEST_DEST}
cd ${CHROOT_TRUNK_DIR}/src/third_party/autotest/files
cp -fpru {client,conmux,server,tko,utils,global_config.ini,shadow_config.ini} \
${AUTOTEST_DEST}
update_chroot_autotest "${CHROOT_TRUNK_DIR}/src/third_party/autotest/files"
# Create python package init files for top level test case dirs.
function touchInitPy() {

View File

@ -10,6 +10,7 @@
# The path to common.sh should be relative to your script's location.
. "$(dirname $0)/common.sh"
. "$(dirname $0)/autotest_lib.sh"
. "$(dirname $0)/remote_access.sh"
DEFAULT_OUTPUT_FILE=test-output-$(date '+%Y%m%d.%H%M%S')
@ -103,7 +104,7 @@ function main() {
set -e
AUTOTEST_DIR="${DEFAULT_CHROOT_DIR}/usr/local/autotest"
local autotest_dir="${DEFAULT_CHROOT_DIR}/usr/local/autotest"
# Set global TMP for remote_access.sh's sake
TMP=$(mktemp -d /tmp/run_remote_tests.XXXX)
@ -112,17 +113,18 @@ function main() {
trap cleanup EXIT
# Check for installed autotest.
local autoserv="${AUTOTEST_DIR}/server/autoserv"
if [[ ! -f "${autoserv}" ]]; then
echo "Cannot find autotest in build dir. Run build_autotest.sh"
exit 1
fi
# Always copy into installed autotest directory. This way if a user
# is just modifying scripts, they take effect without having to wait
# for the laborious build_autotest.sh command.
local original="${GCLIENT_ROOT}/src/third_party/autotest/files"
update_chroot_autotest "${original}"
local autoserv="${autotest_dir}/server/autoserv"
local control_files_to_run=""
# Now search for tests which unambiguously include the given identifier
local search_path=$(echo ${AUTOTEST_DIR}/{client,server}/{tests,site_tests})
local search_path=$(echo ${autotest_dir}/{client,server}/{tests,site_tests})
for test_request in $FLAGS_ARGV; do
test_request=$(remove_quotes "${test_request}")
! finds=$(find ${search_path} -type f -name control | \