#!/bin/sh -x # Client BT device address. remote_device_address=$1 if [ "$(id -u)" != "0" ]; then echo "Please run as root." exit 1 fi # Config test client. echo echo "Setup test client" ./bluez-test-scripts/test-adapter address ./bluez-test-scripts/test-adapter powered on ./bluez-test-scripts/test-adapter pairable on ./bluez-test-scripts/test-adapter pairabletimeout 21600 ./bluez-test-scripts/test-adapter discoverable on ./bluez-test-scripts/test-adapter discoverabletimeout 21600 ./bluez-test-scripts/test-adapter list # Run authentication removed simple-agent. pkill simple-agent ./bluez-test-scripts/simple-agent & simple_agent=$! # Setup test target. echo echo "Setup test target" adb shell logcat -c adb shell logcat > logcat.log & logcat=$! adb shell pm list packages | grep com.android.bluetooth.tests && \ adb uninstall com.android.bluetooth.tests adb install BluetoothTests.apk # Run tests iteration=1000 for test in enable discoverable scan pair do echo echo "Running bluetooth $test test with $iteration iterations" sudo adb shell am instrument \ -e device_address $remote_device_address \ -e ${test}_iterations $iteration \ -w com.android.bluetooth.tests/android.bluetooth.BluetoothTestRunner done kill $simple_agent kill $logcat