| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 # This script makes autotest client tests inside a chroot environment. The idea | 7 # This script makes autotest client tests inside a chroot environment. The idea |
| 8 # is to compile any platform-dependent autotest client tests in the build | 8 # is to compile any platform-dependent autotest client tests in the build |
| 9 # environment, since client systems under test lack the proper toolchain. | 9 # environment, since client systems under test lack the proper toolchain. |
| 10 # | 10 # |
| 11 # The user can later run autotest against an ssh enabled test client system, or | 11 # The user can later run autotest against an ssh enabled test client system, or |
| 12 # install the compiled client tests directly onto the rootfs image. | 12 # install the compiled client tests directly onto the rootfs image. |
| 13 | 13 |
| 14 . "$(dirname "$0")/common.sh" | 14 . "$(dirname "$0")/common.sh" |
| 15 . "$(dirname $0)/autotest_lib.sh" |
| 15 | 16 |
| 16 # Script must be run inside the chroot | 17 # Script must be run inside the chroot |
| 17 assert_inside_chroot | 18 assert_inside_chroot |
| 18 | 19 |
| 19 DEFAULT_TESTS_LIST="all" | 20 DEFAULT_TESTS_LIST="all" |
| 20 | 21 |
| 21 DEFINE_string board "" \ | |
| 22 "The board for which you are building autotest" | |
| 23 DEFINE_string build "${DEFAULT_TESTS_LIST}" \ | 22 DEFINE_string build "${DEFAULT_TESTS_LIST}" \ |
| 24 "a comma seperated list of autotest client tests to be prebuilt." b | 23 "a comma seperated list of autotest client tests to be prebuilt." b |
| 25 DEFINE_boolean prompt $FLAGS_TRUE "Prompt user when building all tests" | 24 DEFINE_boolean prompt $FLAGS_TRUE "Prompt user when building all tests" |
| 26 | 25 |
| 27 # More useful help | 26 # More useful help |
| 28 FLAGS_HELP="usage: $0 [flags]" | 27 FLAGS_HELP="usage: $0 [flags]" |
| 29 | 28 |
| 30 # parse the command-line | 29 # parse the command-line |
| 31 FLAGS "$@" || exit 1 | 30 FLAGS "$@" || exit 1 |
| 32 eval set -- "${FLAGS_ARGV}" | 31 eval set -- "${FLAGS_ARGV}" |
| 33 set -e | 32 set -e |
| 34 | 33 |
| 35 | 34 check_board |
| 36 if [ -z ${FLAGS_board} ] | |
| 37 then | |
| 38 echo "You are required to specify a board name from the command line." | |
| 39 echo "Supported boards are:" | |
| 40 for board in ../overlays/overlay-* | |
| 41 do | |
| 42 echo ${board:20} | |
| 43 done | |
| 44 exit 0 | |
| 45 fi | |
| 46 | |
| 47 | 35 |
| 48 # build default pre-compile client tests list. | 36 # build default pre-compile client tests list. |
| 49 ALL_TESTS="compilebench,dbench,disktest,ltp,unixbench" | 37 ALL_TESTS="compilebench,dbench,disktest,ltp,unixbench" |
| 50 for SITE_TEST in ../third_party/autotest/files/client/site_tests/* | 38 for SITE_TEST in ../third_party/autotest/files/client/site_tests/* |
| 51 do | 39 do |
| 52 if [ -d ${SITE_TEST} ] | 40 if [ -d ${SITE_TEST} ] |
| 53 then | 41 then |
| 54 ALL_TESTS="${ALL_TESTS},${SITE_TEST:48}" | 42 ALL_TESTS="${ALL_TESTS},${SITE_TEST:48}" |
| 55 fi | 43 fi |
| 56 done | 44 done |
| 57 | 45 |
| 58 if [ ${FLAGS_build} == ${DEFAULT_TESTS_LIST} ] | 46 if [ ${FLAGS_build} == ${DEFAULT_TESTS_LIST} ] |
| 59 then | 47 then |
| 60 if [ ${FLAGS_prompt} -eq ${FLAGS_TRUE} ] | 48 if [ ${FLAGS_prompt} -eq ${FLAGS_TRUE} ] |
| 61 then | 49 then |
| 62 echo -n "You want to prebuild all client tests and it may take a long time " | 50 echo -n "You want to pre-build all client tests and it may take a long time" |
| 63 echo "to finish. " | 51 echo " to finish. " |
| 64 read -p "Are you sure you want to continue?(N/y)" answer | 52 read -p "Are you sure you want to continue?(N/y)" answer |
| 65 answer=${answer:0:1} | 53 answer=${answer:0:1} |
| 66 if [ "${answer}" != "Y" ] && [ "${answer}" != "y" ] | 54 if [ "${answer}" != "Y" ] && [ "${answer}" != "y" ] |
| 67 then | 55 then |
| 68 echo "Use --build to specify tests you like to pre-compile." | 56 echo "Use --build to specify tests you like to pre-compile." |
| 69 echo -n "E.g.: ./enter_chroot.sh \"./build_autotest.sh " | 57 echo -n "E.g.: ./enter_chroot.sh \"./build_autotest.sh " |
| 70 echo "--build=system_SAT\"" | 58 echo "--build=system_SAT\"" |
| 71 exit 0 | 59 exit 0 |
| 72 fi | 60 fi |
| 73 fi | 61 fi |
| 74 TEST_LIST=${ALL_TESTS} | 62 TEST_LIST=${ALL_TESTS} |
| 75 else | 63 else |
| 76 TEST_LIST=${FLAGS_build} | 64 TEST_LIST=${FLAGS_build} |
| 77 fi | 65 fi |
| 78 | 66 |
| 79 GCLIENT_ROOT="${GCLIENT_ROOT}" TEST_LIST=${TEST_LIST} \ | 67 GCLIENT_ROOT="${GCLIENT_ROOT}" TEST_LIST=${TEST_LIST} \ |
| 80 "emerge-${FLAGS_board}" chromeos-base/autotest | 68 "emerge-${FLAGS_board}" chromeos-base/autotest |
| OLD | NEW |