summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Pigott <dave.pigott@linaro.org>2014-03-07 11:35:40 +0800
committerDave Pigott <dave.pigott@linaro.org>2014-03-07 11:35:40 +0800
commitee60aca08c12680e17009e23017716c0136f17dd (patch)
treed606343d5e54c1f802a6f2ebcc54a4f94d313b40
parent870154d02aa476c88ae62ec5ea05fb5063717675 (diff)
downloadtcwg-cbuild2-ee60aca08c12680e17009e23017716c0136f17dd.tar.gz
Add hacking session
-rw-r--r--cbuild2.yaml9
-rwxr-xr-xinvoke_session_debian42
-rwxr-xr-xsetup_session_debian10
-rwxr-xr-xstop_hacking_debian4
4 files changed, 64 insertions, 1 deletions
diff --git a/cbuild2.yaml b/cbuild2.yaml
index 97ffa83..be6ff1d 100644
--- a/cbuild2.yaml
+++ b/cbuild2.yaml
@@ -3,7 +3,11 @@ metadata:
format: "Lava-Test-Shell Test Definition 1.0"
description: "Perform a tcwg build"
-install:
+params:
+ PUB_KEY: None
+ GATEWAY: 10.0.0.1
+
+dinstall:
deps:
- gcc
- texinfo
@@ -25,6 +29,7 @@ install:
- g++-multilib
- libncurses5-dev
- lsb
+ - wget
git-repos:
- http://git.linaro.org/toolchain/cbuild2.git
@@ -34,5 +39,7 @@ run:
- cp /usr/share/doc/git/contrib/workdir/git-new-workdir /usr/local/bin
- chmod a+x /usr/local/bin/git-new-workdir
- lava-test-case cb-configure --shell ./configure || true
+ - ./setup_session_debian "$PUB_KEY"
+ - ./invoke_session_debian "$GATEWAY"
- lava-test-case cbuild2 --shell ./cbuild2.sh --build all
diff --git a/invoke_session_debian b/invoke_session_debian
new file mode 100755
index 0000000..d6f2a01
--- /dev/null
+++ b/invoke_session_debian
@@ -0,0 +1,42 @@
+#!/bin/bash
+# Usage ./invoke_session <gateway>
+
+gateway=$1
+
+if ! grep 'invoke_session' /etc/rc.local
+then
+ sed -i '/bin/a invoke_session &' /etc/rc.local
+fi
+
+# Obtain target IP and Hostname
+ip_addr=$(ifconfig `ip route get $gateway | cut -d ' ' -f3` | grep 'inet addr' |awk -F: '{split($2,a," "); print a[1] }')
+hostname=$(cat /etc/hostname)
+
+# Set the PATH to use the LAVA api
+echo "export PATH=/lava/bin/:$PATH" > ~/.bashrc
+
+echo ""
+echo ""
+echo "*******************************************************************************************************"
+echo -n "Please connect to: "
+echo -n "ssh "
+echo -n "-o StrictHostKeyChecking=no "
+echo -n "root@"
+echo -n $ip_addr
+echo -n " "
+echo -n "("
+echo -n $hostname
+echo ")"
+echo "*******************************************************************************************************"
+echo ""
+echo ""
+mkdir -p /run
+mkdir -p /run/hacking
+echo $$ > /run/hacking/hacking.pid
+echo "Hacking session active..."
+while [ -f /run/hacking/hacking.pid ]
+do
+ sleep 10
+done
+echo "Hacking session ended..."
+echo "<LAVA_TEST_RUNNER>: exiting"
diff --git a/setup_session_debian b/setup_session_debian
new file mode 100755
index 0000000..48a9d9c
--- /dev/null
+++ b/setup_session_debian
@@ -0,0 +1,10 @@
+#!/bin/bash
+# Usage ./setup_session <pub_key>
+
+chmod a+x stop_hacking_debian
+cp stop_hacking_debian /bin/stop_hacking
+chmod a+x invoke_session_debian
+cp invoke_session_debian /bin/invoke_session
+
+mkdir -p ~/.ssh/
+echo $1 >> ~/.ssh/authorized_keys
diff --git a/stop_hacking_debian b/stop_hacking_debian
new file mode 100755
index 0000000..4d2d280
--- /dev/null
+++ b/stop_hacking_debian
@@ -0,0 +1,4 @@
+#!/bin/bash
+rm /run/hacking/hacking.pid
+rm ~/.ssh/authorized_keys
+pkill -f sshd