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" | 18 DEFINE_string build_desc "" "Build description used in database" |
19 DEFINE_string chroot "${DEFAULT_CHROOT_DIR}" "alternate chroot location" c | 19 DEFINE_string chroot "${DEFAULT_CHROOT_DIR}" "alternate chroot location" c |
20 DEFINE_boolean cleanup ${FLAGS_TRUE} "Clean up temp directory" | 20 DEFINE_boolean cleanup ${FLAGS_FALSE} "Clean up temp directory" |
21 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" | 22 DEFINE_string machine_desc "" "Machine description used in database" |
23 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" | 24 DEFINE_string prepackaged_autotest "" "Use this prepackaged autotest dir" |
25 DEFINE_string results_dir_root "" "alternate root results directory" | 25 DEFINE_string results_dir_root "" "alternate root results directory" |
26 DEFINE_boolean update_db ${FLAGS_FALSE} "Put results in autotest database" u | 26 DEFINE_boolean update_db ${FLAGS_FALSE} "Put results in autotest database" u |
27 DEFINE_boolean verbose ${FLAGS_FALSE} "Show verbose autoserv output" v | 27 DEFINE_boolean verbose ${FLAGS_FALSE} "Show verbose autoserv output" v |
28 | 28 |
29 function cleanup() { | 29 function cleanup() { |
30 if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]]; then | 30 if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]]; then |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 fi | 143 fi |
144 | 144 |
145 local autoserv="${autotest_dir}/server/autoserv" | 145 local autoserv="${autotest_dir}/server/autoserv" |
146 | 146 |
147 local control_files_to_run="" | 147 local control_files_to_run="" |
148 | 148 |
149 # Now search for tests which unambiguously include the given identifier | 149 # Now search for tests which unambiguously include the given identifier |
150 local search_path=$(echo ${autotest_dir}/{client,server}/{tests,site_tests}) | 150 local search_path=$(echo ${autotest_dir}/{client,server}/{tests,site_tests}) |
151 for test_request in $FLAGS_ARGV; do | 151 for test_request in $FLAGS_ARGV; do |
152 test_request=$(remove_quotes "${test_request}") | 152 test_request=$(remove_quotes "${test_request}") |
153 ! finds=$(find ${search_path} -type f -name control | \ | 153 ! finds=$(find ${search_path} -type f -name control\* | \ |
petkov
2010/03/18 23:44:49
What happens when you have multiple control files
| |
154 egrep "${test_request}") | 154 egrep "${test_request}") |
155 if [[ -z "${finds}" ]]; then | 155 if [[ -z "${finds}" ]]; then |
156 echo "Can not find match for ${test_request}" | 156 echo "Can not find match for ${test_request}" |
157 exit 1 | 157 exit 1 |
158 fi | 158 fi |
159 local matches=$(echo "${finds}" | wc -l) | 159 local matches=$(echo "${finds}" | wc -l) |
160 if [[ ${matches} -gt 1 ]]; then | 160 if [[ ${matches} -gt 1 ]]; then |
161 echo "${test_request} is ambiguous:" | 161 echo "${test_request} is ambiguous:" |
162 echo "${finds}" | 162 echo "${finds}" |
163 exit 1 | 163 exit 1 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
234 echo "Parse failed." | tee -a "${FLAGS_output_file}" | 234 echo "Parse failed." | tee -a "${FLAGS_output_file}" |
235 FLAGS_cleanup=${FLAGS_FALSE} | 235 FLAGS_cleanup=${FLAGS_FALSE} |
236 fi | 236 fi |
237 fi | 237 fi |
238 done | 238 done |
239 | 239 |
240 echo "Output stored to ${FLAGS_output_file}" | 240 echo "Output stored to ${FLAGS_output_file}" |
241 } | 241 } |
242 | 242 |
243 main $@ | 243 main $@ |
OLD | NEW |