diff --git a/autotest_lib.sh b/autotest_lib.sh index b640a9ea70..c57096807c 100644 --- a/autotest_lib.sh +++ b/autotest_lib.sh @@ -4,7 +4,7 @@ # # Provides common commands for dealing running/building autotest -# Populates the chroot's /usr/local/autotest directory based on +# Populates the chroot's /usr/local/autotest/$FLAGS_board directory based on # the given source directory. # args: # $1 - original source directory diff --git a/build_autotest.sh b/build_autotest.sh index 540c3857ad..374a31c371 100755 --- a/build_autotest.sh +++ b/build_autotest.sh @@ -24,6 +24,9 @@ DEFAULT_CONTROL=client/site_tests/setup/control DEFINE_string control "${DEFAULT_CONTROL}" \ "Setup control file -- path relative to the destination autotest directory" c +DEFINE_string board "" \ + "The board for which you are building autotest" + # More useful help FLAGS_HELP="usage: $0 [flags]" @@ -34,7 +37,7 @@ set -e AUTOTEST_SRC="${GCLIENT_ROOT}/src/third_party/autotest/files" # Destination in chroot to install autotest. -AUTOTEST_DEST="/usr/local/autotest" +AUTOTEST_DEST="/usr/local/autotest/${FLAGS_board}" # Copy a local "installation" of autotest into the chroot, to avoid # polluting the src dir with tmp files, results, etc. diff --git a/image_to_usb.sh b/image_to_usb.sh index 9abe853cb4..d0cc1ebfc8 100755 --- a/image_to_usb.sh +++ b/image_to_usb.sh @@ -10,29 +10,12 @@ # The path to common.sh should be relative to your script's location. . "$(dirname "$0")/common.sh" -IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images" -# Default to the most recent image -DEFAULT_FROM="${IMAGES_DIR}/$(ls -t $IMAGES_DIR 2>&-| head -1)" - -# Script can be run either inside or outside the chroot. -if [ $INSIDE_CHROOT -eq 1 ] -then - # Inside the chroot, so output to usb.img in the same dir as the other - # images. - DEFAULT_TO="${DEFAULT_FROM}/usb.img" - DEFAULT_TO_HELP="Destination file for USB image." - AUTOTEST_SRC=/usr/local/autotest -else - # Outside the chroot, so output to the default device for a usb key. - DEFAULT_TO="/dev/sdb" - DEFAULT_TO_HELP="Destination device for USB keyfob." - AUTOTEST_SRC=${DEFAULT_CHROOT_DIR}/usr/local/autotest -fi # Flags -DEFINE_string from "$DEFAULT_FROM" \ +DEFINE_string board "" "Board for which the image was built" +DEFINE_string from "" \ "Directory containing rootfs.image and mbr.image" -DEFINE_string to "$DEFAULT_TO" "$DEFAULT_TO_HELP" +DEFINE_string to "" "$DEFAULT_TO_HELP" DEFINE_boolean yes $FLAGS_FALSE "Answer yes to all prompts" "y" DEFINE_boolean install_autotest $FLAGS_FALSE \ "Whether to install autotest to the stateful partition." @@ -41,9 +24,38 @@ DEFINE_boolean install_autotest $FLAGS_FALSE \ FLAGS "$@" || exit 1 eval set -- "${FLAGS_ARGV}" +# Inside the chroot, so output to usb.img in the same dir as the other +# Script can be run either inside or outside the chroot. +if [ $INSIDE_CHROOT -eq 1 ] +then + AUTOTEST_SRC="/usr/local/autotest/${FLAGS_board}" +else + AUTOTEST_SRC="${DEFAULT_CHROOT_DIR}/usr/local/autotest/${FLAGS_board}" +fi + # Die on any errors. set -e +# If from isn't explicitly set +if [ -z "$FLAGS_from" ]; then + IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${FLAGS_board}" + FLAGS_from="${IMAGES_DIR}/$(ls -t $IMAGES_DIR 2>&-| head -1)" +fi + +# If to isn't explicitly set +if [ -z "$FLAGS_to" ]; then + # Script can be run either inside or outside the chroot. + if [ $INSIDE_CHROOT -eq 1 ] + then + # Inside the chroot, so output to usb.img in the same dir as the other + # images. + FLAGS_to="${FLAGS_from}/usb.img" + else + # Outside the chroot, so output to the default device for a usb key. + FLAGS_to="/dev/sdb" + fi +fi + # Convert args to paths. Need eval to un-quote the string so that shell # chars like ~ are processed; just doing FOO=`readlink -f $FOO` won't work. FLAGS_from=`eval readlink -f $FLAGS_from` diff --git a/run_remote_tests.sh b/run_remote_tests.sh index 4598a65545..f16794b6be 100755 --- a/run_remote_tests.sh +++ b/run_remote_tests.sh @@ -24,6 +24,7 @@ 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_string results_dir_root "" "alternate root results directory" +DEFINE_string board "" "Desired board you are running the test against" function cleanup() { if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]]; then @@ -115,7 +116,7 @@ function main() { # 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}/usr/local/autotest" + local autotest_dir="${FLAGS_chroot}/usr/local/autotest/${FLAGS_board}" update_chroot_autotest "${original}" "${autotest_dir}" local autoserv="${autotest_dir}/server/autoserv"