tests: Bluetooth: Add regression test to l2cap/stress
43de309b3e
made a buffer leak.
It was not detected by this test.
Add another configuration, where the final buffer is sent without
fragments in order to exercise the leaky code path.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
This commit is contained in:
parent
ce3141fe6c
commit
65abd2186c
|
@ -13,6 +13,7 @@ source ${ZEPHYR_BASE}/tests/bsim/compile.source
|
|||
app=tests/bsim/bluetooth/host/l2cap/general compile
|
||||
app=tests/bsim/bluetooth/host/l2cap/userdata compile
|
||||
app=tests/bsim/bluetooth/host/l2cap/stress compile
|
||||
app=tests/bsim/bluetooth/host/l2cap/stress conf_file=prj_nofrag.conf compile
|
||||
app=tests/bsim/bluetooth/host/l2cap/stress conf_file=prj_syswq.conf compile
|
||||
app=tests/bsim/bluetooth/host/l2cap/split/dut compile
|
||||
app=tests/bsim/bluetooth/host/l2cap/split/tester compile
|
||||
|
|
47
tests/bsim/bluetooth/host/l2cap/stress/prj_nofrag.conf
Normal file
47
tests/bsim/bluetooth/host/l2cap/stress/prj_nofrag.conf
Normal file
|
@ -0,0 +1,47 @@
|
|||
CONFIG_BT=y
|
||||
CONFIG_BT_CENTRAL=y
|
||||
CONFIG_BT_PERIPHERAL=y
|
||||
CONFIG_BT_DEVICE_NAME="L2CAP stress test"
|
||||
|
||||
CONFIG_BT_EATT=n
|
||||
CONFIG_BT_L2CAP_ECRED=n
|
||||
|
||||
CONFIG_BT_SMP=y # Next config depends on it
|
||||
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
||||
|
||||
# Disable auto-initiated procedures so they don't
|
||||
# mess with the test's execution.
|
||||
CONFIG_BT_AUTO_PHY_UPDATE=n
|
||||
CONFIG_BT_AUTO_DATA_LEN_UPDATE=n
|
||||
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
|
||||
|
||||
# L2CAP MPS
|
||||
# 23+27+27=77 makes exactly three full packets
|
||||
CONFIG_BT_L2CAP_TX_MTU=77
|
||||
|
||||
# Send L2CAP PDUs without any fragmentation.
|
||||
CONFIG_BT_BUF_ACL_TX_SIZE=81
|
||||
|
||||
CONFIG_BT_BUF_ACL_TX_COUNT=4
|
||||
|
||||
# The minimum value for this is
|
||||
# L2AP MPS + L2CAP header (4)
|
||||
CONFIG_BT_BUF_ACL_RX_SIZE=81
|
||||
|
||||
CONFIG_BT_L2CAP_TX_BUF_COUNT=100
|
||||
|
||||
CONFIG_BT_CTLR_DATA_LENGTH_MAX=81
|
||||
CONFIG_BT_CTLR_RX_BUFFERS=10
|
||||
|
||||
CONFIG_BT_MAX_CONN=10
|
||||
|
||||
CONFIG_LOG=y
|
||||
CONFIG_ASSERT=y
|
||||
CONFIG_NET_BUF_POOL_USAGE=y
|
||||
|
||||
# CONFIG_BT_L2CAP_LOG_LEVEL_DBG=y
|
||||
# CONFIG_BT_CONN_LOG_LEVEL_DBG=y
|
||||
CONFIG_LOG_THREAD_ID_PREFIX=y
|
||||
CONFIG_THREAD_NAME=y
|
||||
|
||||
CONFIG_ARCH_POSIX_TRAP_ON_FATAL=y
|
|
@ -20,7 +20,7 @@ CREATE_FLAG(flag_l2cap_connected);
|
|||
#define L2CAP_CHANS NUM_PERIPHERALS
|
||||
#define SDU_NUM 20
|
||||
#define SDU_LEN 3000
|
||||
#define NUM_SEGMENTS 10
|
||||
#define NUM_SEGMENTS 100
|
||||
#define RESCHEDULE_DELAY K_MSEC(100)
|
||||
|
||||
static void sdu_destroy(struct net_buf *buf)
|
||||
|
@ -479,7 +479,7 @@ static void test_central_main(void)
|
|||
}
|
||||
LOG_DBG("All peripherals disconnected.");
|
||||
|
||||
LOG_DBG("Max segment pool usage: %u bufs", max_seg_allocated);
|
||||
LOG_INF("Max segment pool usage: %u bufs", max_seg_allocated);
|
||||
|
||||
PASS("L2CAP STRESS Central passed\n");
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ INCR_BUILD=1
|
|||
source ${ZEPHYR_BASE}/tests/bsim/compile.source
|
||||
|
||||
app="$(guess_test_relpath)" compile
|
||||
app="$(guess_test_relpath)" conf_file=prj_nofrag.conf compile
|
||||
app="$(guess_test_relpath)" conf_file=prj_syswq.conf compile
|
||||
|
||||
wait_for_background_jobs
|
||||
|
|
27
tests/bsim/bluetooth/host/l2cap/stress/tests_scripts/l2cap_nofrag.sh
Executable file
27
tests/bsim/bluetooth/host/l2cap/stress/tests_scripts/l2cap_nofrag.sh
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
# Copyright (c) 2022 Nordic Semiconductor
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
||||
|
||||
# EATT test
|
||||
simulation_id="l2cap_stress_nofrag"
|
||||
verbosity_level=2
|
||||
EXECUTE_TIMEOUT=240
|
||||
|
||||
bsim_exe=./bs_${BOARD_TS}_tests_bsim_bluetooth_host_l2cap_stress_prj_nofrag_conf
|
||||
|
||||
cd ${BSIM_OUT_PATH}/bin
|
||||
|
||||
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central -rs=43
|
||||
|
||||
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral -rs=42
|
||||
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=2 -testid=peripheral -rs=10
|
||||
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=3 -testid=peripheral -rs=23
|
||||
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=4 -testid=peripheral -rs=7884
|
||||
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=5 -testid=peripheral -rs=230
|
||||
Execute "${bsim_exe}" -v=${verbosity_level} -s=${simulation_id} -d=6 -testid=peripheral -rs=9
|
||||
|
||||
Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} -D=7 -sim_length=400e6 $@
|
||||
|
||||
wait_for_background_jobs
|
Loading…
Reference in a new issue