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 "" "Command line arguments for test, separated with comma" a | 17 DEFINE_string args "" "Command line arguments for test, separated with comma" a |
18 DEFINE_string board "$DEFAULT_BOARD" \ | 18 DEFINE_string board "$DEFAULT_BOARD" \ |
19 "The board for which you are building autotest" | 19 "The board for which you are building autotest" |
20 DEFINE_string chroot "${DEFAULT_CHROOT_DIR}" "alternate chroot location" c | 20 DEFINE_string chroot "${DEFAULT_CHROOT_DIR}" "alternate chroot location" c |
21 DEFINE_boolean cleanup ${FLAGS_FALSE} "Clean up temp directory" | 21 DEFINE_boolean cleanup ${FLAGS_FALSE} "Clean up temp directory" |
22 DEFINE_integer iterations 1 "Iterations to run every top level test" i | 22 DEFINE_integer iterations 1 "Iterations to run every top level test" i |
23 DEFINE_string prepackaged_autotest "" "Use this prepackaged autotest dir" | |
24 DEFINE_string results_dir_root "" "alternate root results directory" | 23 DEFINE_string results_dir_root "" "alternate root results directory" |
25 DEFINE_boolean verbose ${FLAGS_FALSE} "Show verbose autoserv output" v | 24 DEFINE_boolean verbose ${FLAGS_FALSE} "Show verbose autoserv output" v |
26 | 25 |
27 RAN_ANY_TESTS=${FLAGS_FALSE} | 26 RAN_ANY_TESTS=${FLAGS_FALSE} |
28 | 27 |
29 # Check if our stdout is a tty | 28 # Check if our stdout is a tty |
30 function is_a_tty() { | 29 function is_a_tty() { |
31 local stdout=$(readlink /proc/$$/fd/1) | 30 local stdout=$(readlink /proc/$$/fd/1) |
32 [[ "${stdout#/dev/tty}" != "${stdout}" ]] && return 0 | 31 [[ "${stdout#/dev/tty}" != "${stdout}" ]] && return 0 |
33 [[ "${stdout#/dev/pts}" != "${stdout}" ]] && return 0 | 32 [[ "${stdout#/dev/pts}" != "${stdout}" ]] && return 0 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 else | 147 else |
149 TMP=$(mktemp -d /tmp/run_remote_tests.XXXX) | 148 TMP=$(mktemp -d /tmp/run_remote_tests.XXXX) |
150 fi | 149 fi |
151 TMP_INSIDE_CHROOT=${TMP} | 150 TMP_INSIDE_CHROOT=${TMP} |
152 fi | 151 fi |
153 | 152 |
154 trap cleanup EXIT | 153 trap cleanup EXIT |
155 | 154 |
156 remote_access_init | 155 remote_access_init |
157 | 156 |
158 local autotest_dir="" | 157 learn_board |
159 if [[ -z "${FLAGS_prepackaged_autotest}" ]]; then | 158 autotest_dir="${FLAGS_chroot}/build/${FLAGS_board}/usr/local/autotest" |
160 learn_board | |
161 if [[ -n "${CROS_WORKON_SRCROOT}" ]]; then | |
162 autotest_dir="/build/${FLAGS_board}/usr/local/autotest" | |
163 else | |
164 autotest_dir="${GCLIENT_ROOT}/src/third_party/autotest/files" | |
165 fi | |
166 else | |
167 autotest_dir="${FLAGS_prepackaged_autotest}" | |
168 fi | |
169 | 159 |
170 local control_files_to_run="" | 160 local control_files_to_run="" |
171 local chrome_autotests="${CHROME_ROOT}/src/chrome/test/chromeos/autotest/files
" | 161 local chrome_autotests="${CHROME_ROOT}/src/chrome/test/chromeos/autotest/files
" |
172 # Now search for tests which unambiguously include the given identifier | 162 # Now search for tests which unambiguously include the given identifier |
173 local search_path=$(echo {client,server}/{tests,site_tests}) | 163 local search_path=$(echo {client,server}/{tests,site_tests}) |
174 # Include chrome autotest in the search path | 164 # Include chrome autotest in the search path |
175 if [ -n "${CHROME_ROOT}" ]; then | 165 if [ -n "${CHROME_ROOT}" ]; then |
176 search_path="${search_path} ${chrome_autotests}/client/site_tests" | 166 search_path="${search_path} ${chrome_autotests}/client/site_tests" |
177 fi | 167 fi |
178 pushd ${autotest_dir} > /dev/null | 168 pushd ${autotest_dir} > /dev/null |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 local results_dir_name="${short_name}" | 235 local results_dir_name="${short_name}" |
246 local results_dir="${TMP_INSIDE_CHROOT}/${results_dir_name}" | 236 local results_dir="${TMP_INSIDE_CHROOT}/${results_dir_name}" |
247 rm -rf "${results_dir}" | 237 rm -rf "${results_dir}" |
248 local verbose="" | 238 local verbose="" |
249 if [[ ${FLAGS_verbose} -eq $FLAGS_TRUE ]]; then | 239 if [[ ${FLAGS_verbose} -eq $FLAGS_TRUE ]]; then |
250 verbose="--verbose" | 240 verbose="--verbose" |
251 fi | 241 fi |
252 | 242 |
253 RAN_ANY_TESTS=${FLAGS_TRUE} | 243 RAN_ANY_TESTS=${FLAGS_TRUE} |
254 | 244 |
255 # HACK: Temporary hack for cros-workon conversion | |
256 [[ -n "${CROS_WORKON_SRCROOT}" ]] && WORKON_SUFFIX=_workon | |
257 | |
258 local enter_chroot="" | 245 local enter_chroot="" |
259 local autotest="${GCLIENT_ROOT}/src/scripts/autotest${WORKON_SUFFIX}" | 246 local autotest="${GCLIENT_ROOT}/src/scripts/autotest_workon" |
260 if [[ ${INSIDE_CHROOT} -eq 0 ]]; then | 247 if [[ ${INSIDE_CHROOT} -eq 0 ]]; then |
261 enter_chroot="./enter_chroot.sh --chroot ${FLAGS_chroot} --" | 248 enter_chroot="./enter_chroot.sh --chroot ${FLAGS_chroot} --" |
262 autotest="./autotest${WORKON_SUFFIX}" | 249 autotest="./autotest_workon" |
263 fi | 250 fi |
264 | 251 |
265 # Remove chrome autotest location prefix from control_file if needed | 252 # Remove chrome autotest location prefix from control_file if needed |
266 if [[ ${control_file:0:${#chrome_autotests}} == \ | 253 if [[ ${control_file:0:${#chrome_autotests}} == \ |
267 "${chrome_autotests}" ]]; then | 254 "${chrome_autotests}" ]]; then |
268 control_file="${control_file:${#chrome_autotests}+1}" | 255 control_file="${control_file:${#chrome_autotests}+1}" |
269 echo_color "yellow" ">>> Running chrome autotest " ${control_file} | 256 echo_color "yellow" ">>> Running chrome autotest " ${control_file} |
270 fi | 257 fi |
271 if [[ -n "${FLAGS_args}" ]]; then | 258 if [[ -n "${FLAGS_args}" ]]; then |
272 passthrough_args="--args=${FLAGS_args}" | 259 passthrough_args="--args=${FLAGS_args}" |
273 fi | 260 fi |
274 | 261 |
275 ${enter_chroot} ${autotest} --board "${FLAGS_board}" -m "${FLAGS_remote}" \ | 262 ${enter_chroot} ${autotest} --board "${FLAGS_board}" -m "${FLAGS_remote}" \ |
276 --ssh-port ${FLAGS_ssh_port} \ | 263 --ssh-port ${FLAGS_ssh_port} \ |
277 "${option}" "${control_file}" -r "${results_dir}" ${verbose} \ | 264 "${option}" "${control_file}" -r "${results_dir}" ${verbose} \ |
278 "${passthrough_args}" >&2 | 265 "${passthrough_args}" >&2 |
279 done | 266 done |
280 | 267 |
281 echo "" | 268 echo "" |
282 echo_color "yellow" ">>> Test results:" | 269 echo_color "yellow" ">>> Test results:" |
283 ./generate_test_report "${TMP}" --strip="${TMP}/" | 270 ./generate_test_report "${TMP}" --strip="${TMP}/" |
284 | 271 |
285 print_time_elapsed | 272 print_time_elapsed |
286 } | 273 } |
287 | 274 |
288 main "$@" | 275 main "$@" |
OLD | NEW |