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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 | 264 |
265 RAN_ANY_TESTS=${FLAGS_TRUE} | 265 RAN_ANY_TESTS=${FLAGS_TRUE} |
266 | 266 |
267 # Remove chrome autotest location prefix from control_file if needed | 267 # Remove chrome autotest location prefix from control_file if needed |
268 if [[ ${control_file:0:${#chrome_autotests}} == \ | 268 if [[ ${control_file:0:${#chrome_autotests}} == \ |
269 "${chrome_autotests}" ]]; then | 269 "${chrome_autotests}" ]]; then |
270 control_file="${control_file:${#chrome_autotests}+1}" | 270 control_file="${control_file:${#chrome_autotests}+1}" |
271 info "Running chrome autotest ${control_file}" | 271 info "Running chrome autotest ${control_file}" |
272 fi | 272 fi |
273 | 273 |
274 local autoserv_test_args="${FLAGS_args}" | 274 export AUTOSERV_TEST_ARGS="${FLAGS_args}" |
275 if [ -n "${autoserv_test_args}" ]; then | 275 export AUTOSERV_ARGS="-m ${FLAGS_remote} \ |
276 autoserv_test_args="-a \"${autoserv_test_args}\"" | 276 --ssh-port ${FLAGS_ssh_port} \ |
277 fi | |
278 local autoserv_args="-m ${FLAGS_remote} --ssh-port ${FLAGS_ssh_port} \ | |
279 ${option} ${control_file} -r ${results_dir} ${verbose}" | 277 ${option} ${control_file} -r ${results_dir} ${verbose}" |
280 if [ ${FLAGS_build} -eq ${FLAGS_FALSE} ]; then | 278 if [ ${FLAGS_build} -eq ${FLAGS_FALSE} ]; then |
281 pushd ${autotest_dir} > /dev/null | 279 cat > "${TMP}/run_test.sh" <<EOF |
282 sudo chmod a+w server/{tests,site_tests} | 280 export AUTOSERV_TEST_ARGS="${AUTOSERV_TEST_ARGS}" |
283 ./server/autoserv ${autoserv_args} ${autoserv_test_args} | 281 export AUTOSERV_ARGS="${AUTOSERV_ARGS}" |
284 popd > /dev/null | 282 cd /home/${USER}/trunk/src/scripts |
| 283 ./autotest_run.sh --board "${FLAGS_board}" |
| 284 EOF |
| 285 chmod a+rx "${TMP}/run_test.sh" |
| 286 ${ENTER_CHROOT} ${TMP_INSIDE_CHROOT}/run_test.sh >&2 |
285 else | 287 else |
286 cp "${BUILD_DIR}/environment" "${TMP}/run_test.sh" | 288 cp "${BUILD_DIR}/environment" "${TMP}/run_test.sh" |
287 GRAPHICS_BACKEND=${GRAPHICS_BACKEND:-OPENGL} | 289 GRAPHICS_BACKEND=${GRAPHICS_BACKEND:-OPENGL} |
| 290 if [ -n "${AUTOSERV_TEST_ARGS}" ]; then |
| 291 AUTOSERV_TEST_ARGS="-a \"${AUTOSERV_TEST_ARGS}\"" |
| 292 fi |
288 cat >> "${TMP}/run_test.sh" <<EOF | 293 cat >> "${TMP}/run_test.sh" <<EOF |
289 export GCLIENT_ROOT=/home/${USER}/trunk | 294 export GCLIENT_ROOT=/home/${USER}/trunk |
290 export GRAPHICS_BACKEND=${GRAPHICS_BACKEND} | 295 export GRAPHICS_BACKEND=${GRAPHICS_BACKEND} |
291 export SSH_AUTH_SOCK=${SSH_AUTH_SOCK} TMPDIR=/tmp SSH_AGENT_PID=${SSH_AGENT_PID} | 296 export SSH_AUTH_SOCK=${SSH_AUTH_SOCK} TMPDIR=/tmp SSH_AGENT_PID=${SSH_AGENT_PID} |
292 export SYSROOT=/build/${FLAGS_board} | 297 export SYSROOT=/build/${FLAGS_board} |
293 tc-export CC CXX PKG_CONFIG | 298 tc-export CC CXX PKG_CONFIG |
294 cd ${INSIDE_BUILD_DIR} | 299 cd ${INSIDE_BUILD_DIR} |
295 ./server/autoserv ${autoserv_args} ${autoserv_test_args} | 300 ./server/autoserv ${AUTOSERV_ARGS} ${AUTOSERV_TEST_ARGS} |
296 EOF | 301 EOF |
297 sudo cp "${TMP}/run_test.sh" "${BUILD_DIR}" | 302 sudo cp "${TMP}/run_test.sh" "${BUILD_DIR}" |
298 sudo chmod a+rx "${BUILD_DIR}/run_test.sh" | 303 sudo chmod a+rx "${BUILD_DIR}/run_test.sh" |
299 ${ENTER_CHROOT} sudo bash -c "${INSIDE_BUILD_DIR}/run_test.sh" >&2 | 304 ${ENTER_CHROOT} sudo bash -c "${INSIDE_BUILD_DIR}/run_test.sh" >&2 |
300 fi | 305 fi |
301 done | 306 done |
302 | 307 |
303 echo "" | 308 echo "" |
304 info "Test results:" | 309 info "Test results:" |
305 ./generate_test_report "${TMP}" --strip="${TMP}/" | 310 ./generate_test_report "${TMP}" --strip="${TMP}/" |
306 | 311 |
307 print_time_elapsed | 312 print_time_elapsed |
308 } | 313 } |
309 | 314 |
310 main "$@" | 315 main "$@" |
OLD | NEW |