| 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 an Ubuntu chroot | 7 # This script makes autotest client tests inside an Ubuntu chroot |
| 8 # environment. The idea is to compile any platform-dependent autotest | 8 # environment. The idea is to compile any platform-dependent autotest |
| 9 # client tests in the build environment, since client systems under | 9 # client tests in the build environment, since client systems under |
| 10 # test lack the proper toolchain. | 10 # test lack the proper toolchain. |
| 11 # | 11 # |
| 12 # The user can later run autotest against an ssh enabled test client system, or | 12 # The user can later run autotest against an ssh enabled test client system, or |
| 13 # install the compiled client tests directly onto the rootfs image, using | 13 # install the compiled client tests directly onto the rootfs image, using |
| 14 # mod_image_for_test.sh. | 14 # mod_image_for_test.sh. |
| 15 | 15 |
| 16 . "$(dirname "$0")/common.sh" | 16 . "$(dirname "$0")/common.sh" |
| 17 . "$(dirname "$0")/autotest_lib.sh" | 17 . "$(dirname "$0")/autotest_lib.sh" |
| 18 | 18 |
| 19 # Script must be run inside the chroot | 19 # Script must be run inside the chroot |
| 20 assert_inside_chroot | 20 assert_inside_chroot |
| 21 | 21 |
| 22 DEFAULT_CONTROL=client/site_tests/setup/control | 22 DEFAULT_CONTROL=client/site_tests/setup/control |
| 23 | 23 |
| 24 DEFINE_string control "${DEFAULT_CONTROL}" \ | 24 DEFINE_string control "${DEFAULT_CONTROL}" \ |
| 25 "Setup control file -- path relative to the destination autotest directory" c | 25 "Setup control file -- path relative to the destination autotest directory" c |
| 26 | 26 |
| 27 DEFINE_string board "" \ |
| 28 "The board for which you are building autotest" |
| 29 |
| 27 # More useful help | 30 # More useful help |
| 28 FLAGS_HELP="usage: $0 [flags]" | 31 FLAGS_HELP="usage: $0 [flags]" |
| 29 | 32 |
| 30 # parse the command-line | 33 # parse the command-line |
| 31 FLAGS "$@" || exit 1 | 34 FLAGS "$@" || exit 1 |
| 32 eval set -- "${FLAGS_ARGV}" | 35 eval set -- "${FLAGS_ARGV}" |
| 33 set -e | 36 set -e |
| 34 | 37 |
| 35 AUTOTEST_SRC="${GCLIENT_ROOT}/src/third_party/autotest/files" | 38 AUTOTEST_SRC="${GCLIENT_ROOT}/src/third_party/autotest/files" |
| 36 # Destination in chroot to install autotest. | 39 # Destination in chroot to install autotest. |
| 37 AUTOTEST_DEST="/usr/local/autotest" | 40 AUTOTEST_DEST="/usr/local/autotest/${FLAGS_board}" |
| 38 | 41 |
| 39 # Copy a local "installation" of autotest into the chroot, to avoid | 42 # Copy a local "installation" of autotest into the chroot, to avoid |
| 40 # polluting the src dir with tmp files, results, etc. | 43 # polluting the src dir with tmp files, results, etc. |
| 41 update_chroot_autotest "${CHROOT_TRUNK_DIR}/src/third_party/autotest/files" \ | 44 update_chroot_autotest "${CHROOT_TRUNK_DIR}/src/third_party/autotest/files" \ |
| 42 "${AUTOTEST_DEST}" | 45 "${AUTOTEST_DEST}" |
| 43 | 46 |
| 44 # Create python package init files for top level test case dirs. | 47 # Create python package init files for top level test case dirs. |
| 45 function touchInitPy() { | 48 function touchInitPy() { |
| 46 local dirs=${1} | 49 local dirs=${1} |
| 47 for base_dir in $dirs | 50 for base_dir in $dirs |
| (...skipping 10 matching lines...) Expand all Loading... |
| 58 cd ${AUTOTEST_DEST} | 61 cd ${AUTOTEST_DEST} |
| 59 touchInitPy client/tests client/site_tests | 62 touchInitPy client/tests client/site_tests |
| 60 touch __init__.py | 63 touch __init__.py |
| 61 | 64 |
| 62 # Export GCLIENT_ROOT so that tests have access to the source and build trees | 65 # Export GCLIENT_ROOT so that tests have access to the source and build trees |
| 63 export GCLIENT_ROOT | 66 export GCLIENT_ROOT |
| 64 | 67 |
| 65 # run the magic test setup script. | 68 # run the magic test setup script. |
| 66 echo "Building tests using ${FLAGS_control}..." | 69 echo "Building tests using ${FLAGS_control}..." |
| 67 client/bin/autotest ${FLAGS_control} | 70 client/bin/autotest ${FLAGS_control} |
| OLD | NEW |