summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Quattlebaum <rquattle@google.com>2017-07-07 12:59:05 -0700
committerRobert Quattlebaum <rquattle@google.com>2017-07-07 12:59:39 -0700
commit49de520a96e39d96e2fdc041b2feaddaab8ee1d5 (patch)
treef41035a5556dbb5a5bb36d828cb9367b8cffa610
parent47b51aa3f9cbc57ae18fef3402b06160a6f145a0 (diff)
downloadlowpan-49de520a96e39d96e2fdc041b2feaddaab8ee1d5.tar.gz
Added simple testing scripts
Change-Id: I8859d5b88550db9b5da8d9dc3a297cf1d556e365
-rwxr-xr-xtests/commandtest.sh45
-rwxr-xr-xtests/prepdevice.sh38
2 files changed, 83 insertions, 0 deletions
diff --git a/tests/commandtest.sh b/tests/commandtest.sh
new file mode 100755
index 0000000..fb0fa0e
--- /dev/null
+++ b/tests/commandtest.sh
@@ -0,0 +1,45 @@
+#!/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
+
+./prepdevice.sh || die "Unable to prepare device"
+
+sleep 2
+
+echo "Running tests. . ."
+
+set -x # print commands
+
+adb shell killall wpantund 2> /dev/null
+
+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
+
+sleep 2
+
+kill -0 $WPANTUND_PID || die "wpantund failed to start"
+
+sleep 2
+
+adb shell lowpanctl status || die
+adb shell lowpanctl form blahnet || die
+adb shell lowpanctl status || die
+adb shell ifconfig wpan0 || die
+
+set +x # Turn off printing commands
+
+echo Finished.
+
diff --git a/tests/prepdevice.sh b/tests/prepdevice.sh
new file mode 100755
index 0000000..027d64d
--- /dev/null
+++ b/tests/prepdevice.sh
@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+
+die () {
+ set +x # Turn off printing commands
+ echo "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
+
+echo "Preparing device for LowpanService tests..."
+
+make -j32 -C $ANDROID_BUILD_TOP -f build/core/main.mk \
+ MODULES-IN-frameworks-opt-net-lowpan-service \
+ MODULES-IN-frameworks-opt-net-lowpan-command \
+ MODULES-IN-external-wpantund \
+ MODULES-IN-external-openthread \
+ || die "Build failed"
+
+set -x # print commands
+
+cp ${ANDROID_BUILD_TOP}/frameworks/native/data/etc/android.hardware.lowpan.xml ${ANDROID_PRODUCT_OUT}/system/etc/permissions/android.hardware.lowpan.xml
+
+adb root || die
+adb wait-for-device || die
+adb remount || die
+adb shell stop || die
+adb disable-verity
+adb sync || die
+adb shell start || die
+
+sleep 2
+
+echo Device is ready.
+