aboutsummaryrefslogtreecommitdiff
path: root/aosp-bt-stress-test.sh
blob: 2a3963a6eb2137554a7b250e5a793c028a736034 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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