| OLD | NEW |
| (Empty) |
| 1 #!/bin/bash | |
| 2 | |
| 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | |
| 4 # Use of this source code is governed by a BSD-style license that can be | |
| 5 # found in the LICENSE file. | |
| 6 | |
| 7 # This script is intended as a wrapper to execute autotest tests for a given | |
| 8 # board. | |
| 9 | |
| 10 # Load common constants. This should be the first executable line. | |
| 11 # The path to common.sh should be relative to your script's location. | |
| 12 . "$(dirname "$0")/common.sh" | |
| 13 | |
| 14 # Script must be run inside the chroot | |
| 15 restart_in_chroot_if_needed $* | |
| 16 get_default_board | |
| 17 | |
| 18 DEFINE_string board "${DEFAULT_BOARD}" \ | |
| 19 "The board to run tests for." | |
| 20 | |
| 21 FLAGS_HELP="usage: $0 <flags>" | |
| 22 FLAGS "$@" || exit 1 | |
| 23 eval set -- "${FLAGS_ARGV}" | |
| 24 | |
| 25 # Define a directory which will not be cleaned by portage automatically. So we | |
| 26 # could achieve incremental build between two autoserv runs. | |
| 27 BUILD_RUNTIME="/build/${FLAGS_board}/usr/local/autotest/" | |
| 28 | |
| 29 # Hack: set the CHROMEOS_ROOT variable by hand here | |
| 30 CHROMEOS_ROOT=/home/${USER}/trunk/ | |
| 31 | |
| 32 # Ensure the configures run by autotest pick up the right config.site | |
| 33 CONFIG_SITE=/usr/share/config.site | |
| 34 | |
| 35 [ -z "${FLAGS_board}" ] && \ | |
| 36 die "You must specify --board=" | |
| 37 | |
| 38 function setup_ssh() { | |
| 39 eval $(ssh-agent) > /dev/null | |
| 40 # TODO(jrbarnette): This is a temporary hack, slated for removal | |
| 41 # before it was ever created. It's a bug, and you should fix it | |
| 42 # right away! | |
| 43 chmod 400 \ | |
| 44 ${CHROMEOS_ROOT}/src/scripts/mod_for_test_scripts/ssh_keys/testing_rsa | |
| 45 ssh-add \ | |
| 46 ${CHROMEOS_ROOT}/src/scripts/mod_for_test_scripts/ssh_keys/testing_rsa | |
| 47 } | |
| 48 | |
| 49 function teardown_ssh() { | |
| 50 ssh-agent -k > /dev/null | |
| 51 } | |
| 52 | |
| 53 src_test() { | |
| 54 # TODO: These places currently need to be writeable but shouldn't be | |
| 55 sudo chmod a+w ${BUILD_RUNTIME}/server/{tests,site_tests} | |
| 56 | |
| 57 setup_ssh | |
| 58 cd "${BUILD_RUNTIME}" | |
| 59 | |
| 60 local args=() | |
| 61 if [[ -n ${AUTOSERV_TEST_ARGS} ]]; then | |
| 62 args=("-a" "${AUTOSERV_TEST_ARGS}") | |
| 63 fi | |
| 64 | |
| 65 local timestamp=$(date +%Y-%m-%d-%H.%M.%S) | |
| 66 | |
| 67 # Do not use sudo, it'll unset all your environment | |
| 68 LOGNAME=${USER} ./server/autoserv -r /tmp/results.${timestamp} \ | |
| 69 ${AUTOSERV_ARGS} "${args[@]}" | |
| 70 | |
| 71 teardown_ssh | |
| 72 } | |
| 73 | |
| 74 src_test | |
| OLD | NEW |