Enable building autotests in test loop and sbt script

Review URL: http://codereview.chromium.org/556060
This commit is contained in:
Ken Mixter 2010-02-01 19:05:54 -08:00
parent 9969ce9238
commit 1cca01402a
2 changed files with 31 additions and 7 deletions

View File

@ -22,6 +22,7 @@ DEFINE_boolean update_db ${FLAGS_FALSE} "Put results in autotest database" u
DEFINE_string machine_desc "" "Machine description used in database" DEFINE_string machine_desc "" "Machine description used in database"
DEFINE_string build_desc "" "Build description used in database" DEFINE_string build_desc "" "Build description used in database"
DEFINE_string chroot_dir "${DEFAULT_CHROOT_DIR}" "alternate chroot location" c DEFINE_string chroot_dir "${DEFAULT_CHROOT_DIR}" "alternate chroot location" c
DEFINE_string results_dir_root "" "alternate root results directory"
function cleanup() { function cleanup() {
if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]]; then if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]]; then
@ -150,6 +151,12 @@ function main() {
FLAGS_machine_desc="${FLAGS_remote}" FLAGS_machine_desc="${FLAGS_remote}"
fi fi
if [[ -z "${FLAGS_results_dir_root}" ]]; then
FLAGS_results_dir_root="${TMP}"
fi
mkdir -p "${FLAGS_results_dir_root}"
for control_file in ${control_files_to_run}; do for control_file in ${control_files_to_run}; do
# Assume a line starts with TEST_TYPE = # Assume a line starts with TEST_TYPE =
control_file=$(remove_quotes "${control_file}") control_file=$(remove_quotes "${control_file}")
@ -167,7 +174,8 @@ function main() {
echo "Running ${type} test ${control_file}" echo "Running ${type} test ${control_file}"
local short_name=$(basename $(dirname "${control_file}")) local short_name=$(basename $(dirname "${control_file}"))
local start_time=$(date '+%s') local start_time=$(date '+%s')
local results_dir="${TMP}/${short_name},${FLAGS_machine_desc},${start_time}" local results_dir_name="${short_name},${FLAGS_machine_desc},${start_time}"
local results_dir="${FLAGS_results_dir_root}/${results_dir_name}"
rm -rf "${results_dir}" rm -rf "${results_dir}"
local verbose="" local verbose=""
if [[ ${FLAGS_verbose} -eq $FLAGS_TRUE ]]; then if [[ ${FLAGS_verbose} -eq $FLAGS_TRUE ]]; then

View File

@ -62,6 +62,7 @@ buildbot"
DEFINE_string chronos_passwd "${CHRONOS_PASSWD}" \ DEFINE_string chronos_passwd "${CHRONOS_PASSWD}" \
"Use this as the chronos user passwd (defaults to \$CHRONOS_PASSWD)" "Use this as the chronos user passwd (defaults to \$CHRONOS_PASSWD)"
DEFINE_boolean mod_image_for_test ${FLAGS_FALSE} "Modify the image for testing" DEFINE_boolean mod_image_for_test ${FLAGS_FALSE} "Modify the image for testing"
DEFINE_boolean build_autotest ${FLAGS_FALSE} "Build autotest"
DEFINE_boolean image_to_live ${FLAGS_FALSE} \ DEFINE_boolean image_to_live ${FLAGS_FALSE} \
"Put the resulting image on live instance (requires --remote)" "Put the resulting image on live instance (requires --remote)"
DEFINE_string remote "" \ DEFINE_string remote "" \
@ -106,6 +107,9 @@ function validate_and_set_param_defaults() {
FLAGS_top=$(dirname $(dirname $(dirname $0))) FLAGS_top=$(dirname $(dirname $(dirname $0)))
fi fi
# Canonicalize any symlinks
FLAGS_top=$(readlink -f "${FLAGS_top}")
if [[ -z "${FLAGS_repo}" ]]; then if [[ -z "${FLAGS_repo}" ]]; then
if is_google_environment; then if is_google_environment; then
FLAGS_repo="ssh://git@chromiumos-git//chromeos" FLAGS_repo="ssh://git@chromiumos-git//chromeos"
@ -159,6 +163,10 @@ function validate_and_set_param_defaults() {
# Override any specified chronos password with the test one # Override any specified chronos password with the test one
local test_file=$(dirname $0)"/mod_for_test_scripts/test_account.passwd" local test_file=$(dirname $0)"/mod_for_test_scripts/test_account.passwd"
FLAGS_chronos_passwd=$(head -1 "${test_file}") FLAGS_chronos_passwd=$(head -1 "${test_file}")
# Default to building autotests whenever we mod image for test.
# TODO(kmixter): Make this more efficient by either doing incremental
# building, or only building if the tests we're running needs to be.
FLAGS_build_autotest=${FLAGS_TRUE}
fi fi
if [[ -n "${FLAGS_image_to_usb}" ]]; then if [[ -n "${FLAGS_image_to_usb}" ]]; then
@ -216,6 +224,9 @@ function describe_steps() {
echo " * Set chronos password randomly" echo " * Set chronos password randomly"
fi fi
fi fi
if [[ ${FLAGS_build_autotest} -eq ${FLAGS_TRUE} ]]; then
echo " * Build autotest"
fi
if [[ -n "${FLAGS_image_to_usb}" ]]; then if [[ -n "${FLAGS_image_to_usb}" ]]; then
echo " * Write the image to USB device ${FLAGS_image_to_usb}" echo " * Write the image to USB device ${FLAGS_image_to_usb}"
fi fi
@ -460,6 +471,11 @@ function main() {
./image_to_live.sh "--remote=${FLAGS_remote}" --update_known_hosts ./image_to_live.sh "--remote=${FLAGS_remote}" --update_known_hosts
fi fi
if [[ ${FLAGS_build_autotest} -eq ${FLAGS_TRUE} ]]; then
chdir_relative src/scripts
run_phase "Building autotest" ./enter_chroot.sh "./build_autotest.sh"
fi
if [[ -n "${FLAGS_test}" ]]; then if [[ -n "${FLAGS_test}" ]]; then
chdir_relative src/scripts chdir_relative src/scripts
# We purposefully do not quote FLAGS_test below as we expect it may # We purposefully do not quote FLAGS_test below as we expect it may