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 board "$DEFAULT_BOARD" \ | 18 DEFINE_string board "$DEFAULT_BOARD" \ |
18 "The board for which you are building autotest" | 19 "The board for which you are building autotest" |
19 DEFINE_string chroot "${DEFAULT_CHROOT_DIR}" "alternate chroot location" c | 20 DEFINE_string chroot "${DEFAULT_CHROOT_DIR}" "alternate chroot location" c |
20 DEFINE_boolean cleanup ${FLAGS_FALSE} "Clean up temp directory" | 21 DEFINE_boolean cleanup ${FLAGS_FALSE} "Clean up temp directory" |
21 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 |
22 DEFINE_string prepackaged_autotest "" "Use this prepackaged autotest dir" | 23 DEFINE_string prepackaged_autotest "" "Use this prepackaged autotest dir" |
23 DEFINE_string results_dir_root "" "alternate root results directory" | 24 DEFINE_string results_dir_root "" "alternate root results directory" |
24 DEFINE_boolean verbose ${FLAGS_FALSE} "Show verbose autoserv output" v | 25 DEFINE_boolean verbose ${FLAGS_FALSE} "Show verbose autoserv output" v |
25 | 26 |
26 RAN_ANY_TESTS=${FLAGS_FALSE} | 27 RAN_ANY_TESTS=${FLAGS_FALSE} |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 echo "" | 236 echo "" |
236 echo_color "yellow" ">>> Running ${type} test " ${control_file} | 237 echo_color "yellow" ">>> Running ${type} test " ${control_file} |
237 local short_name=$(basename $(dirname "${control_file}")) | 238 local short_name=$(basename $(dirname "${control_file}")) |
238 local results_dir_name="${short_name}" | 239 local results_dir_name="${short_name}" |
239 local results_dir="${TMP_INSIDE_CHROOT}/${results_dir_name}" | 240 local results_dir="${TMP_INSIDE_CHROOT}/${results_dir_name}" |
240 rm -rf "${results_dir}" | 241 rm -rf "${results_dir}" |
241 local verbose="" | 242 local verbose="" |
242 if [[ ${FLAGS_verbose} -eq $FLAGS_TRUE ]]; then | 243 if [[ ${FLAGS_verbose} -eq $FLAGS_TRUE ]]; then |
243 verbose="--verbose" | 244 verbose="--verbose" |
244 fi | 245 fi |
| 246 local args=() |
| 247 if [[ -n "${FLAGS_args}" ]]; then |
| 248 local with_spaces="" |
| 249 with_spaces=${FLAGS_args//,/ } |
| 250 args=("-a" "${with_spaces}") |
| 251 fi |
245 | 252 |
246 RAN_ANY_TESTS=${FLAGS_TRUE} | 253 RAN_ANY_TESTS=${FLAGS_TRUE} |
247 | 254 |
248 local enter_chroot="" | 255 local enter_chroot="" |
249 local autotest="${GCLIENT_ROOT}/src/scripts/autotest" | 256 local autotest="${GCLIENT_ROOT}/src/scripts/autotest" |
250 if [[ ${INSIDE_CHROOT} -eq 0 ]]; then | 257 if [[ ${INSIDE_CHROOT} -eq 0 ]]; then |
251 enter_chroot="./enter_chroot.sh --chroot ${FLAGS_chroot} --" | 258 enter_chroot="./enter_chroot.sh --chroot ${FLAGS_chroot} --" |
252 autotest="./autotest" | 259 autotest="./autotest" |
253 fi | 260 fi |
254 | 261 |
255 ${enter_chroot} ${autotest} --board "${FLAGS_board}" -m "${FLAGS_remote}" \ | 262 ${enter_chroot} ${autotest} --board "${FLAGS_board}" -m "${FLAGS_remote}" \ |
256 "${option}" "${control_file}" -r "${results_dir}" ${verbose} | 263 "${option}" "${control_file}" -r "${results_dir}" ${verbose} \ |
| 264 "${args[@]}" |
257 | 265 |
258 results_dir="${TMP}/${results_dir_name}" | 266 results_dir="${TMP}/${results_dir_name}" |
259 local test_status="${results_dir}/status.log" | 267 local test_status="${results_dir}/status.log" |
260 local test_result_dir="${results_dir}/${short_name}" | 268 local test_result_dir="${results_dir}/${short_name}" |
261 local keyval_file="${test_result_dir}/results/keyval" | 269 local keyval_file="${test_result_dir}/results/keyval" |
262 echo "" | 270 echo "" |
263 if is_successful_test "${test_status}"; then | 271 if is_successful_test "${test_status}"; then |
264 echo_color "green" ">>> SUCCESS: ${control_file}" | 272 echo_color "green" ">>> SUCCESS: ${control_file}" |
265 if [[ -f "${keyval_file}" ]]; then | 273 if [[ -f "${keyval_file}" ]]; then |
266 echo ">>> Keyval was:" | 274 echo ">>> Keyval was:" |
267 cat "${keyval_file}" | 275 cat "${keyval_file}" |
268 fi | 276 fi |
269 else | 277 else |
270 echo_color "red" ">>> FAILED: ${control_file}" | 278 echo_color "red" ">>> FAILED: ${control_file}" |
271 cat "${test_status}" | 279 cat "${test_status}" |
272 fi | 280 fi |
273 local end_time=$(date '+%s') | 281 local end_time=$(date '+%s') |
274 done | 282 done |
275 } | 283 } |
276 | 284 |
277 main $@ | 285 main $@ |
OLD | NEW |