Remove the dependency to autotest_run.sh so I can get rid of it in next CL.

Change-Id: Ieaa2553612aefd6161785185350d495cbf0dad81

BUG=9291
TEST=Run storageFio test since it need prebuild test and deps.

w/wo emerge autotest
w/wo cros_workon
in/outside of chroot.
w/wo --used_emerged
w/wo --results_dir_root

and all its combinations.

Review URL: http://codereview.chromium.org/5212003
This commit is contained in:
Eric Li 2010-11-19 10:43:47 -08:00
parent 3e689730e4
commit 6f209d1333
2 changed files with 11 additions and 85 deletions

View File

@ -1,74 +0,0 @@
#!/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.
# This script is intended as a wrapper to execute autotest tests for a given
# board.
# Load common constants. This should be the first executable line.
# The path to common.sh should be relative to your script's location.
. "$(dirname "$0")/common.sh"
# Script must be run inside the chroot
restart_in_chroot_if_needed $*
get_default_board
DEFINE_string board "${DEFAULT_BOARD}" \
"The board to run tests for."
FLAGS_HELP="usage: $0 <flags>"
FLAGS "$@" || exit 1
eval set -- "${FLAGS_ARGV}"
# Define a directory which will not be cleaned by portage automatically. So we
# could achieve incremental build between two autoserv runs.
BUILD_RUNTIME="/build/${FLAGS_board}/usr/local/autotest/"
# Hack: set the CHROMEOS_ROOT variable by hand here
CHROMEOS_ROOT=/home/${USER}/trunk/
# Ensure the configures run by autotest pick up the right config.site
CONFIG_SITE=/usr/share/config.site
[ -z "${FLAGS_board}" ] && \
die "You must specify --board="
function setup_ssh() {
eval $(ssh-agent) > /dev/null
# TODO(jrbarnette): This is a temporary hack, slated for removal
# before it was ever created. It's a bug, and you should fix it
# right away!
chmod 400 \
${CHROMEOS_ROOT}/src/scripts/mod_for_test_scripts/ssh_keys/testing_rsa
ssh-add \
${CHROMEOS_ROOT}/src/scripts/mod_for_test_scripts/ssh_keys/testing_rsa
}
function teardown_ssh() {
ssh-agent -k > /dev/null
}
src_test() {
# TODO: These places currently need to be writeable but shouldn't be
sudo chmod a+w ${BUILD_RUNTIME}/server/{tests,site_tests}
setup_ssh
cd "${BUILD_RUNTIME}"
local args=()
if [[ -n ${AUTOSERV_TEST_ARGS} ]]; then
args=("-a" "${AUTOSERV_TEST_ARGS}")
fi
local timestamp=$(date +%Y-%m-%d-%H.%M.%S)
# Do not use sudo, it'll unset all your environment
LOGNAME=${USER} ./server/autoserv -r /tmp/results.${timestamp} \
${AUTOSERV_ARGS} "${args[@]}"
teardown_ssh
}
src_test

View File

@ -271,25 +271,24 @@ function main() {
info "Running chrome autotest ${control_file}"
fi
export AUTOSERV_TEST_ARGS="${FLAGS_args}"
export AUTOSERV_ARGS="-m ${FLAGS_remote} \
--ssh-port ${FLAGS_ssh_port} \
local autoserv_test_args="${FLAGS_args}"
if [ -n "${autoserv_test_args}" ]; then
autoserv_test_args="-a \"${autoserv_test_args}\""
fi
local autoserv_args="-m ${FLAGS_remote} --ssh-port ${FLAGS_ssh_port} \
${option} ${control_file} -r ${results_dir} ${verbose}"
if [ ${FLAGS_build} -eq ${FLAGS_FALSE} ]; then
cat > "${TMP}/run_test.sh" <<EOF
export AUTOSERV_TEST_ARGS="${AUTOSERV_TEST_ARGS}"
export AUTOSERV_ARGS="${AUTOSERV_ARGS}"
cd /home/${USER}/trunk/src/scripts
./autotest_run.sh --board "${FLAGS_board}"
cd /build/${FLAGS_board}/usr/local/autotest
sudo chmod a+w ./server/{tests,site_tests}
echo ./server/autoserv ${autoserv_args} ${autoserv_test_args}
./server/autoserv ${autoserv_args} ${autoserv_test_args}
EOF
chmod a+rx "${TMP}/run_test.sh"
${ENTER_CHROOT} ${TMP_INSIDE_CHROOT}/run_test.sh >&2
else
cp "${BUILD_DIR}/environment" "${TMP}/run_test.sh"
GRAPHICS_BACKEND=${GRAPHICS_BACKEND:-OPENGL}
if [ -n "${AUTOSERV_TEST_ARGS}" ]; then
AUTOSERV_TEST_ARGS="-a \"${AUTOSERV_TEST_ARGS}\""
fi
cat >> "${TMP}/run_test.sh" <<EOF
export GCLIENT_ROOT=/home/${USER}/trunk
export GRAPHICS_BACKEND=${GRAPHICS_BACKEND}
@ -297,7 +296,8 @@ export SSH_AUTH_SOCK=${SSH_AUTH_SOCK} TMPDIR=/tmp SSH_AGENT_PID=${SSH_AGENT_PID}
export SYSROOT=/build/${FLAGS_board}
tc-export CC CXX PKG_CONFIG
cd ${INSIDE_BUILD_DIR}
./server/autoserv ${AUTOSERV_ARGS} ${AUTOSERV_TEST_ARGS}
echo ./server/autoserv ${autoserv_args} ${autoserv_test_args}
./server/autoserv ${autoserv_args} ${autoserv_test_args}
EOF
sudo cp "${TMP}/run_test.sh" "${BUILD_DIR}"
sudo chmod a+rx "${BUILD_DIR}/run_test.sh"