aboutsummaryrefslogtreecommitdiff
path: root/aosp-bt-stress-test.sh
diff options
context:
space:
mode:
Diffstat (limited to 'aosp-bt-stress-test.sh')
-rwxr-xr-xaosp-bt-stress-test.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/aosp-bt-stress-test.sh b/aosp-bt-stress-test.sh
new file mode 100755
index 0000000..2a3963a
--- /dev/null
+++ b/aosp-bt-stress-test.sh
@@ -0,0 +1,49 @@
+#!/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