mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-23 06:31:18 +02:00
Enable building autotests in test loop and sbt script
Review URL: http://codereview.chromium.org/556060
This commit is contained in:
parent
9969ce9238
commit
1cca01402a
@ -5,7 +5,7 @@
|
||||
# found in the LICENSE file.
|
||||
|
||||
# Script to run client or server tests on a live remote image.
|
||||
|
||||
|
||||
# Load common constants. This should be the first executable line.
|
||||
# The path to common.sh should be relative to your script's location.
|
||||
|
||||
@ -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 build_desc "" "Build description used in database"
|
||||
DEFINE_string chroot_dir "${DEFAULT_CHROOT_DIR}" "alternate chroot location" c
|
||||
DEFINE_string results_dir_root "" "alternate root results directory"
|
||||
|
||||
function cleanup() {
|
||||
if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]]; then
|
||||
@ -101,7 +102,7 @@ function main() {
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
|
||||
AUTOTEST_DIR="${DEFAULT_CHROOT_DIR}/usr/local/autotest"
|
||||
|
||||
# Set global TMP for remote_access.sh's sake
|
||||
@ -144,14 +145,20 @@ function main() {
|
||||
echo "Running the following control files: ${control_files_to_run}"
|
||||
|
||||
remote_access_init
|
||||
|
||||
|
||||
# Set the default machine description to the machine's IP
|
||||
if [[ -z "${FLAGS_machine_desc}" ]]; then
|
||||
FLAGS_machine_desc="${FLAGS_remote}"
|
||||
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
|
||||
# Assume a line starts with TEST_TYPE =
|
||||
# Assume a line starts with TEST_TYPE =
|
||||
control_file=$(remove_quotes "${control_file}")
|
||||
local type=$(egrep '^\s*TEST_TYPE\s*=' "${control_file}" | head -1)
|
||||
type=$(python -c "${type}; print TEST_TYPE.lower()")
|
||||
@ -167,7 +174,8 @@ function main() {
|
||||
echo "Running ${type} test ${control_file}"
|
||||
local short_name=$(basename $(dirname "${control_file}"))
|
||||
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}"
|
||||
local verbose=""
|
||||
if [[ ${FLAGS_verbose} -eq $FLAGS_TRUE ]]; then
|
||||
|
@ -15,7 +15,7 @@
|
||||
# image in the checkout based on your current directory, or if you
|
||||
# are not in a checkout, based on the top level directory the script
|
||||
# is run from.
|
||||
#
|
||||
#
|
||||
# sync_build_test.sh --image_to_usb=/dev/sdb -i
|
||||
# same as above but then images USB device /dev/sdb with the image.
|
||||
# Also prompt the user in advance of the steps we'll take to make
|
||||
@ -33,7 +33,7 @@
|
||||
#
|
||||
# sync_build_test.sh --grab_buildbot=LATEST --test Pam --remote=192.168.1.2
|
||||
# grabs the latest build from the buildbot, properly modifies it,
|
||||
# reimages 192.168.1.2, and runs the given test on it.
|
||||
# reimages 192.168.1.2, and runs the given test on it.
|
||||
#
|
||||
# Environment variables that may be useful:
|
||||
# BUILDBOT_URI - default value for --buildbot_uri
|
||||
@ -62,6 +62,7 @@ buildbot"
|
||||
DEFINE_string chronos_passwd "${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 build_autotest ${FLAGS_FALSE} "Build autotest"
|
||||
DEFINE_boolean image_to_live ${FLAGS_FALSE} \
|
||||
"Put the resulting image on live instance (requires --remote)"
|
||||
DEFINE_string remote "" \
|
||||
@ -106,6 +107,9 @@ function validate_and_set_param_defaults() {
|
||||
FLAGS_top=$(dirname $(dirname $(dirname $0)))
|
||||
fi
|
||||
|
||||
# Canonicalize any symlinks
|
||||
FLAGS_top=$(readlink -f "${FLAGS_top}")
|
||||
|
||||
if [[ -z "${FLAGS_repo}" ]]; then
|
||||
if is_google_environment; then
|
||||
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
|
||||
local test_file=$(dirname $0)"/mod_for_test_scripts/test_account.passwd"
|
||||
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
|
||||
|
||||
if [[ -n "${FLAGS_image_to_usb}" ]]; then
|
||||
@ -216,6 +224,9 @@ function describe_steps() {
|
||||
echo " * Set chronos password randomly"
|
||||
fi
|
||||
fi
|
||||
if [[ ${FLAGS_build_autotest} -eq ${FLAGS_TRUE} ]]; then
|
||||
echo " * Build autotest"
|
||||
fi
|
||||
if [[ -n "${FLAGS_image_to_usb}" ]]; then
|
||||
echo " * Write the image to USB device ${FLAGS_image_to_usb}"
|
||||
fi
|
||||
@ -460,6 +471,11 @@ function main() {
|
||||
./image_to_live.sh "--remote=${FLAGS_remote}" --update_known_hosts
|
||||
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
|
||||
chdir_relative src/scripts
|
||||
# We purposefully do not quote FLAGS_test below as we expect it may
|
||||
|
Loading…
x
Reference in New Issue
Block a user