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)/autotest_lib.sh" | 13 . "$(dirname $0)/autotest_lib.sh" |
14 . "$(dirname $0)/remote_access.sh" | 14 . "$(dirname $0)/remote_access.sh" |
15 | 15 |
16 DEFAULT_OUTPUT_FILE=test-output-$(date '+%Y%m%d.%H%M%S') | 16 DEFAULT_OUTPUT_FILE=test-output-$(date '+%Y%m%d.%H%M%S') |
17 | 17 |
| 18 DEFINE_string build_desc "" "Build description used in database" |
| 19 DEFINE_string chroot "${DEFAULT_CHROOT_DIR}" "alternate chroot location" c |
18 DEFINE_boolean cleanup ${FLAGS_TRUE} "Clean up temp directory" | 20 DEFINE_boolean cleanup ${FLAGS_TRUE} "Clean up temp directory" |
19 DEFINE_integer iterations 1 "Iterations to run every top level test" i | 21 DEFINE_integer iterations 1 "Iterations to run every top level test" i |
| 22 DEFINE_string machine_desc "" "Machine description used in database" |
20 DEFINE_string output_file "${DEFAULT_OUTPUT_FILE}" "Test run output" o | 23 DEFINE_string output_file "${DEFAULT_OUTPUT_FILE}" "Test run output" o |
| 24 DEFINE_string prepackaged_autotest "" "Use this prepackaged autotest dir" |
| 25 DEFINE_string results_dir_root "" "alternate root results directory" |
| 26 DEFINE_boolean update_db ${FLAGS_FALSE} "Put results in autotest database" u |
21 DEFINE_boolean verbose ${FLAGS_FALSE} "Show verbose autoserv output" v | 27 DEFINE_boolean verbose ${FLAGS_FALSE} "Show verbose autoserv output" v |
22 DEFINE_boolean update_db ${FLAGS_FALSE} "Put results in autotest database" u | |
23 DEFINE_string machine_desc "" "Machine description used in database" | |
24 DEFINE_string build_desc "" "Build description used in database" | |
25 DEFINE_string chroot "${DEFAULT_CHROOT_DIR}" "alternate chroot location" c | |
26 DEFINE_string results_dir_root "" "alternate root results directory" | |
27 | 28 |
28 function cleanup() { | 29 function cleanup() { |
29 if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]]; then | 30 if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]]; then |
30 rm -rf "${TMP}" | 31 rm -rf "${TMP}" |
31 else | 32 else |
32 echo "Left temporary files at ${TMP}" | 33 echo "Left temporary files at ${TMP}" |
33 fi | 34 fi |
34 cleanup_remote_access | 35 cleanup_remote_access |
35 } | 36 } |
36 | 37 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 cd $(dirname "$0") | 89 cd $(dirname "$0") |
89 | 90 |
90 FLAGS "$@" || exit 1 | 91 FLAGS "$@" || exit 1 |
91 | 92 |
92 if [[ -z "${FLAGS_ARGV}" ]]; then | 93 if [[ -z "${FLAGS_ARGV}" ]]; then |
93 echo "Please specify tests to run, like:" | 94 echo "Please specify tests to run, like:" |
94 echo " $0 --remote=MyMachine SystemBootPerf" | 95 echo " $0 --remote=MyMachine SystemBootPerf" |
95 exit 1 | 96 exit 1 |
96 fi | 97 fi |
97 | 98 |
98 check_board | |
99 | |
100 local parse_cmd="$(dirname $0)/../third_party/autotest/files/tko/parse.py" | |
101 | |
102 if [[ ${FLAGS_update_db} -eq ${FLAGS_TRUE} && ! -x "${parse_cmd}" ]]; then | |
103 echo "Cannot find parser ${parse_cmd}" | |
104 exit 1 | |
105 fi | |
106 | |
107 set -e | 99 set -e |
108 | 100 |
109 # Set global TMP for remote_access.sh's sake | 101 # Set global TMP for remote_access.sh's sake |
110 TMP=$(mktemp -d /tmp/run_remote_tests.XXXX) | 102 TMP=$(mktemp -d /tmp/run_remote_tests.XXXX) |
111 | 103 |
112 rm -f "${FLAGS_output_file}" | 104 rm -f "${FLAGS_output_file}" |
113 | 105 |
114 trap cleanup EXIT | 106 trap cleanup EXIT |
115 | 107 |
116 # Always copy into installed autotest directory. This way if a user | 108 local autotest_dir="" |
117 # is just modifying scripts, they take effect without having to wait | 109 if [[ -z "${FLAGS_prepackaged_autotest}" ]]; then |
118 # for the laborious build_autotest.sh command. | 110 check_board |
119 local original="${GCLIENT_ROOT}/src/third_party/autotest/files" | 111 # Always copy into installed autotest directory. This way if a user |
120 local autotest_dir="${FLAGS_chroot}/build/${FLAGS_board}/usr/local/autotest" | 112 # is just modifying scripts, they take effect without having to wait |
121 update_chroot_autotest "${original}" "${autotest_dir}" | 113 # for the laborious build_autotest.sh command. |
| 114 local original="${GCLIENT_ROOT}/src/third_party/autotest/files" |
| 115 autotest_dir="${FLAGS_chroot}/build/${FLAGS_board}/usr/local/autotest" |
| 116 update_chroot_autotest "${original}" "${autotest_dir}" |
| 117 else |
| 118 autotest_dir="${FLAGS_prepackaged_autotest}" |
| 119 fi |
| 120 |
| 121 local parse_cmd="${autotest_dir}/tko/parse.py" |
| 122 |
| 123 if [[ ${FLAGS_update_db} -eq ${FLAGS_TRUE} && ! -x "${parse_cmd}" ]]; then |
| 124 echo "Cannot find parser ${parse_cmd}" |
| 125 exit 1 |
| 126 fi |
122 | 127 |
123 local autoserv="${autotest_dir}/server/autoserv" | 128 local autoserv="${autotest_dir}/server/autoserv" |
124 | 129 |
125 local control_files_to_run="" | 130 local control_files_to_run="" |
126 | 131 |
127 # Now search for tests which unambiguously include the given identifier | 132 # Now search for tests which unambiguously include the given identifier |
128 local search_path=$(echo ${autotest_dir}/{client,server}/{tests,site_tests}) | 133 local search_path=$(echo ${autotest_dir}/{client,server}/{tests,site_tests}) |
129 for test_request in $FLAGS_ARGV; do | 134 for test_request in $FLAGS_ARGV; do |
130 test_request=$(remove_quotes "${test_request}") | 135 test_request=$(remove_quotes "${test_request}") |
131 ! finds=$(find ${search_path} -type f -name control | \ | 136 ! finds=$(find ${search_path} -type f -name control | \ |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 echo "Parse failed." | tee -a "${FLAGS_output_file}" | 219 echo "Parse failed." | tee -a "${FLAGS_output_file}" |
215 FLAGS_cleanup=${FLAGS_FALSE} | 220 FLAGS_cleanup=${FLAGS_FALSE} |
216 fi | 221 fi |
217 fi | 222 fi |
218 done | 223 done |
219 | 224 |
220 echo "Output stored to ${FLAGS_output_file}" | 225 echo "Output stored to ${FLAGS_output_file}" |
221 } | 226 } |
222 | 227 |
223 main $@ | 228 main $@ |
OLD | NEW |