| 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 # Script to run client or server tests on a live remote image. | 7 # Script to run client or server tests on a live remote image. |
| 8 | 8 |
| 9 # Load common constants. This should be the first executable line. | 9 # Load common constants. This should be the first executable line. |
| 10 # The path to common.sh should be relative to your script's location. | 10 # The path to common.sh should be relative to your script's location. |
| 11 | 11 |
| 12 . "$(dirname $0)/common.sh" | 12 . "$(dirname $0)/common.sh" |
| 13 . "$(dirname $0)/remote_access.sh" | 13 . "$(dirname $0)/remote_access.sh" |
| 14 | 14 |
| 15 get_default_board | 15 get_default_board |
| 16 | 16 |
| 17 DEFINE_string args "" \ | 17 DEFINE_string args "" \ |
| 18 "Command line arguments for test. Quoted and space separated if multiple." a | 18 "Command line arguments for test. Quoted and space separated if multiple." a |
| 19 DEFINE_string board "$DEFAULT_BOARD" \ | 19 DEFINE_string board "$DEFAULT_BOARD" \ |
| 20 "The board for which you are building autotest" | 20 "The board for which you are building autotest" |
| 21 DEFINE_boolean build ${FLAGS_FALSE} "Build tests while running" b |
| 21 DEFINE_string chroot "${DEFAULT_CHROOT_DIR}" "alternate chroot location" c | 22 DEFINE_string chroot "${DEFAULT_CHROOT_DIR}" "alternate chroot location" c |
| 22 DEFINE_boolean cleanup ${FLAGS_FALSE} "Clean up temp directory" | 23 DEFINE_boolean cleanup ${FLAGS_FALSE} "Clean up temp directory" |
| 23 DEFINE_integer iterations 1 "Iterations to run every top level test" i | 24 DEFINE_integer iterations 1 "Iterations to run every top level test" i |
| 24 DEFINE_string results_dir_root "" "alternate root results directory" | 25 DEFINE_string results_dir_root "" "alternate root results directory" |
| 25 DEFINE_boolean verbose ${FLAGS_FALSE} "Show verbose autoserv output" v | 26 DEFINE_boolean verbose ${FLAGS_FALSE} "Show verbose autoserv output" v |
| 27 DEFINE_boolean use_emerged ${FLAGS_FALSE} \ |
| 28 "Force use of emerged autotest packages" |
| 26 | 29 |
| 27 RAN_ANY_TESTS=${FLAGS_FALSE} | 30 RAN_ANY_TESTS=${FLAGS_FALSE} |
| 28 | 31 |
| 29 # Check if our stdout is a tty | |
| 30 function is_a_tty() { | |
| 31 local stdout=$(readlink /proc/$$/fd/1) | |
| 32 [[ "${stdout#/dev/tty}" != "${stdout}" ]] && return 0 | |
| 33 [[ "${stdout#/dev/pts}" != "${stdout}" ]] && return 0 | |
| 34 return 1 | |
| 35 } | |
| 36 | |
| 37 # Writes out text in specified color if stdout is a tty | |
| 38 # Arguments: | |
| 39 # $1 - color | |
| 40 # $2 - text to color | |
| 41 # $3 - text following colored text (default colored) | |
| 42 # Returns: | |
| 43 # None | |
| 44 function echo_color() { | |
| 45 local color=0 | |
| 46 [[ "$1" == "red" ]] && color=31 | |
| 47 [[ "$1" == "green" ]] && color=32 | |
| 48 [[ "$1" == "yellow" ]] && color=33 | |
| 49 if is_a_tty; then | |
| 50 echo -e "\033[1;${color}m$2\033[0m$3" | |
| 51 else | |
| 52 echo "$2$3" | |
| 53 fi | |
| 54 } | |
| 55 | |
| 56 function cleanup() { | 32 function cleanup() { |
| 33 # Always remove the build path in case it was used. |
| 34 [[ -n "${BUILD_DIR}" ]] && sudo rm -rf "${BUILD_DIR}" |
| 57 if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]] || \ | 35 if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]] || \ |
| 58 [[ ${RAN_ANY_TESTS} -eq ${FLAGS_FALSE} ]]; then | 36 [[ ${RAN_ANY_TESTS} -eq ${FLAGS_FALSE} ]]; then |
| 59 rm -rf "${TMP}" | 37 rm -rf "${TMP}" |
| 60 else | 38 else |
| 61 echo ">>> Details stored under ${TMP}" | 39 echo ">>> Details stored under ${TMP}" |
| 62 fi | 40 fi |
| 63 cleanup_remote_access | 41 cleanup_remote_access |
| 64 } | 42 } |
| 65 | 43 |
| 66 # Adds attributes to all tests run | |
| 67 # Arguments: | |
| 68 # $1 - results directory | |
| 69 # $2 - attribute name (key) | |
| 70 # $3 - attribute value (value) | |
| 71 function add_test_attribute() { | |
| 72 local results_dir="$1" | |
| 73 local attribute_name="$2" | |
| 74 local attribute_value="$3" | |
| 75 if [[ -z "$attribute_value" ]]; then | |
| 76 return; | |
| 77 fi | |
| 78 | |
| 79 for status_file in $(echo "${results_dir}"/*/status); do | |
| 80 local keyval_file=$(dirname $status_file)/keyval | |
| 81 echo "Updating ${keyval_file}" | |
| 82 echo "${attribute_name}=${attribute_value}" >> "${keyval_file}" | |
| 83 done | |
| 84 } | |
| 85 | |
| 86 | |
| 87 # Determine if a control is for a client or server test. Echos | 44 # Determine if a control is for a client or server test. Echos |
| 88 # either "server" or "client". | 45 # either "server" or "client". |
| 89 # Arguments: | 46 # Arguments: |
| 90 # $1 - control file path | 47 # $1 - control file path |
| 91 function read_test_type() { | 48 function read_test_type() { |
| 92 local control_file=$1 | 49 local control_file=$1 |
| 93 # Assume a line starts with TEST_TYPE = | 50 # Assume a line starts with TEST_TYPE = |
| 94 local type=$(egrep -m1 \ | 51 local type=$(egrep -m1 \ |
| 95 '^[[:space:]]*TEST_TYPE[[:space:]]*=' "${control_file}") | 52 '^[[:space:]]*TEST_TYPE[[:space:]]*=' "${control_file}") |
| 96 if [[ -z "${type}" ]]; then | 53 if [[ -z "${type}" ]]; then |
| 97 echo_color "red" ">>> Unable to find TEST_TYPE line in ${control_file}" | 54 die "Unable to find TEST_TYPE line in ${control_file}" |
| 98 exit 1 | |
| 99 fi | 55 fi |
| 100 type=$(python -c "${type}; print TEST_TYPE.lower()") | 56 type=$(python -c "${type}; print TEST_TYPE.lower()") |
| 101 if [[ "${type}" != "client" ]] && [[ "${type}" != "server" ]]; then | 57 if [[ "${type}" != "client" ]] && [[ "${type}" != "server" ]]; then |
| 102 echo_color "red" ">>> Unknown type of test (${type}) in ${control_file}" | 58 die "Unknown type of test (${type}) in ${control_file}" |
| 103 exit 1 | |
| 104 fi | 59 fi |
| 105 echo ${type} | 60 echo ${type} |
| 106 } | 61 } |
| 107 | 62 |
| 63 function create_tmp() { |
| 64 # Set global TMP for remote_access.sh's sake |
| 65 # and if --results_dir_root is specified, |
| 66 # set TMP and create dir appropriately |
| 67 if [[ ${INSIDE_CHROOT} -eq 0 ]]; then |
| 68 if [[ -n "${FLAGS_results_dir_root}" ]]; then |
| 69 TMP=${FLAGS_chroot}${FLAGS_results_dir_root} |
| 70 mkdir -m 777 ${TMP} |
| 71 else |
| 72 TMP=$(mktemp -d ${FLAGS_chroot}/tmp/run_remote_tests.XXXX) |
| 73 fi |
| 74 TMP_INSIDE_CHROOT=$(echo ${TMP#${FLAGS_chroot}}) |
| 75 else |
| 76 if [[ -n "${FLAGS_results_dir_root}" ]]; then |
| 77 TMP=${FLAGS_results_dir_root} |
| 78 mkdir -m 777 ${TMP} |
| 79 else |
| 80 TMP=$(mktemp -d /tmp/run_remote_tests.XXXX) |
| 81 fi |
| 82 TMP_INSIDE_CHROOT=${TMP} |
| 83 fi |
| 84 } |
| 85 |
| 86 function prepare_build_dir() { |
| 87 local autotest_dir="$1" |
| 88 INSIDE_BUILD_DIR="${TMP_INSIDE_CHROOT}/build" |
| 89 BUILD_DIR="${TMP}/build" |
| 90 info "Copying autotest tree into ${BUILD_DIR}." |
| 91 sudo mkdir -p "${BUILD_DIR}" |
| 92 sudo rsync -rl --chmod=ugo=rwx "${autotest_dir}"/ "${BUILD_DIR}" |
| 93 info "Pilfering toolchain shell environment from Portage." |
| 94 local outside_ebuild_dir="${TMP}/chromeos-base/autotest-build" |
| 95 local inside_ebuild_dir="${TMP_INSIDE_CHROOT}/chromeos-base/autotest-build" |
| 96 mkdir -p "${outside_ebuild_dir}" |
| 97 local E_only="autotest-build-9999.ebuild" |
| 98 cat > "${outside_ebuild_dir}/${E_only}" <<EOF |
| 99 inherit toolchain-funcs |
| 100 SLOT="0" |
| 101 EOF |
| 102 local E="chromeos-base/autotest-build/${E_only}" |
| 103 ${ENTER_CHROOT} "ebuild-${FLAGS_board}" "${inside_ebuild_dir}/${E_only}" \ |
| 104 clean unpack 2>&1 > /dev/null |
| 105 local P_tmp="${FLAGS_chroot}/build/${FLAGS_board}/tmp/portage/" |
| 106 local E_dir="${E%%/*}/${E_only%.*}" |
| 107 sudo cp "${P_tmp}/${E_dir}/temp/environment" "${BUILD_DIR}" |
| 108 } |
| 109 |
| 110 function autodetect_build() { |
| 111 if [ ${FLAGS_use_emerged} -eq ${FLAGS_TRUE} ]; then |
| 112 info \ |
| 113 "As requested, using emerged autotests already installed in your sysroot." |
| 114 FLAGS_build=${FLAGS_FALSE} |
| 115 return |
| 116 fi |
| 117 if ${ENTER_CHROOT} ./cros_workon --board=${FLAGS_board} list | \ |
| 118 grep -q autotest; then |
| 119 info \ |
| 120 "Detected cros_workon autotests, building your sources instead of emerged \ |
| 121 autotest. To use installed autotest, pass --use_emerged." |
| 122 FLAGS_build=${FLAGS_TRUE} |
| 123 else |
| 124 info \ |
| 125 "Using emerged autotests already installed in your sysroot. To build \ |
| 126 autotests directly from your source directory instead, pass --build." |
| 127 FLAGS_build=${FLAGS_FALSE} |
| 128 fi |
| 129 } |
| 130 |
| 108 function main() { | 131 function main() { |
| 109 cd $(dirname "$0") | 132 cd $(dirname "$0") |
| 110 | 133 |
| 111 FLAGS "$@" || exit 1 | 134 FLAGS "$@" || exit 1 |
| 112 | 135 |
| 113 if [[ -z "${FLAGS_ARGV}" ]]; then | 136 if [[ -z "${FLAGS_ARGV}" ]]; then |
| 114 echo "Usage: $0 --remote=[hostname] [regexp...]:" | 137 echo "Usage: $0 --remote=[hostname] [regexp...]:" |
| 115 echo "Each regexp pattern must uniquely match a control file. For example:" | 138 echo "Each regexp pattern must uniquely match a control file. For example:" |
| 116 echo " $0 --remote=MyMachine BootPerfServer" | 139 echo " $0 --remote=MyMachine BootPerfServer" |
| 117 exit 1 | 140 exit 1 |
| 118 fi | 141 fi |
| 119 | 142 |
| 120 # Check the validity of the user-specified result directory | 143 # Check the validity of the user-specified result directory |
| 121 # It must be within the /tmp directory | 144 # It must be within the /tmp directory |
| 122 if [[ -n "${FLAGS_results_dir_root}" ]]; then | 145 if [[ -n "${FLAGS_results_dir_root}" ]]; then |
| 123 SUBSTRING=${FLAGS_results_dir_root:0:5} | 146 SUBSTRING=${FLAGS_results_dir_root:0:5} |
| 124 if [[ ${SUBSTRING} != "/tmp/" ]]; then | 147 if [[ ${SUBSTRING} != "/tmp/" ]]; then |
| 125 echo "User-specified result directory must be within the /tmp directory" | 148 echo "User-specified result directory must be within the /tmp directory" |
| 126 echo "ex: --results_dir_root=/tmp/<result_directory>" | 149 echo "ex: --results_dir_root=/tmp/<result_directory>" |
| 127 exit 1 | 150 exit 1 |
| 128 fi | 151 fi |
| 129 fi | 152 fi |
| 130 | 153 |
| 131 set -e | 154 set -e |
| 132 | 155 |
| 133 # Set global TMP for remote_access.sh's sake | 156 create_tmp |
| 134 # and if --results_dir_root is specified, | |
| 135 # set TMP and create dir appropriately | |
| 136 if [[ ${INSIDE_CHROOT} -eq 0 ]]; then | |
| 137 if [[ -n "${FLAGS_results_dir_root}" ]]; then | |
| 138 TMP=${FLAGS_chroot}${FLAGS_results_dir_root} | |
| 139 mkdir -m 777 ${TMP} | |
| 140 else | |
| 141 TMP=$(mktemp -d ${FLAGS_chroot}/tmp/run_remote_tests.XXXX) | |
| 142 fi | |
| 143 TMP_INSIDE_CHROOT=$(echo ${TMP#${FLAGS_chroot}}) | |
| 144 else | |
| 145 if [[ -n "${FLAGS_results_dir_root}" ]]; then | |
| 146 TMP=${FLAGS_results_dir_root} | |
| 147 mkdir -m 777 ${TMP} | |
| 148 else | |
| 149 TMP=$(mktemp -d /tmp/run_remote_tests.XXXX) | |
| 150 fi | |
| 151 TMP_INSIDE_CHROOT=${TMP} | |
| 152 fi | |
| 153 | 157 |
| 154 trap cleanup EXIT | 158 trap cleanup EXIT |
| 155 | 159 |
| 156 remote_access_init | 160 remote_access_init |
| 157 | 161 |
| 158 learn_board | 162 learn_board |
| 159 autotest_dir="${FLAGS_chroot}/build/${FLAGS_board}/usr/local/autotest" | 163 autotest_dir="${FLAGS_chroot}/build/${FLAGS_board}/usr/local/autotest" |
| 160 | 164 |
| 165 ENTER_CHROOT="" |
| 166 if [[ ${INSIDE_CHROOT} -eq 0 ]]; then |
| 167 ENTER_CHROOT="./enter_chroot.sh --chroot ${FLAGS_chroot} --" |
| 168 fi |
| 169 |
| 170 if [ ${FLAGS_build} -eq ${FLAGS_FALSE} ]; then |
| 171 autodetect_build |
| 172 fi |
| 173 |
| 174 if [ ${FLAGS_build} -eq ${FLAGS_TRUE} ]; then |
| 175 autotest_dir="${SRC_ROOT}/third_party/autotest/files" |
| 176 else |
| 177 if [ ! -d "${autotest_dir}" ]; then |
| 178 die "You need to emerge autotest-tests (or use --build)" |
| 179 fi |
| 180 fi |
| 181 |
| 161 local control_files_to_run="" | 182 local control_files_to_run="" |
| 162 local chrome_autotests="${CHROME_ROOT}/src/chrome/test/chromeos/autotest/files
" | 183 local chrome_autotests="${CHROME_ROOT}/src/chrome/test/chromeos/autotest/files
" |
| 163 # Now search for tests which unambiguously include the given identifier | 184 # Now search for tests which unambiguously include the given identifier |
| 164 local search_path=$(echo {client,server}/{tests,site_tests}) | 185 local search_path=$(echo {client,server}/{tests,site_tests}) |
| 165 # Include chrome autotest in the search path | 186 # Include chrome autotest in the search path |
| 166 if [ -n "${CHROME_ROOT}" ]; then | 187 if [ -n "${CHROME_ROOT}" ]; then |
| 167 search_path="${search_path} ${chrome_autotests}/client/site_tests" | 188 search_path="${search_path} ${chrome_autotests}/client/site_tests" |
| 168 fi | 189 fi |
| 169 pushd ${autotest_dir} > /dev/null | 190 pushd ${autotest_dir} > /dev/null |
| 170 for test_request in $FLAGS_ARGV; do | 191 for test_request in $FLAGS_ARGV; do |
| 171 test_request=$(remove_quotes "${test_request}") | 192 test_request=$(remove_quotes "${test_request}") |
| 172 ! finds=$(find ${search_path} -maxdepth 2 -type f \( -name control.\* -or \ | 193 ! finds=$(find ${search_path} -maxdepth 2 -type f \( -name control.\* -or \ |
| 173 -name control \) | egrep -v "~$" | egrep "${test_request}") | 194 -name control \) | egrep -v "~$" | egrep "${test_request}") |
| 174 if [[ -z "${finds}" ]]; then | 195 if [[ -z "${finds}" ]]; then |
| 175 echo_color "red" ">>> Cannot find match for \"${test_request}\"" | 196 die "Cannot find match for \"${test_request}\"" |
| 176 exit 1 | |
| 177 fi | 197 fi |
| 178 local matches=$(echo "${finds}" | wc -l) | 198 local matches=$(echo "${finds}" | wc -l) |
| 179 if [[ ${matches} -gt 1 ]]; then | 199 if [[ ${matches} -gt 1 ]]; then |
| 180 echo ">>> \"${test_request}\" is an ambiguous pattern. Disambiguate by" \ | 200 echo ">>> \"${test_request}\" is an ambiguous pattern. Disambiguate by" \ |
| 181 "passing one of these patterns instead:" | 201 "passing one of these patterns instead:" |
| 182 for FIND in ${finds}; do | 202 for FIND in ${finds}; do |
| 183 echo " ^${FIND}\$" | 203 echo " ^${FIND}\$" |
| 184 done | 204 done |
| 185 exit 1 | 205 exit 1 |
| 186 fi | 206 fi |
| 187 for i in $(seq 1 $FLAGS_iterations); do | 207 for i in $(seq 1 $FLAGS_iterations); do |
| 188 control_files_to_run="${control_files_to_run} '${finds}'" | 208 control_files_to_run="${control_files_to_run} '${finds}'" |
| 189 done | 209 done |
| 190 done | 210 done |
| 191 popd > /dev/null | 211 popd > /dev/null |
| 192 | 212 |
| 193 echo "" | 213 echo "" |
| 194 | 214 |
| 195 if [[ -z "${control_files_to_run}" ]]; then | 215 if [[ -z "${control_files_to_run}" ]]; then |
| 196 echo_color "red" ">>> Found no control files" | 216 die "Found no control files" |
| 197 exit 1 | |
| 198 fi | 217 fi |
| 199 | 218 |
| 200 echo_color "yellow" ">>> Running the following control files:" | 219 [ ${FLAGS_build} -eq ${FLAGS_TRUE} ] && prepare_build_dir "${autotest_dir}" |
| 220 |
| 221 info "Running the following control files:" |
| 201 for CONTROL_FILE in ${control_files_to_run}; do | 222 for CONTROL_FILE in ${control_files_to_run}; do |
| 202 echo_color "yellow" " * " "${CONTROL_FILE}" | 223 info " * ${CONTROL_FILE}" |
| 203 done | 224 done |
| 204 | 225 |
| 205 for control_file in ${control_files_to_run}; do | 226 for control_file in ${control_files_to_run}; do |
| 206 # Assume a line starts with TEST_TYPE = | 227 # Assume a line starts with TEST_TYPE = |
| 207 control_file=$(remove_quotes "${control_file}") | 228 control_file=$(remove_quotes "${control_file}") |
| 208 local type=$(read_test_type "${autotest_dir}/${control_file}") | 229 local type=$(read_test_type "${autotest_dir}/${control_file}") |
| 209 # Check if the control file is an absolute path (i.e. chrome autotests case) | 230 # Check if the control file is an absolute path (i.e. chrome autotests case) |
| 210 if [[ ${control_file:0:1} == "/" ]]; then | 231 if [[ ${control_file:0:1} == "/" ]]; then |
| 211 type=$(read_test_type "${control_file}") | 232 type=$(read_test_type "${control_file}") |
| 212 fi | 233 fi |
| 213 local option | 234 local option |
| 214 if [[ "${type}" == "client" ]]; then | 235 if [[ "${type}" == "client" ]]; then |
| 215 option="-c" | 236 option="-c" |
| 216 else | 237 else |
| 217 option="-s" | 238 option="-s" |
| 218 fi | 239 fi |
| 219 echo "" | 240 echo "" |
| 220 echo_color "yellow" ">>> Running ${type} test " ${control_file} | 241 info "Running ${type} test ${control_file}" |
| 221 local control_file_name=$(basename "${control_file}") | 242 local control_file_name=$(basename "${control_file}") |
| 222 local short_name=$(basename $(dirname "${control_file}")) | 243 local short_name=$(basename $(dirname "${control_file}")) |
| 223 | 244 |
| 224 # testName/control --> testName | 245 # testName/control --> testName |
| 225 # testName/control.bvt --> testName.bvt | 246 # testName/control.bvt --> testName.bvt |
| 226 # testName/control.regression --> testName.regression | 247 # testName/control.regression --> testName.regression |
| 227 # testName/some_control --> testName.some_control | 248 # testName/some_control --> testName.some_control |
| 228 if [[ "${control_file_name}" != control ]]; then | 249 if [[ "${control_file_name}" != control ]]; then |
| 229 if [[ "${control_file_name}" == control.* ]]; then | 250 if [[ "${control_file_name}" == control.* ]]; then |
| 230 short_name=${short_name}.${control_file_name/control./} | 251 short_name=${short_name}.${control_file_name/control./} |
| 231 else | 252 else |
| 232 short_name=${short_name}.${control_file_name} | 253 short_name=${short_name}.${control_file_name} |
| 233 fi | 254 fi |
| 234 fi | 255 fi |
| 235 | 256 |
| 236 local results_dir_name="${short_name}" | 257 local results_dir_name="${short_name}" |
| 237 local results_dir="${TMP_INSIDE_CHROOT}/${results_dir_name}" | 258 local results_dir="${TMP_INSIDE_CHROOT}/${results_dir_name}" |
| 238 rm -rf "${results_dir}" | 259 rm -rf "${results_dir}" |
| 239 local verbose="" | 260 local verbose="" |
| 240 if [[ ${FLAGS_verbose} -eq $FLAGS_TRUE ]]; then | 261 if [[ ${FLAGS_verbose} -eq $FLAGS_TRUE ]]; then |
| 241 verbose="--verbose" | 262 verbose="--verbose" |
| 242 fi | 263 fi |
| 243 | 264 |
| 244 RAN_ANY_TESTS=${FLAGS_TRUE} | 265 RAN_ANY_TESTS=${FLAGS_TRUE} |
| 245 | 266 |
| 246 local enter_chroot="" | |
| 247 local autotest="${GCLIENT_ROOT}/src/scripts/autotest_workon" | |
| 248 if [[ ${INSIDE_CHROOT} -eq 0 ]]; then | |
| 249 enter_chroot="./enter_chroot.sh --chroot ${FLAGS_chroot} --" | |
| 250 autotest="./autotest_workon" | |
| 251 fi | |
| 252 | |
| 253 # Remove chrome autotest location prefix from control_file if needed | 267 # Remove chrome autotest location prefix from control_file if needed |
| 254 if [[ ${control_file:0:${#chrome_autotests}} == \ | 268 if [[ ${control_file:0:${#chrome_autotests}} == \ |
| 255 "${chrome_autotests}" ]]; then | 269 "${chrome_autotests}" ]]; then |
| 256 control_file="${control_file:${#chrome_autotests}+1}" | 270 control_file="${control_file:${#chrome_autotests}+1}" |
| 257 echo_color "yellow" ">>> Running chrome autotest " ${control_file} | 271 info "Running chrome autotest ${control_file}" |
| 258 fi | |
| 259 if [[ -n "${FLAGS_args}" ]]; then | |
| 260 passthrough_args="--args=${FLAGS_args}" | |
| 261 fi | 272 fi |
| 262 | 273 |
| 263 ${enter_chroot} ${autotest} --board "${FLAGS_board}" -m "${FLAGS_remote}" \ | 274 export AUTOSERV_TEST_ARGS="${FLAGS_args}" |
| 264 --ssh-port ${FLAGS_ssh_port} \ | 275 export AUTOSERV_ARGS="-m ${FLAGS_remote} \ |
| 265 "${option}" "${control_file}" -r "${results_dir}" ${verbose} \ | 276 --ssh-port ${FLAGS_ssh_port} \ |
| 266 "${passthrough_args}" >&2 | 277 ${option} ${control_file} -r ${results_dir} ${verbose}" |
| 278 if [ ${FLAGS_build} -eq ${FLAGS_FALSE} ]; then |
| 279 cat > "${TMP}/run_test.sh" <<EOF |
| 280 export AUTOSERV_TEST_ARGS="${AUTOSERV_TEST_ARGS}" |
| 281 export AUTOSERV_ARGS="${AUTOSERV_ARGS}" |
| 282 cd /home/${USER}/trunk/src/scripts |
| 283 ./autotest_run.sh --board "${FLAGS_board}" |
| 284 EOF |
| 285 chmod a+rx "${TMP}/run_test.sh" |
| 286 ${ENTER_CHROOT} ${TMP_INSIDE_CHROOT}/run_test.sh >&2 |
| 287 else |
| 288 cp "${BUILD_DIR}/environment" "${TMP}/run_test.sh" |
| 289 GRAPHICS_BACKEND=${GRAPHICS_BACKEND:-OPENGL} |
| 290 if [ -n "${AUTOSERV_TEST_ARGS}" ]; then |
| 291 AUTOSERV_TEST_ARGS="-a \"${AUTOSERV_TEST_ARGS}\"" |
| 292 fi |
| 293 cat >> "${TMP}/run_test.sh" <<EOF |
| 294 export GCLIENT_ROOT=/home/${USER}/trunk |
| 295 export GRAPHICS_BACKEND=${GRAPHICS_BACKEND} |
| 296 export SSH_AUTH_SOCK=${SSH_AUTH_SOCK} TMPDIR=/tmp SSH_AGENT_PID=${SSH_AGENT_PID} |
| 297 export SYSROOT=/build/${FLAGS_board} |
| 298 tc-export CC CXX PKG_CONFIG |
| 299 cd ${INSIDE_BUILD_DIR} |
| 300 ./server/autoserv ${AUTOSERV_ARGS} ${AUTOSERV_TEST_ARGS} |
| 301 EOF |
| 302 sudo cp "${TMP}/run_test.sh" "${BUILD_DIR}" |
| 303 sudo chmod a+rx "${BUILD_DIR}/run_test.sh" |
| 304 ${ENTER_CHROOT} sudo bash -c "${INSIDE_BUILD_DIR}/run_test.sh" >&2 |
| 305 fi |
| 267 done | 306 done |
| 268 | 307 |
| 269 echo "" | 308 echo "" |
| 270 echo_color "yellow" ">>> Test results:" | 309 info "Test results:" |
| 271 ./generate_test_report "${TMP}" --strip="${TMP}/" | 310 ./generate_test_report "${TMP}" --strip="${TMP}/" |
| 272 | 311 |
| 273 print_time_elapsed | 312 print_time_elapsed |
| 274 } | 313 } |
| 275 | 314 |
| 276 main "$@" | 315 main "$@" |
| OLD | NEW |