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

Side by Side Diff: run_remote_tests.sh

Issue 5212003: Remove the dependency to autotest_run.sh so I can get rid of it in next CL. (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: patch Created 10 years, 1 month 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 | « autotest_run.sh ('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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 if [[ "${type}" != "client" ]] && [[ "${type}" != "server" ]]; then 57 if [[ "${type}" != "client" ]] && [[ "${type}" != "server" ]]; then
58 die "Unknown type of test (${type}) in ${control_file}" 58 die "Unknown type of test (${type}) in ${control_file}"
59 fi 59 fi
60 echo ${type} 60 echo ${type}
61 } 61 }
62 62
63 function create_tmp() { 63 function create_tmp() {
64 # Set global TMP for remote_access.sh's sake 64 # Set global TMP for remote_access.sh's sake
65 # and if --results_dir_root is specified, 65 # and if --results_dir_root is specified,
66 # set TMP and create dir appropriately 66 # set TMP and create dir appropriately
67 if [[ ${INSIDE_CHROOT} -eq 0 ]]; then 67 if [[ ${INSIDE_CHROOT} -eq ${FLAGS_TRUE} ]]; then
kmixter1 2010/11/18 22:33:38 This if statement is saying if i-am-outside-the-ch
ericli 2010/11/18 23:05:22 my interpretation of this statement is "if I am in
kmixter1 2010/11/18 23:59:39 The variable names may be confusing. TMP_INSIDE_C
68 if [[ -n "${FLAGS_results_dir_root}" ]]; then 68 if [[ -n "${FLAGS_results_dir_root}" ]]; then
69 TMP=${FLAGS_chroot}${FLAGS_results_dir_root} 69 TMP=${FLAGS_chroot}${FLAGS_results_dir_root}
70 mkdir -p -m 777 ${TMP} 70 mkdir -p -m 777 ${TMP}
71 else 71 else
72 TMP=$(mktemp -d ${FLAGS_chroot}/tmp/run_remote_tests.XXXX) 72 TMP=$(mktemp -d ${FLAGS_chroot}/tmp/run_remote_tests.XXXX)
73 fi 73 fi
74 TMP_INSIDE_CHROOT=$(echo ${TMP#${FLAGS_chroot}}) 74 TMP_INSIDE_CHROOT=$(echo ${TMP#${FLAGS_chroot}})
75 else 75 else
76 if [[ -n "${FLAGS_results_dir_root}" ]]; then 76 if [[ -n "${FLAGS_results_dir_root}" ]]; then
77 TMP=${FLAGS_results_dir_root} 77 TMP=${FLAGS_results_dir_root}
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 # testName/some_control --> testName.some_control 248 # testName/some_control --> testName.some_control
249 if [[ "${control_file_name}" != control ]]; then 249 if [[ "${control_file_name}" != control ]]; then
250 if [[ "${control_file_name}" == control.* ]]; then 250 if [[ "${control_file_name}" == control.* ]]; then
251 short_name=${short_name}.${control_file_name/control./} 251 short_name=${short_name}.${control_file_name/control./}
252 else 252 else
253 short_name=${short_name}.${control_file_name} 253 short_name=${short_name}.${control_file_name}
254 fi 254 fi
255 fi 255 fi
256 256
257 local results_dir_name="${short_name}" 257 local results_dir_name="${short_name}"
258 local results_dir="${TMP_INSIDE_CHROOT}/${results_dir_name}" 258 local results_dir
259 rm -rf "${results_dir}" 259 if [[ ${FLAGS_build} -eq ${FLAGS_TRUE} ]]; then
260 results_dir="${TMP_INSIDE_CHROOT}/${results_dir_name}"
kmixter1 2010/11/18 22:33:38 I find this more confusing. Why not just keep the
ericli 2010/11/18 23:05:22 Address both of your concerns: I agree. This is mo
kmixter1 2010/11/18 23:59:39 Why not just change the code to run autoserv insid
261 else
262 results_dir="${TMP}/${results_dir_name}"
263 fi
264 sudo rm -rf "${results_dir}"
260 local verbose="" 265 local verbose=""
261 if [[ ${FLAGS_verbose} -eq $FLAGS_TRUE ]]; then 266 if [[ ${FLAGS_verbose} -eq $FLAGS_TRUE ]]; then
262 verbose="--verbose" 267 verbose="--verbose"
263 fi 268 fi
264 269
265 RAN_ANY_TESTS=${FLAGS_TRUE} 270 RAN_ANY_TESTS=${FLAGS_TRUE}
266 271
267 # Remove chrome autotest location prefix from control_file if needed 272 # Remove chrome autotest location prefix from control_file if needed
268 if [[ ${control_file:0:${#chrome_autotests}} == \ 273 if [[ ${control_file:0:${#chrome_autotests}} == \
269 "${chrome_autotests}" ]]; then 274 "${chrome_autotests}" ]]; then
270 control_file="${control_file:${#chrome_autotests}+1}" 275 control_file="${control_file:${#chrome_autotests}+1}"
271 info "Running chrome autotest ${control_file}" 276 info "Running chrome autotest ${control_file}"
272 fi 277 fi
273 278
274 export AUTOSERV_TEST_ARGS="${FLAGS_args}" 279 local autoserv_test_args="${FLAGS_args}"
275 export AUTOSERV_ARGS="-m ${FLAGS_remote} \ 280 if [ -n "${autoserv_test_args}" ]; then
276 --ssh-port ${FLAGS_ssh_port} \ 281 autoserv_test_args="-a \"${autoserv_test_args}\""
282 fi
283 local autoserv_args="-m ${FLAGS_remote} --ssh-port ${FLAGS_ssh_port} \
277 ${option} ${control_file} -r ${results_dir} ${verbose}" 284 ${option} ${control_file} -r ${results_dir} ${verbose}"
278 if [ ${FLAGS_build} -eq ${FLAGS_FALSE} ]; then 285 if [ ${FLAGS_build} -eq ${FLAGS_FALSE} ]; then
279 cat > "${TMP}/run_test.sh" <<EOF 286 pushd ${autotest_dir} >/dev/null
280 export AUTOSERV_TEST_ARGS="${AUTOSERV_TEST_ARGS}" 287 sudo chmod a+w ./server/{tests,site_tests}
281 export AUTOSERV_ARGS="${AUTOSERV_ARGS}" 288 echo ./server/autoserv ${autoserv_args} ${autoserv_test_args}
282 cd /home/${USER}/trunk/src/scripts 289 ./server/autoserv ${autoserv_args} ${autoserv_test_args}
kmixter1 2010/11/18 22:33:38 It seems better to always run autoserv inside the
283 ./autotest_run.sh --board "${FLAGS_board}" 290 popd >/dev/null
284 EOF
285 chmod a+rx "${TMP}/run_test.sh"
286 ${ENTER_CHROOT} ${TMP_INSIDE_CHROOT}/run_test.sh >&2
287 else 291 else
288 cp "${BUILD_DIR}/environment" "${TMP}/run_test.sh" 292 cp "${BUILD_DIR}/environment" "${TMP}/run_test.sh"
289 GRAPHICS_BACKEND=${GRAPHICS_BACKEND:-OPENGL} 293 GRAPHICS_BACKEND=${GRAPHICS_BACKEND:-OPENGL}
290 if [ -n "${AUTOSERV_TEST_ARGS}" ]; then
291 AUTOSERV_TEST_ARGS="-a \"${AUTOSERV_TEST_ARGS}\""
292 fi
293 cat >> "${TMP}/run_test.sh" <<EOF 294 cat >> "${TMP}/run_test.sh" <<EOF
294 export GCLIENT_ROOT=/home/${USER}/trunk 295 export GCLIENT_ROOT=/home/${USER}/trunk
295 export GRAPHICS_BACKEND=${GRAPHICS_BACKEND} 296 export GRAPHICS_BACKEND=${GRAPHICS_BACKEND}
296 export SSH_AUTH_SOCK=${SSH_AUTH_SOCK} TMPDIR=/tmp SSH_AGENT_PID=${SSH_AGENT_PID} 297 export SSH_AUTH_SOCK=${SSH_AUTH_SOCK} TMPDIR=/tmp SSH_AGENT_PID=${SSH_AGENT_PID}
297 export SYSROOT=/build/${FLAGS_board} 298 export SYSROOT=/build/${FLAGS_board}
298 tc-export CC CXX PKG_CONFIG 299 tc-export CC CXX PKG_CONFIG
299 cd ${INSIDE_BUILD_DIR} 300 cd ${INSIDE_BUILD_DIR}
300 ./server/autoserv ${AUTOSERV_ARGS} ${AUTOSERV_TEST_ARGS} 301 echo ./server/autoserv ${autoserv_args} ${autoserv_test_args}
302 ./server/autoserv ${autoserv_args} ${autoserv_test_args}
301 EOF 303 EOF
302 sudo cp "${TMP}/run_test.sh" "${BUILD_DIR}" 304 sudo cp "${TMP}/run_test.sh" "${BUILD_DIR}"
303 sudo chmod a+rx "${BUILD_DIR}/run_test.sh" 305 sudo chmod a+rx "${BUILD_DIR}/run_test.sh"
304 ${ENTER_CHROOT} sudo bash -c "${INSIDE_BUILD_DIR}/run_test.sh" >&2 306 ${ENTER_CHROOT} sudo bash -c "${INSIDE_BUILD_DIR}/run_test.sh" >&2
305 fi 307 fi
306 done 308 done
307 309
308 echo "" 310 echo ""
309 info "Test results:" 311 info "Test results:"
310 ./generate_test_report "${TMP}" --strip="${TMP}/" 312 ./generate_test_report "${TMP}" --strip="${TMP}/"
311 313
312 print_time_elapsed 314 print_time_elapsed
313 } 315 }
314 316
315 main "$@" 317 main "$@"
OLDNEW
« no previous file with comments | « autotest_run.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698