summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Quattlebaum <rquattle@google.com>2017-07-17 19:34:39 -0700
committerRobert Quattlebaum <rquattle@google.com>2017-07-25 14:09:04 -0700
commit58d298af70cb586b005bcbcaf5a4bd6ea4439852 (patch)
treef8740270970c5c43172fd68a2b7583cab35e509a
parente6a1be5f36c91c12ba89bca99233bdb9d7b448e0 (diff)
downloadlowpan-58d298af70cb586b005bcbcaf5a4bd6ea4439852.tar.gz
Test script updates
Change-Id: I2aee676ddc53be87b83e92ebdeb22033b614c766
-rwxr-xr-xtests/commandtest.sh23
-rwxr-xr-xtests/jointest.sh57
-rwxr-xr-xtests/prepdevice.sh3
-rwxr-xr-xtests/scantest.sh44
4 files changed, 115 insertions, 12 deletions
diff --git a/tests/commandtest.sh b/tests/commandtest.sh
index fb0fa0e..89ac951 100755
--- a/tests/commandtest.sh
+++ b/tests/commandtest.sh
@@ -14,32 +14,35 @@ if [ -z $ANDROID_BUILD_TOP ]; then
exit 1
fi
-./prepdevice.sh || die "Unable to prepare device"
+adb wait-for-device || die
+echo "Running form command test. . ."
sleep 2
-echo "Running tests. . ."
-
-set -x # print commands
-
+# Clobber any existing instance of wpantund
adb shell killall wpantund 2> /dev/null
+# Start wpantund
+echo "+ adb shell wpantund -s 'system:ot-ncp\ 1' -o Config:Daemon:ExternalNetifManagement 1 &"
adb shell wpantund -s 'system:ot-ncp\ 1' -o Config:Daemon:ExternalNetifManagement 1 &
WPANTUND_PID=$!
trap "kill -HUP $WPANTUND_PID 2> /dev/null" EXIT INT TERM
+# Verify wpantund started properly
sleep 2
-
kill -0 $WPANTUND_PID || die "wpantund failed to start"
-
sleep 2
+echo "+ adb shell lowpanctl status"
adb shell lowpanctl status || die
+echo "+ adb shell lowpanctl form blahnet"
adb shell lowpanctl form blahnet || die
+echo "+ adb shell lowpanctl status"
adb shell lowpanctl status || die
+echo "+ adb shell ifconfig wpan0"
adb shell ifconfig wpan0 || die
+echo "+ adb shell ip rule"
+adb shell ip rule || die
-set +x # Turn off printing commands
-
-echo Finished.
+echo "Finished form command test."
diff --git a/tests/jointest.sh b/tests/jointest.sh
new file mode 100755
index 0000000..a99bb67
--- /dev/null
+++ b/tests/jointest.sh
@@ -0,0 +1,57 @@
+#!/usr/bin/env bash
+
+cd "`dirname $0`"
+
+die () {
+ set +x # Turn off printing commands
+ echo ""
+ echo " *** fatal error: $*"
+ exit 1
+}
+
+if [ -z $ANDROID_BUILD_TOP ]; then
+ echo "You need to source and lunch before you can use this script"
+ exit 1
+fi
+
+adb wait-for-device || die
+
+echo "Running join command test. . ."
+sleep 2
+
+adb shell killall wpantund 2> /dev/null
+
+adb shell wpantund -I wpan0 -s 'system:ot-ncp\ 1' -o Config:Daemon:ExternalNetifManagement 1 &
+WPANTUND_1_PID=$!
+adb shell wpantund -I wpan1 -s 'system:ot-ncp\ 2' -o Config:Daemon:ExternalNetifManagement 1 &
+WPANTUND_2_PID=$!
+trap "kill -HUP $WPANTUND_1_PID $WPANTUND_2_PID 2> /dev/null" EXIT INT TERM
+
+sleep 2
+
+kill -0 $WPANTUND_1_PID || die "wpantund failed to start"
+kill -0 $WPANTUND_2_PID || die "wpantund failed to start"
+
+sleep 2
+
+echo "+ adb shell lowpanctl -I wpan0 status"
+adb shell lowpanctl -I wpan0 status || die
+echo "+ adb shell lowpanctl -I wpan0 form blahnet --panid 1234 --xpanid 0011223344556677 --channel 11"
+adb shell lowpanctl -I wpan0 form blahnet --panid 1234 --xpanid 0011223344556677 --channel 11 || die
+echo "+ adb shell lowpanctl -I wpan0 status"
+adb shell lowpanctl -I wpan0 status || die
+echo "+ adb shell lowpanctl -I wpan0 show-credential"
+adb shell lowpanctl -I wpan0 show-credential || die
+
+CREDENTIAL=`adb shell lowpanctl -I wpan0 show-credential -r` || die
+
+echo "+ adb shell lowpanctl -I wpan1 status"
+adb shell lowpanctl -I wpan1 status || die
+echo "+ adb shell lowpanctl -I wpan1 scan"
+adb shell lowpanctl -I wpan1 scan || die
+echo "+ adb shell lowpanctl -I wpan1 join blahnet --panid 1234 --xpanid 0011223344556677 --channel 11 --master-key ${CREDENTIAL}"
+adb shell lowpanctl -I wpan1 join blahnet --panid 1234 --xpanid 0011223344556677 --channel 11 --master-key ${CREDENTIAL} || die
+echo "+ adb shell lowpanctl -I wpan1 status"
+adb shell lowpanctl -I wpan1 status || die
+
+echo "Finished join command test."
diff --git a/tests/prepdevice.sh b/tests/prepdevice.sh
index 027d64d..b930f40 100755
--- a/tests/prepdevice.sh
+++ b/tests/prepdevice.sh
@@ -28,8 +28,7 @@ adb root || die
adb wait-for-device || die
adb remount || die
adb shell stop || die
-adb disable-verity
-adb sync || die
+adb sync system || die
adb shell start || die
sleep 2
diff --git a/tests/scantest.sh b/tests/scantest.sh
new file mode 100755
index 0000000..4945f2b
--- /dev/null
+++ b/tests/scantest.sh
@@ -0,0 +1,44 @@
+#!/usr/bin/env bash
+
+cd "`dirname $0`"
+
+die () {
+ set +x # Turn off printing commands
+ echo ""
+ echo " *** fatal error: $*"
+ exit 1
+}
+
+if [ -z $ANDROID_BUILD_TOP ]; then
+ echo "You need to source and lunch before you can use this script"
+ exit 1
+fi
+
+adb wait-for-device || die
+
+echo "Running scan command test. . ."
+sleep 2
+
+adb shell killall wpantund 2> /dev/null
+
+echo "+ adb shell wpantund -I wpan0 -s 'system:ot-ncp\ 1' -o Config:Daemon:ExternalNetifManagement 1 &"
+adb shell wpantund -I wpan0 -s 'system:ot-ncp\ 1' -o Config:Daemon:ExternalNetifManagement 1 &
+WPANTUND_1_PID=$!
+echo "+ adb shell wpantund -I wpan1 -s 'system:ot-ncp\ 2' -o Config:Daemon:ExternalNetifManagement 1 &"
+adb shell wpantund -I wpan1 -s 'system:ot-ncp\ 2' -o Config:Daemon:ExternalNetifManagement 1 &
+WPANTUND_2_PID=$!
+trap "kill -HUP $WPANTUND_1_PID $WPANTUND_2_PID 2> /dev/null" EXIT INT TERM
+
+sleep 2
+kill -0 $WPANTUND_1_PID || die "wpantund failed to start"
+kill -0 $WPANTUND_2_PID || die "wpantund failed to start"
+sleep 2
+
+echo "+ adb shell lowpanctl -I wpan0 form blahnet"
+adb shell lowpanctl -I wpan0 form blahnet || die
+echo "+ adb shell lowpanctl -I wpan0 status"
+adb shell lowpanctl -I wpan0 status || die
+echo "+ adb shell lowpanctl -I wpan1 scan"
+adb shell lowpanctl -I wpan1 scan || die
+
+echo "Finished scan command test."