Rework run_autotest.sh to support server side control files.

The idea here is to remove flag processing inside this wrapper script and pass on all flags into autoserv.

I've tested with server/site_tests/system_BootPerfServer and a client side tests.

Both work fine.

Review URL: http://codereview.chromium.org/536081
This commit is contained in:
Eric Li 2010-01-15 15:47:43 -08:00
parent af9c8deafe
commit 3a704ffee4

View File

@ -11,23 +11,9 @@
# Script must be run inside the chroot # Script must be run inside the chroot
assert_inside_chroot assert_inside_chroot
DEFINE_string client_control "" "client test case to execute" "c"
DEFINE_boolean force false "force reinstallation of autotest" "f"
DEFINE_string machine "" "if present, execute autotest on this host." "m"
DEFINE_string test_key "${GCLIENT_ROOT}/src/platform/testing/testing_rsa" \
"rsa key to use for autoserv" "k"
# More useful help
FLAGS_HELP="usage: $0 [flags]"
# parse the command-line
FLAGS "$@" || exit 1
eval set -- "${FLAGS_ARGV}"
set -e set -e
AUTOTEST_CHROOT_DEST="/usr/local/autotest" TEST_RSA_KEY="${GCLIENT_ROOT}/src/platform/testing/testing_rsa"
AUTOTEST_SRC="${GCLIENT_ROOT}/src/third_party/autotest/files"
CHROOT_AUTHSOCK_PREFIX="/tmp/chromiumos_test_agent" CHROOT_AUTHSOCK_PREFIX="/tmp/chromiumos_test_agent"
function cleanup { function cleanup {
@ -49,34 +35,13 @@ then
fi fi
# Install authkey for testing # Install authkey for testing
chmod 400 $FLAGS_test_key chmod 400 $TEST_RSA_KEY
/usr/bin/ssh-add $FLAGS_test_key /usr/bin/ssh-add $TEST_RSA_KEY
if [ -n "${FLAGS_machine}" ] autoserv_cmd="./server/autoserv $@"
then echo "running: " ${autoserv_cmd}
# run only a specific test/suite if requested AUTOTEST_ROOT="/usr/local/autotest"
if [ ! -n "${FLAGS_client_control}" ] pushd ${AUTOTEST_ROOT} 1> /dev/null
then
# Generate meta-control file to run all existing site tests.
CLIENT_CONTROL_FILE=\
"${AUTOTEST_CHROOT_DEST}/client/site_tests/accept_Suite/control"
echo "No control file specified. Running all tests."
else
CLIENT_CONTROL_FILE=${AUTOTEST_CHROOT_DEST}/${FLAGS_client_control}
fi
# Kick off autosrv for specified test
autoserv_cmd="${AUTOTEST_CHROOT_DEST}/server/autoserv \
-m ${FLAGS_machine} \
-c ${CLIENT_CONTROL_FILE}"
echo "running autoserv: " ${autoserv_cmd}
pushd ${AUTOTEST_CHROOT_DEST} 1> /dev/null
${autoserv_cmd} ${autoserv_cmd}
popd 1> /dev/null popd 1> /dev/null
else
echo "To execute autotest manually:
eval \$(ssh-agent) # start ssh-agent
ssh-add $FLAGS_test_key # add test key to agent
# Then execute autoserv:
$autoserv_cmd"
fi