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

Unified Diff: run_remote_tests.sh

Issue 6333001: run_remote_test.sh: explicitly start/stop ssh-agent (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Created 9 years, 11 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: run_remote_tests.sh
diff --git a/run_remote_tests.sh b/run_remote_tests.sh
index 9cb131817297301766619d05a3f71f74b5306d37..b1f71cf3ddf64d9bab1976f69a48c30e53720fff 100755
--- a/run_remote_tests.sh
+++ b/run_remote_tests.sh
@@ -10,10 +10,17 @@
# The path to common.sh should be relative to your script's location.
. "$(dirname $0)/common.sh"
-. "$(dirname $0)/remote_access.sh"
get_default_board
+DEFAULT_PRIVATE_KEY="${GCLIENT_ROOT}/src/scripts/mod_for_test_scripts/\
+ssh_keys/testing_rsa"
+
+DEFINE_string remote "" "remote hostname/IP of running Chromium OS instance"
petkov 2011/01/13 22:54:45 sort flags
+DEFINE_string private_key "$DEFAULT_PRIVATE_KEY" \
+ "Private key of root account on remote host"
+DEFINE_integer ssh_port 22 \
+ "SSH port of the remote machine running Chromium OS instance"
DEFINE_string args "" \
"Command line arguments for test. Quoted and space separated if multiple." a
DEFINE_string board "$DEFAULT_BOARD" \
@@ -29,6 +36,45 @@ DEFINE_boolean use_emerged ${FLAGS_FALSE} \
RAN_ANY_TESTS=${FLAGS_FALSE}
+# Ask the target what board it is
+function learn_board() {
petkov 2011/01/13 22:54:45 any reason why you're not using the same routine f
+ [ -n "${FLAGS_board}" ] && return
+ FLAGS_board=$(ssh -o StrictHostKeyChecking=no root@${FLAGS_remote} \
+ -o UserKnownHostsFile=/dev/null \
+ cat /etc/lsb-release | \
+ grep CHROMEOS_RELEASE_BOARD | \
+ cut -d '=' -f 2)
+ if [ -z "${FLAGS_board}" ]; then
+ error "Board required"
petkov 2011/01/13 22:54:45 this should just use "die"
+ exit 1
+ fi
+ info "Target reports board is ${FLAGS_board}"
+}
+
+function cleanup_remote_access() {
+ # Call this function from the exit trap of the main script.
+ # Iff we started ssh-agent, be nice and clean it up.
+ # Note, only works if called from the main script - no subshells.
+ if [[ 1 -eq ${OWN_SSH_AGENT} ]]
+ then
+ kill ${SSH_AGENT_PID} 2>/dev/null
+ unset SSH_AGENT_PID SSH_AUTH_SOCK
+ fi
+}
+
+function remote_access_init() {
petkov 2011/01/13 22:54:45 rename to something that makes it clear this is sp
+ local tmp_private_key=$TMP/private_key
+ if [ -z "$SSH_AGENT_PID" ]; then
+ eval $(ssh-agent)
+ OWN_SSH_AGENT=1
+ else
+ OWN_SSH_AGENT=0
+ fi
+ cp $FLAGS_private_key $tmp_private_key
+ chmod 0400 $tmp_private_key
+ ssh-add $tmp_private_key
+}
+
function cleanup() {
# Always remove the build path in case it was used.
[[ -n "${BUILD_DIR}" ]] && sudo rm -rf "${BUILD_DIR}"
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698