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

Side by Side Diff: run_remote_tests.sh

Issue 6537005: Fix argument (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"
44 DEFINE_integer iterations 1 "Iterations to run every top level test" i 45 DEFINE_integer iterations 1 "Iterations to run every top level test" i
45 DEFINE_string results_dir_root "" "alternate root results directory" 46 DEFINE_string results_dir_root "" "alternate root results directory"
46 DEFINE_boolean verbose ${FLAGS_FALSE} "Show verbose autoserv output" v 47 DEFINE_boolean verbose ${FLAGS_FALSE} "Show verbose autoserv output" v
47 DEFINE_boolean use_emerged ${FLAGS_FALSE} \ 48 DEFINE_boolean use_emerged ${FLAGS_FALSE} \
48 "Force use of emerged autotest packages" 49 "Force use of emerged autotest packages"
49 50
50 RAN_ANY_TESTS=${FLAGS_FALSE} 51 RAN_ANY_TESTS=${FLAGS_FALSE}
51 52
52 function stop_ssh_agent() { 53 function stop_ssh_agent() {
53 # Call this function from the exit trap of the main script. 54 # Call this function from the exit trap of the main script.
54 # Iff we started ssh-agent, be nice and clean it up. 55 # Iff we started ssh-agent, be nice and clean it up.
55 # Note, only works if called from the main script - no subshells. 56 # Note, only works if called from the main script - no subshells.
56 if [[ 1 -eq ${OWN_SSH_AGENT} ]]; then 57 if [[ 1 -eq ${OWN_SSH_AGENT} ]]; then
57 kill ${SSH_AGENT_PID} 2>/dev/null 58 kill ${SSH_AGENT_PID} 2>/dev/null
58 unset OWN_SSH_AGENT SSH_AGENT_PID SSH_AUTH_SOCK 59 unset OWN_SSH_AGENT SSH_AGENT_PID SSH_AUTH_SOCK
59 fi 60 fi
60 } 61 }
61 62
62 function start_ssh_agent() { 63 function start_ssh_agent() {
63 local tmp_private_key=$TMP/autotest_key 64 local tmp_private_key=$TMP/autotest_key
64 if [ -z "$SSH_AGENT_PID" ]; then 65 if [ -z "$SSH_AGENT_PID" ]; then
65 eval $(ssh-agent) 66 eval $(ssh-agent)
66 OWN_SSH_AGENT=1 67 OWN_SSH_AGENT=1
67 else 68 else
68 OWN_SSH_AGENT=0 69 OWN_SSH_AGENT=0
69 fi 70 fi
70 cp $FLAGS_private_key $tmp_private_key 71 cp $FLAGS_private_key $tmp_private_key
71 chmod 0400 $tmp_private_key 72 chmod 0400 $tmp_private_key
72 ssh-add $tmp_private_key 73
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"
73 } 77 }
74 78
75 function cleanup() { 79 function cleanup() {
76 # Always remove the build path in case it was used. 80 # Always remove the build path in case it was used.
77 [[ -n "${BUILD_DIR}" ]] && sudo rm -rf "${BUILD_DIR}" 81 [[ -n "${BUILD_DIR}" ]] && sudo rm -rf "${BUILD_DIR}"
78 if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]] || \ 82 if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]] || \
79 [[ ${RAN_ANY_TESTS} -eq ${FLAGS_FALSE} ]]; then 83 [[ ${RAN_ANY_TESTS} -eq ${FLAGS_FALSE} ]]; then
80 rm -rf "${TMP}" 84 rm -rf "${TMP}"
81 else 85 else
82 echo ">>> Details stored under ${TMP}" 86 echo ">>> Details stored under ${TMP}"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 fi 316 fi
313 317
314 local autoserv_args="-m ${FLAGS_remote} --ssh-port ${FLAGS_ssh_port} \ 318 local autoserv_args="-m ${FLAGS_remote} --ssh-port ${FLAGS_ssh_port} \
315 ${option} ${control_file} -r ${results_dir} ${verbose}" 319 ${option} ${control_file} -r ${results_dir} ${verbose}"
316 if [ -n "${FLAGS_args}" ]; then 320 if [ -n "${FLAGS_args}" ]; then
317 autoserv_args="${autoserv_args} --args=${FLAGS_args}" 321 autoserv_args="${autoserv_args} --args=${FLAGS_args}"
318 fi 322 fi
319 323
320 sudo chmod a+w ./server/{tests,site_tests} 324 sudo chmod a+w ./server/{tests,site_tests}
321 echo ./server/autoserv ${autoserv_args} 325 echo ./server/autoserv ${autoserv_args}
322 326
327 # run autoserv in subshell, capture it's output, and only display output
328 # on error.
329 code=0
323 if [ ${FLAGS_build} -eq ${FLAGS_TRUE} ]; then 330 if [ ${FLAGS_build} -eq ${FLAGS_TRUE} ]; then
324 # run autoserv in subshell 331 result="$(. ${BUILD_ENV} && tc-export CC CXX PKG_CONFIG &&
325 (. ${BUILD_ENV} && tc-export CC CXX PKG_CONFIG && 332 ./server/autoserv ${autoserv_args} 2>&1)" || code=1
326 ./server/autoserv ${autoserv_args})
327 else 333 else
328 ./server/autoserv ${autoserv_args} 334 result="$(./server/autoserv ${autoserv_args} 2>&1)" || code=1
335 fi
336
337 if [ $code -ne 0 -o ${FLAGS_hide_info} -eq ${FLAGS_FALSE} ]; then
338 echo
339 echo "${result}"
340 exit $code
329 fi 341 fi
330 done 342 done
331 popd > /dev/null 343 popd > /dev/null
332 344
333 echo "" 345 echo ""
334 info "Test results:" 346 info "Test results:"
335 ./generate_test_report "${TMP}" --strip="${TMP}/" 347 ./generate_test_report "${TMP}" --strip="${TMP}/"
336 348
337 print_time_elapsed 349 print_time_elapsed
338 } 350 }
339 351
340 restart_in_chroot_if_needed "$@" 352 restart_in_chroot_if_needed "$@"
341 main "$@" 353 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