From eb31903982f69dd9b39de2d15d16f4a31cd431cf Mon Sep 17 00:00:00 2001 From: Ken Mixter Date: Fri, 26 Feb 2010 17:33:51 -0800 Subject: [PATCH] build_autotest runs as part of build_packages given a flag. sync_build_test runs build_autotest that way. archive_build bzips up the autotest artifacts. run_remote_tests can run autotest artifacts from a prepackaged directory. Note that because build_platform is in a different repository than these other files, it's unfortunately forced to be reviewed separately in http://codereview.chromium.org/661197 and committed independently. Review URL: http://codereview.chromium.org/660189 --- archive_build.sh | 5 +++++ run_remote_tests.sh | 47 +++++++++++++++++++++++++-------------------- sync_build_test.sh | 19 +++++++++--------- 3 files changed, 40 insertions(+), 31 deletions(-) diff --git a/archive_build.sh b/archive_build.sh index b4a0951a73..3259bb1299 100755 --- a/archive_build.sh +++ b/archive_build.sh @@ -22,6 +22,8 @@ DEFAULT_FROM="${IMAGES_DIR}/$DEFAULT_BOARD/$(ls -t1 \ # Flags DEFINE_string board "$DEFAULT_BOARD" \ "The board to build packages for." +DEFINE_string chroot "$DEFAULT_CHROOT_DIR" \ + "The chroot of the build to archive." DEFINE_string from "$DEFAULT_FROM" \ "Directory to archive" DEFINE_string to "$DEFAULT_TO" "Directory of build archive" @@ -94,6 +96,9 @@ then cp "${FLAGS_from}/rootfs.image" "${FLAGS_from}/rootfs_test.image" "${SCRIPTS_DIR}/mod_image_for_test.sh" --board $FLAGS_board --yes --image \ "${FLAGS_from}/rootfs_test.image" + cd "${FLAGS_chroot}/build/${FLAGS_board}/usr/local" + echo "Archiving autotest build artifacts" + tar cjf "${FLAGS_from}/autotest.tar.bz2" autotest fi # Zip the build diff --git a/run_remote_tests.sh b/run_remote_tests.sh index 2bccc10ecf..24e0c92e1f 100755 --- a/run_remote_tests.sh +++ b/run_remote_tests.sh @@ -15,15 +15,16 @@ DEFAULT_OUTPUT_FILE=test-output-$(date '+%Y%m%d.%H%M%S') -DEFINE_boolean cleanup ${FLAGS_TRUE} "Clean up temp directory" -DEFINE_integer iterations 1 "Iterations to run every top level test" i -DEFINE_string output_file "${DEFAULT_OUTPUT_FILE}" "Test run output" o -DEFINE_boolean verbose ${FLAGS_FALSE} "Show verbose autoserv output" v -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 "${DEFAULT_CHROOT_DIR}" "alternate chroot location" c +DEFINE_boolean cleanup ${FLAGS_TRUE} "Clean up temp directory" +DEFINE_integer iterations 1 "Iterations to run every top level test" i +DEFINE_string machine_desc "" "Machine description used in database" +DEFINE_string output_file "${DEFAULT_OUTPUT_FILE}" "Test run output" o +DEFINE_string prepackaged_autotest "" "Use this prepackaged autotest dir" DEFINE_string results_dir_root "" "alternate root results directory" +DEFINE_boolean update_db ${FLAGS_FALSE} "Put results in autotest database" u +DEFINE_boolean verbose ${FLAGS_FALSE} "Show verbose autoserv output" v function cleanup() { if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]]; then @@ -95,15 +96,6 @@ function main() { exit 1 fi - check_board - - local parse_cmd="$(dirname $0)/../third_party/autotest/files/tko/parse.py" - - if [[ ${FLAGS_update_db} -eq ${FLAGS_TRUE} && ! -x "${parse_cmd}" ]]; then - echo "Cannot find parser ${parse_cmd}" - exit 1 - fi - set -e # Set global TMP for remote_access.sh's sake @@ -113,12 +105,25 @@ function main() { trap cleanup EXIT - # 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" - local autotest_dir="${FLAGS_chroot}/build/${FLAGS_board}/usr/local/autotest" - update_chroot_autotest "${original}" "${autotest_dir}" + local autotest_dir="" + if [[ -z "${FLAGS_prepackaged_autotest}" ]]; then + check_board + # 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" + autotest_dir="${FLAGS_chroot}/build/${FLAGS_board}/usr/local/autotest" + update_chroot_autotest "${original}" "${autotest_dir}" + else + autotest_dir="${FLAGS_prepackaged_autotest}" + fi + + local parse_cmd="${autotest_dir}/tko/parse.py" + + if [[ ${FLAGS_update_db} -eq ${FLAGS_TRUE} && ! -x "${parse_cmd}" ]]; then + echo "Cannot find parser ${parse_cmd}" + exit 1 + fi local autoserv="${autotest_dir}/server/autoserv" diff --git a/sync_build_test.sh b/sync_build_test.sh index 5dfe7cf10f..b81dd62906 100755 --- a/sync_build_test.sh +++ b/sync_build_test.sh @@ -224,6 +224,9 @@ function describe_steps() { fi echo " * Build image${withdev}${jobs}" set_passwd=${FLAGS_TRUE} + if [[ ${FLAGS_build_autotest} -eq ${FLAGS_TRUE} ]]; then + echo " * Cross-build autotest client tests (build_autotest)" + fi fi if [[ ${FLAGS_master} -eq ${FLAGS_TRUE} ]]; then echo " * Master image (build_image)" @@ -246,9 +249,6 @@ function describe_steps() { echo " * Set chronos password randomly" fi fi - if [[ ${FLAGS_build_autotest} -eq ${FLAGS_TRUE} ]]; then - echo " * Cross-build autotest client tests (build_autotest)" - fi if [[ -n "${FLAGS_image_to_usb}" ]]; then echo " * Write the image to USB device ${FLAGS_image_to_usb}" fi @@ -492,9 +492,14 @@ function main() { run_phase_in_chroot "Setting up board target" \ ./setup_board "${board_param}" fi + local build_autotest_param="" + if [[ ${FLAGS_build_autotest} -eq ${FLAGS_TRUE} ]]; then + build_autotest_param="--withautotest" + fi + run_phase_in_chroot "Building packages" \ ./build_packages "${board_param}" \ - ${jobs_param} ${withdev_param} + ${jobs_param} ${withdev_param} ${build_autotest_param} # TODO(kmixter): Enable this once build_tests works, but even # then only do it when not cross compiling. @@ -534,12 +539,6 @@ 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_in_chroot "Building autotest" "./build_autotest.sh" \ - --noprompt "${board_param}" - fi - if [[ -n "${FLAGS_test}" ]]; then chdir_relative src/scripts # We purposefully do not quote FLAGS_test below as we expect it may