From 637b55326b6ce55fe8567c74629242d3c9d4fea7 Mon Sep 17 00:00:00 2001 From: Chris Sosa Date: Mon, 24 Jan 2011 14:48:02 -0800 Subject: [PATCH] Passes cache location to tests and runs the tests in parallel. As a warning, this is a pretty big change. At a high-level, this changes the harness to move the managing of the devserver from image_to_live into the actual test harness. Paths of the cache locations (for archive_url) are taken when pre-generating the updates and stored in a dictionary (maps "path_to_base->path_to_target" (or path for full updates)-> cache paths). This change also has the tests run in parallel. Because we now start X number of VM's at once, each VM needs it's own pid file and ssh_port. This logic was added as well as running the actual tests in parallel. Change-Id: I1275d79740c50c2a8028489b43dcbbcf5bbd56c4 BUG=chromium-os:10723 TEST=Ran it ... a lot with -q but without a test_prefix (so full test suite). Review URL: http://codereview.chromium.org/6277015 --- remote_access.sh | 47 +++++++++++------------------------------------ 1 file changed, 11 insertions(+), 36 deletions(-) diff --git a/remote_access.sh b/remote_access.sh index 222fdf7e94..70d6058b02 100644 --- a/remote_access.sh +++ b/remote_access.sh @@ -16,7 +16,8 @@ DEFINE_integer ssh_port 22 \ # Copies $1 to $2 on remote host function remote_cp_to() { REMOTE_OUT=$(scp -P ${FLAGS_ssh_port} -o StrictHostKeyChecking=no \ - -o UserKnownHostsFile=$TMP_KNOWN_HOSTS -i $TMP_PRIVATE_KEY $1 \ + -o ServerAliveInterval=60 -o UserKnownHostsFile=$TMP_KNOWN_HOSTS \ + -i $TMP_PRIVATE_KEY $1 \ root@$FLAGS_remote:$2) return ${PIPESTATUS[0]} } @@ -25,13 +26,15 @@ function remote_cp_to() { # $2. Directory paths in $1 are collapsed into $2. function remote_rsync_from() { rsync -e "ssh -p ${FLAGS_ssh_port} -o StrictHostKeyChecking=no \ - -o UserKnownHostsFile=$TMP_KNOWN_HOSTS -i $TMP_PRIVATE_KEY" \ + -o ServerAliveInterval=60 -o UserKnownHostsFile=$TMP_KNOWN_HOSTS \ + -i $TMP_PRIVATE_KEY" \ --no-R --files-from=$1 root@${FLAGS_remote}:/ $2 } function remote_sh() { REMOTE_OUT=$(ssh -p ${FLAGS_ssh_port} -o StrictHostKeyChecking=no \ -o UserKnownHostsFile=$TMP_KNOWN_HOSTS -i $TMP_PRIVATE_KEY \ + -o ServerAliveInterval=60 \ root@$FLAGS_remote "$@") return ${PIPESTATUS[0]} } @@ -63,29 +66,12 @@ function learn_board() { info "Target reports board is ${FLAGS_board}" } -# Checks to see if pid $1 is running. -function is_pid_running() { - ps -p ${1} 2>&1 > /dev/null -} +function remote_reboot { + info "Rebooting." + remote_sh "touch /tmp/awaiting_reboot; reboot" + local output_file + output_file="${TMP}/output" -# Wait function given an additional timeout argument. -# $1 - pid to wait on. -# $2 - timeout to wait for. -function wait_with_timeout() { - local pid=$1 - local timeout=$2 - local -r TIMEOUT_INC=1 - local current_timeout=0 - while is_pid_running ${pid} && [ ${current_timeout} -lt ${timeout} ]; do - sleep ${TIMEOUT_INC} - current_timeout=$((current_timeout + TIMEOUT_INC)) - done - ! is_pid_running ${pid} -} - -# Checks to see if a machine has rebooted using the presence of a tmp file. -function check_if_rebooted() { - local output_file="${TMP}/output" while true; do REMOTE_OUT="" # This may fail while the machine is down so generate output and a @@ -96,23 +82,12 @@ function check_if_rebooted() { if grep -q "0" "${output_file}"; then if grep -q "1" "${output_file}"; then info "Not yet rebooted" - sleep .5 else info "Rebooted and responding" break fi fi - done -} - -function remote_reboot() { - info "Rebooting." - remote_sh "touch /tmp/awaiting_reboot; reboot" - while true; do - check_if_rebooted & - local pid=$! - wait_with_timeout ${pid} 30 && break - ! kill -9 ${pid} 2> /dev/null + sleep .5 done }