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. |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 156 |
157 local autotest_dir="" | 157 local autotest_dir="" |
158 if [[ -z "${FLAGS_prepackaged_autotest}" ]]; then | 158 if [[ -z "${FLAGS_prepackaged_autotest}" ]]; then |
159 learn_board | 159 learn_board |
160 autotest_dir="${GCLIENT_ROOT}/src/third_party/autotest/files" | 160 autotest_dir="${GCLIENT_ROOT}/src/third_party/autotest/files" |
161 else | 161 else |
162 autotest_dir="${FLAGS_prepackaged_autotest}" | 162 autotest_dir="${FLAGS_prepackaged_autotest}" |
163 fi | 163 fi |
164 | 164 |
165 local control_files_to_run="" | 165 local control_files_to_run="" |
166 | 166 local chrome_autotests="${CHROME_ROOT}/src/chrome/test/chromeos/autotest/files
" |
167 # Now search for tests which unambiguously include the given identifier | 167 # Now search for tests which unambiguously include the given identifier |
168 local search_path=$(echo {client,server}/{tests,site_tests}) | 168 local search_path=$(echo {client,server}/{tests,site_tests}) |
| 169 # Include chrome autotest in the search path |
| 170 if [ -n "${CHROME_ROOT}" ]; then |
| 171 search_path="${search_path} ${chrome_autotests}/client/site_tests" |
| 172 fi |
169 pushd ${autotest_dir} > /dev/null | 173 pushd ${autotest_dir} > /dev/null |
170 for test_request in $FLAGS_ARGV; do | 174 for test_request in $FLAGS_ARGV; do |
171 test_request=$(remove_quotes "${test_request}") | 175 test_request=$(remove_quotes "${test_request}") |
172 ! finds=$(find ${search_path} -maxdepth 2 -type f \( -name control.\* -or \ | 176 ! finds=$(find ${search_path} -maxdepth 2 -type f \( -name control.\* -or \ |
173 -name control \) | egrep -v "~$" | egrep "${test_request}") | 177 -name control \) | egrep -v "~$" | egrep "${test_request}") |
174 if [[ -z "${finds}" ]]; then | 178 if [[ -z "${finds}" ]]; then |
175 echo_color "red" ">>> Cannot find match for \"${test_request}\"" | 179 echo_color "red" ">>> Cannot find match for \"${test_request}\"" |
176 exit 1 | 180 exit 1 |
177 fi | 181 fi |
178 local matches=$(echo "${finds}" | wc -l) | 182 local matches=$(echo "${finds}" | wc -l) |
(...skipping 24 matching lines...) Expand all Loading... |
203 | 207 |
204 echo_color "yellow" ">>> Running the following control files:" | 208 echo_color "yellow" ">>> Running the following control files:" |
205 for CONTROL_FILE in ${control_files_to_run}; do | 209 for CONTROL_FILE in ${control_files_to_run}; do |
206 echo_color "yellow" " * " "${CONTROL_FILE}" | 210 echo_color "yellow" " * " "${CONTROL_FILE}" |
207 done | 211 done |
208 | 212 |
209 for control_file in ${control_files_to_run}; do | 213 for control_file in ${control_files_to_run}; do |
210 # Assume a line starts with TEST_TYPE = | 214 # Assume a line starts with TEST_TYPE = |
211 control_file=$(remove_quotes "${control_file}") | 215 control_file=$(remove_quotes "${control_file}") |
212 local type=$(read_test_type "${autotest_dir}/${control_file}") | 216 local type=$(read_test_type "${autotest_dir}/${control_file}") |
| 217 # Check if the control file is an absolute path (i.e. chrome autotests case) |
| 218 if [[ ${control_file:0:1} == "/" ]]; then |
| 219 type=$(read_test_type "${control_file}") |
| 220 fi |
213 local option | 221 local option |
214 if [[ "${type}" == "client" ]]; then | 222 if [[ "${type}" == "client" ]]; then |
215 option="-c" | 223 option="-c" |
216 else | 224 else |
217 option="-s" | 225 option="-s" |
218 fi | 226 fi |
219 echo "" | 227 echo "" |
220 echo_color "yellow" ">>> Running ${type} test " ${control_file} | 228 echo_color "yellow" ">>> Running ${type} test " ${control_file} |
221 local short_name=$(basename $(dirname "${control_file}")) | 229 local short_name=$(basename $(dirname "${control_file}")) |
222 local results_dir_name="${short_name}" | 230 local results_dir_name="${short_name}" |
(...skipping 15 matching lines...) Expand all Loading... |
238 # HACK: Temporary hack for cros-workon conversion | 246 # HACK: Temporary hack for cros-workon conversion |
239 [[ -n "${CROS_WORKON_SRCROOT}" ]] && WORKON_SUFFIX=_workon | 247 [[ -n "${CROS_WORKON_SRCROOT}" ]] && WORKON_SUFFIX=_workon |
240 | 248 |
241 local enter_chroot="" | 249 local enter_chroot="" |
242 local autotest="${GCLIENT_ROOT}/src/scripts/autotest${WORKON_SUFFIX}" | 250 local autotest="${GCLIENT_ROOT}/src/scripts/autotest${WORKON_SUFFIX}" |
243 if [[ ${INSIDE_CHROOT} -eq 0 ]]; then | 251 if [[ ${INSIDE_CHROOT} -eq 0 ]]; then |
244 enter_chroot="./enter_chroot.sh --chroot ${FLAGS_chroot} --" | 252 enter_chroot="./enter_chroot.sh --chroot ${FLAGS_chroot} --" |
245 autotest="./autotest${WORKON_SUFFIX}" | 253 autotest="./autotest${WORKON_SUFFIX}" |
246 fi | 254 fi |
247 | 255 |
| 256 # Remove chrome autotest location prefix from control_file if needed |
| 257 if [[ ${control_file:0:${#chrome_autotests}} == \ |
| 258 "${chrome_autotests}" ]]; then |
| 259 control_file="${control_file:${#chrome_autotests}+1}" |
| 260 echo_color "yellow" ">>> Running chrome autotest " ${control_file} |
| 261 fi |
| 262 |
248 ${enter_chroot} ${autotest} --board "${FLAGS_board}" -m "${FLAGS_remote}" \ | 263 ${enter_chroot} ${autotest} --board "${FLAGS_board}" -m "${FLAGS_remote}" \ |
249 --ssh-port ${FLAGS_ssh_port} \ | 264 --ssh-port ${FLAGS_ssh_port} \ |
250 "${option}" "${control_file}" -r "${results_dir}" ${verbose} \ | 265 "${option}" "${control_file}" -r "${results_dir}" ${verbose} \ |
251 "${args[@]}" | 266 "${args[@]}" |
252 done | 267 done |
253 | 268 |
254 echo "" | 269 echo "" |
255 echo_color "yellow" ">>> Test results:" | 270 echo_color "yellow" ">>> Test results:" |
256 ./generate_test_report "${TMP}" --strip="${TMP}/" | 271 ./generate_test_report "${TMP}" --strip="${TMP}/" |
257 } | 272 } |
258 | 273 |
259 main $@ | 274 main $@ |
OLD | NEW |