aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVishal Bhoj <vishal.bhoj@linaro.org>2016-07-20 16:09:13 +0530
committerVishal Bhoj <vishal.bhoj@linaro.org>2016-07-21 16:23:45 +0530
commita7bfe7cf9dcb763afcfb390218bea73c6b8f02f0 (patch)
tree819310596ac5f32a36ae8fdbd97a17ca2f06d36d
parentee4aea45fa9f32ff4d49a0ea724f3df3cac3585e (diff)
downloadart-build-scripts-a7bfe7cf9dcb763afcfb390218bea73c6b8f02f0.tar.gz
jenkins: Add setup adb script
Change-Id: I6eb0a9d663c4cf1ab217648847cd2ac60a92b069 Signed-off-by: Vishal Bhoj <vishal.bhoj@linaro.org>
-rw-r--r--jenkins/setup_adb.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/jenkins/setup_adb.sh b/jenkins/setup_adb.sh
new file mode 100644
index 00000000..0dafc731
--- /dev/null
+++ b/jenkins/setup_adb.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# Setup ssh connection with port forwarding for adb client on jenkins slave
+# to connect to adb server on lab machine which has nexus devices connected.
+#
+# The script expects ANDROID_ADB_SERVER_PORT and ADB_VERSION set depending on
+# the build (i.e Tip vs Stable). We have 2 version of adb servers stored on the
+# lab machine and the right version of adb needs to be started or else the server
+# will get killed if there is a mismatch between client and server.
+#
+# nexus-config file has the following information
+# FLOUNDER (serial_id)
+# BULLHEAD (serial_id)
+# REMOTE_PORT (port number to which we need to ssh into)
+# SERVER_IPADDRESS (Server ip address to connect to)
+
+set -u
+
+ssh-keyscan -p "${REMOTE_PORT}" "${SERVER_IPADDRESS}" > ~/.ssh/known_hosts
+
+# Kill all adb servers on lab machine or else nexus devices won't be visible to new server.
+ssh nexus-machine killall adb-stable adb-tip
+
+# Start the right version of adb server.
+ssh nexus-machine "${ADB_VERSION}" -P "${ANDROID_ADB_SERVER_PORT}" start-server
+
+# Setup port forwarding connection.
+ssh -L "${ANDROID_ADB_SERVER_PORT}:127.0.0.1:${ANDROID_ADB_SERVER_PORT}" nexus-machine -f -N