Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: run_remote_tests.sh

Issue 6480108: Revert "Add --quiet to run_remote_tests, and use it" (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « bin/cros_au_test_harness.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.
(...skipping 23 matching lines...) Expand all
34 34
35 get_default_board 35 get_default_board
36 36
37 DEFINE_string args "" \ 37 DEFINE_string args "" \
38 "Command line arguments for test. Quoted and space separated if multiple." a 38 "Command line arguments for test. Quoted and space separated if multiple." a
39 DEFINE_string board "$DEFAULT_BOARD" \ 39 DEFINE_string board "$DEFAULT_BOARD" \
40 "The board for which you are building autotest" 40 "The board for which you are building autotest"
41 DEFINE_boolean build ${FLAGS_FALSE} "Build tests while running" b 41 DEFINE_boolean build ${FLAGS_FALSE} "Build tests while running" b
42 DEFINE_string chroot "${DEFAULT_CHROOT_DIR}" "alternate chroot location" c 42 DEFINE_string chroot "${DEFAULT_CHROOT_DIR}" "alternate chroot location" c
43 DEFINE_boolean cleanup ${FLAGS_FALSE} "Clean up temp directory" 43 DEFINE_boolean cleanup ${FLAGS_FALSE} "Clean up temp directory"
44 DEFINE_boolean hide_info ${FLAGS_FALSE} "Hide most test logs on success"
45 DEFINE_integer iterations 1 "Iterations to run every top level test" i 44 DEFINE_integer iterations 1 "Iterations to run every top level test" i
46 DEFINE_string results_dir_root "" "alternate root results directory" 45 DEFINE_string results_dir_root "" "alternate root results directory"
47 DEFINE_boolean verbose ${FLAGS_FALSE} "Show verbose autoserv output" v 46 DEFINE_boolean verbose ${FLAGS_FALSE} "Show verbose autoserv output" v
48 DEFINE_boolean use_emerged ${FLAGS_FALSE} \ 47 DEFINE_boolean use_emerged ${FLAGS_FALSE} \
49 "Force use of emerged autotest packages" 48 "Force use of emerged autotest packages"
50 49
51 RAN_ANY_TESTS=${FLAGS_FALSE} 50 RAN_ANY_TESTS=${FLAGS_FALSE}
52 51
53 function stop_ssh_agent() { 52 function stop_ssh_agent() {
54 # Call this function from the exit trap of the main script. 53 # Call this function from the exit trap of the main script.
55 # Iff we started ssh-agent, be nice and clean it up. 54 # Iff we started ssh-agent, be nice and clean it up.
56 # Note, only works if called from the main script - no subshells. 55 # Note, only works if called from the main script - no subshells.
57 if [[ 1 -eq ${OWN_SSH_AGENT} ]]; then 56 if [[ 1 -eq ${OWN_SSH_AGENT} ]]; then
58 kill ${SSH_AGENT_PID} 2>/dev/null 57 kill ${SSH_AGENT_PID} 2>/dev/null
59 unset OWN_SSH_AGENT SSH_AGENT_PID SSH_AUTH_SOCK 58 unset OWN_SSH_AGENT SSH_AGENT_PID SSH_AUTH_SOCK
60 fi 59 fi
61 } 60 }
62 61
63 function start_ssh_agent() { 62 function start_ssh_agent() {
64 local tmp_private_key=$TMP/autotest_key 63 local tmp_private_key=$TMP/autotest_key
65 if [ -z "$SSH_AGENT_PID" ]; then 64 if [ -z "$SSH_AGENT_PID" ]; then
66 eval $(ssh-agent) 65 eval $(ssh-agent)
67 OWN_SSH_AGENT=1 66 OWN_SSH_AGENT=1
68 else 67 else
69 OWN_SSH_AGENT=0 68 OWN_SSH_AGENT=0
70 fi 69 fi
71 cp $FLAGS_private_key $tmp_private_key 70 cp $FLAGS_private_key $tmp_private_key
72 chmod 0400 $tmp_private_key 71 chmod 0400 $tmp_private_key
73 72 ssh-add $tmp_private_key
74 # Run this way to capture normal stderr output but only display it
75 # on failure.
76 result="$(ssh-add $tmp_private_key 2>&1)" || die "$result"
77 } 73 }
78 74
79 function cleanup() { 75 function cleanup() {
80 # Always remove the build path in case it was used. 76 # Always remove the build path in case it was used.
81 [[ -n "${BUILD_DIR}" ]] && sudo rm -rf "${BUILD_DIR}" 77 [[ -n "${BUILD_DIR}" ]] && sudo rm -rf "${BUILD_DIR}"
82 if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]] || \ 78 if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]] || \
83 [[ ${RAN_ANY_TESTS} -eq ${FLAGS_FALSE} ]]; then 79 [[ ${RAN_ANY_TESTS} -eq ${FLAGS_FALSE} ]]; then
84 rm -rf "${TMP}" 80 rm -rf "${TMP}"
85 else 81 else
86 echo ">>> Details stored under ${TMP}" 82 echo ">>> Details stored under ${TMP}"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 fi 312 fi
317 313
318 local autoserv_args="-m ${FLAGS_remote} --ssh-port ${FLAGS_ssh_port} \ 314 local autoserv_args="-m ${FLAGS_remote} --ssh-port ${FLAGS_ssh_port} \
319 ${option} ${control_file} -r ${results_dir} ${verbose}" 315 ${option} ${control_file} -r ${results_dir} ${verbose}"
320 if [ -n "${FLAGS_args}" ]; then 316 if [ -n "${FLAGS_args}" ]; then
321 autoserv_args="${autoserv_args} --args=${FLAGS_args}" 317 autoserv_args="${autoserv_args} --args=${FLAGS_args}"
322 fi 318 fi
323 319
324 sudo chmod a+w ./server/{tests,site_tests} 320 sudo chmod a+w ./server/{tests,site_tests}
325 echo ./server/autoserv ${autoserv_args} 321 echo ./server/autoserv ${autoserv_args}
326 322
327 # run autoserv in subshell, capture it's output, and only display output
328 # on error.
329 code=0
330 if [ ${FLAGS_build} -eq ${FLAGS_TRUE} ]; then 323 if [ ${FLAGS_build} -eq ${FLAGS_TRUE} ]; then
331 result="$(. ${BUILD_ENV} && tc-export CC CXX PKG_CONFIG && 324 # run autoserv in subshell
332 ./server/autoserv ${autoserv_args} 2>&1)" || code=1 325 (. ${BUILD_ENV} && tc-export CC CXX PKG_CONFIG &&
326 ./server/autoserv ${autoserv_args})
333 else 327 else
334 result="$(./server/autoserv ${autoserv_args} 2>&1)" || code=1 328 ./server/autoserv ${autoserv_args}
335 fi
336
337 if [ $code -ne 0 -o ${FLAGS_hide_info} -eq ${FLAGS_FALSE} ]; then
338 echo
339 echo "${result}"
340 exit $code
341 fi 329 fi
342 done 330 done
343 popd > /dev/null 331 popd > /dev/null
344 332
345 echo "" 333 echo ""
346 info "Test results:" 334 info "Test results:"
347 ./generate_test_report "${TMP}" --strip="${TMP}/" 335 ./generate_test_report "${TMP}" --strip="${TMP}/"
348 336
349 print_time_elapsed 337 print_time_elapsed
350 } 338 }
351 339
352 restart_in_chroot_if_needed "$@" 340 restart_in_chroot_if_needed "$@"
353 main "$@" 341 main "$@"
OLDNEW
« no previous file with comments | « bin/cros_au_test_harness.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698