| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 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 | 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 is intended as a wrapper to execute autotest tests for a given | 7 # This script is intended as a wrapper to execute autotest tests for a given |
| 8 # board. | 8 # board. |
| 9 | 9 |
| 10 # Load common constants. This should be the first executable line. | 10 # Load common constants. This should be the first executable line. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 # Define a directory which will not be cleaned by portage automatically. So we | 25 # Define a directory which will not be cleaned by portage automatically. So we |
| 26 # could achieve incremental build between two autoserv runs. | 26 # could achieve incremental build between two autoserv runs. |
| 27 BUILD_RUNTIME="/build/${FLAGS_board}/usr/local/autotest/" | 27 BUILD_RUNTIME="/build/${FLAGS_board}/usr/local/autotest/" |
| 28 | 28 |
| 29 # Hack: set the CHROMEOS_ROOT variable by hand here | 29 # Hack: set the CHROMEOS_ROOT variable by hand here |
| 30 CHROMEOS_ROOT=/home/${USER}/trunk/ | 30 CHROMEOS_ROOT=/home/${USER}/trunk/ |
| 31 | 31 |
| 32 # Ensure the configures run by autotest pick up the right config.site | 32 # Ensure the configures run by autotest pick up the right config.site |
| 33 CONFIG_SITE=/usr/share/config.site | 33 CONFIG_SITE=/usr/share/config.site |
| 34 AUTOTEST_SRC="${CHROMEOS_ROOT}/src/third_party/autotest/files" | |
| 35 | 34 |
| 36 [ -z "${FLAGS_board}" ] && \ | 35 [ -z "${FLAGS_board}" ] && \ |
| 37 die "You must specify --board=" | 36 die "You must specify --board=" |
| 38 | 37 |
| 39 function setup_ssh() { | 38 function setup_ssh() { |
| 40 eval $(ssh-agent) > /dev/null | 39 eval $(ssh-agent) > /dev/null |
| 41 ssh-add \ | 40 ssh-add \ |
| 42 ${CHROMEOS_ROOT}/src/scripts/mod_for_test_scripts/ssh_keys/testing_rsa | 41 ${CHROMEOS_ROOT}/src/scripts/mod_for_test_scripts/ssh_keys/testing_rsa |
| 43 } | 42 } |
| 44 | 43 |
| 45 function teardown_ssh() { | 44 function teardown_ssh() { |
| 46 ssh-agent -k > /dev/null | 45 ssh-agent -k > /dev/null |
| 47 } | 46 } |
| 48 | 47 |
| 49 function copy_src() { | |
| 50 local dst=$1 | |
| 51 mkdir -p "${dst}" | |
| 52 cp -fpru "${AUTOTEST_SRC}"/{client,conmux,server,tko,utils} "${dst}" || die | |
| 53 cp -fpru "${AUTOTEST_SRC}/shadow_config.ini" "${dst}" || die | |
| 54 } | |
| 55 | |
| 56 src_test() { | 48 src_test() { |
| 57 # claim ownership of the staging area | 49 # TODO: These places currently need to be writeable but shouldn't be |
| 58 sudo chown -R ${USER} "${BUILD_RUNTIME}" | 50 sudo chmod a+w ${BUILD_RUNTIME}/server/{tests,site_tests} |
| 59 sudo chmod -R 755 "${BUILD_RUNTIME}" | |
| 60 | |
| 61 local third_party="${CHROMEOS_ROOT}/src/third_party" | |
| 62 copy_src "${BUILD_RUNTIME}" | |
| 63 cp -fpru "${AUTOTEST_SRC}/global_config.ini" "${BUILD_RUNTIME}" | |
| 64 | |
| 65 # ensure that no tests are ever built | |
| 66 sed -e 's/enable_server_prebuild: .*/enable_server_prebuild: False/' -i \ | |
| 67 "${BUILD_RUNTIME}"/global_config.ini | |
| 68 | 51 |
| 69 setup_ssh | 52 setup_ssh |
| 70 cd "${BUILD_RUNTIME}" | 53 cd "${BUILD_RUNTIME}" |
| 71 | 54 |
| 72 local args=() | 55 local args=() |
| 73 if [[ -n ${AUTOSERV_TEST_ARGS} ]]; then | 56 if [[ -n ${AUTOSERV_TEST_ARGS} ]]; then |
| 74 args=("-a" "${AUTOSERV_TEST_ARGS}") | 57 args=("-a" "${AUTOSERV_TEST_ARGS}") |
| 75 fi | 58 fi |
| 76 | 59 |
| 77 local timestamp=$(date +%Y-%m-%d-%H.%M.%S) | 60 local timestamp=$(date +%Y-%m-%d-%H.%M.%S) |
| 78 | 61 |
| 79 # Do not use sudo, it'll unset all your environment | 62 # Do not use sudo, it'll unset all your environment |
| 80 LOGNAME=${USER} ./server/autoserv -r /tmp/results.${timestamp} \ | 63 LOGNAME=${USER} ./server/autoserv -r /tmp/results.${timestamp} \ |
| 81 ${AUTOSERV_ARGS} "${args[@]}" | 64 ${AUTOSERV_ARGS} "${args[@]}" |
| 82 | 65 |
| 83 teardown_ssh | 66 teardown_ssh |
| 84 } | 67 } |
| 85 | 68 |
| 86 src_test | 69 src_test |
| OLD | NEW |