diff --git a/autotest_lib.sh b/autotest_lib.sh index c57096807c..fe76cb7663 100644 --- a/autotest_lib.sh +++ b/autotest_lib.sh @@ -4,6 +4,35 @@ # # Provides common commands for dealing running/building autotest +DEFINE_string board "" "The board for which you are building autotest" + +function check_board() { + local board_names="" + local index=1 + local found=0 + for board in ../overlays/overlay-* + do + board_names[index]=${board:20} + index+=1 + if [ "${FLAGS_board}" == "${board:20}" ] + then + found=1 + fi + done + + if [ ${found} -eq 0 ] + then + echo "You are required to specify a supported board from the command line." + echo "Supported boards are:" + for board in ${board_names[@]} + do + echo ${board} + done + exit 0 + fi +} + + # Populates the chroot's /usr/local/autotest/$FLAGS_board directory based on # the given source directory. # args: diff --git a/build_autotest.sh b/build_autotest.sh index c7d0a86b52..24c8eca15d 100755 --- a/build_autotest.sh +++ b/build_autotest.sh @@ -12,14 +12,13 @@ # install the compiled client tests directly onto the rootfs image. . "$(dirname "$0")/common.sh" +. "$(dirname $0)/autotest_lib.sh" # Script must be run inside the chroot assert_inside_chroot DEFAULT_TESTS_LIST="all" -DEFINE_string board "" \ - "The board for which you are building autotest" DEFINE_string build "${DEFAULT_TESTS_LIST}" \ "a comma seperated list of autotest client tests to be prebuilt." b DEFINE_boolean prompt $FLAGS_TRUE "Prompt user when building all tests" @@ -32,18 +31,7 @@ FLAGS "$@" || exit 1 eval set -- "${FLAGS_ARGV}" set -e - -if [ -z ${FLAGS_board} ] -then - echo "You are required to specify a board name from the command line." - echo "Supported boards are:" - for board in ../overlays/overlay-* - do - echo ${board:20} - done - exit 0 -fi - +check_board # build default pre-compile client tests list. ALL_TESTS="compilebench,dbench,disktest,ltp,unixbench" @@ -59,8 +47,8 @@ if [ ${FLAGS_build} == ${DEFAULT_TESTS_LIST} ] then if [ ${FLAGS_prompt} -eq ${FLAGS_TRUE} ] then - echo -n "You want to prebuild all client tests and it may take a long time " - echo "to finish. " + echo -n "You want to pre-build all client tests and it may take a long time" + echo " to finish. " read -p "Are you sure you want to continue?(N/y)" answer answer=${answer:0:1} if [ "${answer}" != "Y" ] && [ "${answer}" != "y" ] diff --git a/run_remote_tests.sh b/run_remote_tests.sh index f16794b6be..2bccc10ecf 100755 --- a/run_remote_tests.sh +++ b/run_remote_tests.sh @@ -24,7 +24,6 @@ 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 @@ -96,6 +95,8 @@ 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 @@ -116,7 +117,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/${FLAGS_board}" + local autotest_dir="${FLAGS_chroot}/build/${FLAGS_board}/usr/local/autotest" update_chroot_autotest "${original}" "${autotest_dir}" local autoserv="${autotest_dir}/server/autoserv"