Skip to content

Commit 240749c

Browse files
Thalleykartben
authored andcommitted
tests: Bluetooth: CAP: Add bcast reception with multiple acceptors
Expand the CAP broadcast reception test to also run with multiple acceptors to better verify correctness in the procedures. For this to run more stable, the maximum number of streams has been reduce to 2, rather than CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT. Signed-off-by: Emil Gydesen <[email protected]>
1 parent e96bf44 commit 240749c

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

tests/bsim/bluetooth/audio/src/cap_commander_test.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023 Nordic Semiconductor ASA
2+
* Copyright (c) 2023-2025 Nordic Semiconductor ASA
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -771,12 +771,6 @@ static void discover_bass(size_t acceptor_cnt)
771771
{
772772
k_sem_reset(&sem_bass_discovered);
773773

774-
if (acceptor_cnt > 1) {
775-
FAIL("Current implementation does not support multiple connections for the "
776-
"broadcast assistant");
777-
return;
778-
}
779-
780774
for (size_t i = 0U; i < acceptor_cnt; i++) {
781775
int err;
782776

@@ -1215,15 +1209,21 @@ static void test_main_cap_commander_broadcast_reception(void)
12151209

12161210
test_distribute_broadcast_code(acceptor_count);
12171211

1218-
backchannel_sync_wait_any(); /* wait for the acceptor to receive data */
1212+
for (size_t i = 0U; i < acceptor_count; i++) {
1213+
backchannel_sync_wait_any(); /* wait for the acceptor to receive data */
1214+
}
12191215

12201216
test_broadcast_reception_stop(acceptor_count);
12211217

1222-
backchannel_sync_wait_any(); /* wait for the acceptor to stop reception */
1218+
for (size_t i = 0U; i < acceptor_count; i++) {
1219+
backchannel_sync_wait_any(); /* wait for the acceptor to stop reception */
1220+
}
12231221

12241222
/* Disconnect all CAP acceptors */
12251223
disconnect_acl(acceptor_count);
12261224

1225+
backchannel_sync_send_all(); /* let others know we have received what we wanted */
1226+
12271227
PASS("Broadcast reception passed\n");
12281228
}
12291229

tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
#if defined(CONFIG_BT_CAP_INITIATOR) && defined(CONFIG_BT_BAP_BROADCAST_SOURCE)
3838
CREATE_FLAG(flag_source_started);
3939

40-
#define BROADCAST_STREMT_CNT CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT
4140
#define CAP_AC_MAX_STREAM 2
4241
#define LOCATION (BT_AUDIO_LOCATION_FRONT_LEFT | BT_AUDIO_LOCATION_FRONT_RIGHT)
4342
#define CONTEXT (BT_AUDIO_CONTEXT_TYPE_MEDIA)
43+
#define BROADCAST_STREMT_CNT MIN(CAP_AC_MAX_STREAM, CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT)
4444

4545
struct cap_initiator_ac_param {
4646
char *name;
@@ -673,7 +673,8 @@ static void test_main_cap_initiator_broadcast(void)
673673
WAIT_FOR_FLAG(flag_source_started);
674674

675675
/* Wait for other devices to have received the data they wanted */
676-
backchannel_sync_wait_any();
676+
printk("Waiting for broadcast stop signal");
677+
backchannel_sync_wait_all();
677678

678679
test_broadcast_audio_tx_sync();
679680

tests/bsim/bluetooth/audio/test_scripts/cap_broadcast_reception.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
SIMULATION_ID="cap_broadcast_reception"
88
VERBOSITY_LEVEL=2
9-
NR_OF_DEVICES=3
9+
NR_OF_DEVICES=4
1010
EXECUTE_TIMEOUT=180
1111

1212
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
@@ -20,13 +20,17 @@ Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_audio_prj_conf \
2020
-RealEncryption=1 -rs=46 -D=${NR_OF_DEVICES}
2121

2222
Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_audio_prj_conf \
23-
-v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=1 -testid=broadcast_source \
23+
-v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=1 -testid=cap_initiator_broadcast \
2424
-RealEncryption=1 -rs=23 -D=${NR_OF_DEVICES}
2525

2626
Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_audio_prj_conf \
2727
-v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=2 -testid=cap_acceptor_broadcast_reception \
2828
-RealEncryption=1 -rs=69 -D=${NR_OF_DEVICES} -start_offset=7e3
2929

30+
Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_audio_prj_conf \
31+
-v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=3 -testid=cap_acceptor_broadcast_reception \
32+
-RealEncryption=1 -rs=87 -D=${NR_OF_DEVICES} -start_offset=7e3
33+
3034
# Simulation time should be larger than the WAIT_TIME in common.h
3135
Execute ./bs_2G4_phy_v1 -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} \
3236
-D=${NR_OF_DEVICES} -sim_length=60e6 $@

0 commit comments

Comments
 (0)