Skip to content

Commit

Permalink
tests: Bluetooth: add babblesim connection stress test
Browse files Browse the repository at this point in the history
This is supposed to stress the host buffer and metadata handling.

It is not really testing any particular thing, ie. the pass criteria is
just that each peripheral can send and receive a fixed number of GATT
notifications without any device crashing or locking up.

Original version by Ahmed Moheib (from cloud2ground).

Signed-off-by: Jonathan Rico <[email protected]>
  • Loading branch information
jori-nordic authored and jhedberg committed Dec 12, 2023
1 parent 8e5c3ce commit 2dab5dd
Show file tree
Hide file tree
Showing 8 changed files with 1,472 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/bsim/bluetooth/host/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ app=tests/bsim/bluetooth/host/l2cap/send_on_connect conf_file=prj_ecred.conf com
app=tests/bsim/bluetooth/host/misc/disable compile
app=tests/bsim/bluetooth/host/misc/disconnect/dut compile
app=tests/bsim/bluetooth/host/misc/disconnect/tester compile
app=tests/bsim/bluetooth/host/misc/conn_stress/central compile
app=tests/bsim/bluetooth/host/misc/conn_stress/peripheral compile

app=tests/bsim/bluetooth/host/privacy/central compile
app=tests/bsim/bluetooth/host/privacy/peripheral compile
Expand Down
15 changes: 15 additions & 0 deletions tests/bsim/bluetooth/host/misc/conn_stress/central/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(conn_stress_central)

target_sources(app PRIVATE
src/main.c
)

zephyr_include_directories(
$ENV{BSIM_COMPONENTS_PATH}/libUtilv1/src/
$ENV{BSIM_COMPONENTS_PATH}/libPhyComv1/src/
)
43 changes: 43 additions & 0 deletions tests/bsim/bluetooth/host/misc/conn_stress/central/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
CONFIG_BT=y
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_MAX_CONN=12
CONFIG_BT_MAX_PAIRED=12
CONFIG_BT_SMP=y
CONFIG_BT_PRIVACY=y
CONFIG_BT_GATT_CLIENT=y

CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_BUF_ACL_TX_SIZE=251

CONFIG_BT_L2CAP_TX_MTU=247

# variations of this =n or =y on central/per produce different errors
CONFIG_BT_AUTO_PHY_UPDATE=y
CONFIG_BT_AUTO_DATA_LEN_UPDATE=y

CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_ASSERT_ON_ERRORS=y

# TODO: use default 3
# we get an ATT timeout if 3
# we get an SMP timeout if 10
# CONFIG_BT_L2CAP_TX_BUF_COUNT=10

# deadlock on central with the default.
# the problem is that `tx_free` is called from both syswq and btwq in that case.
CONFIG_BT_RECV_WORKQ_BT=y
# CONFIG_BT_RECV_WORKQ_SYS=y

# errors out getting event flags in hci_core.c
# CONFIG_BT_RECV_BLOCKING=y

# TODO: remove when test is stable
CONFIG_BT_AUTO_PHY_UPDATE=n
CONFIG_BT_AUTO_DATA_LEN_UPDATE=n
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n

CONFIG_THREAD_NAME=y
Loading

0 comments on commit 2dab5dd

Please sign in to comment.