diff options
-rwxr-xr-x | tests/commandtest.sh | 45 | ||||
-rwxr-xr-x | tests/prepdevice.sh | 38 |
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. + |