tests: Bluetooth: CAP: Only advertise for tests that use connections

Move test_start_adv out from init and only call it for the
tests that require a connection.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2024-12-06 12:40:40 +01:00 committed by Benjamin Cabé
commit 6a03778309

View file

@ -748,8 +748,6 @@ static void init(void)
for (size_t i = 0U; i < ARRAY_SIZE(unicast_streams); i++) { for (size_t i = 0U; i < ARRAY_SIZE(unicast_streams); i++) {
bt_cap_stream_ops_register(&unicast_streams[i], &unicast_stream_ops); bt_cap_stream_ops_register(&unicast_streams[i], &unicast_stream_ops);
} }
test_start_adv();
} }
if (IS_ENABLED(CONFIG_BT_BAP_BROADCAST_SINK)) { if (IS_ENABLED(CONFIG_BT_BAP_BROADCAST_SINK)) {
@ -868,6 +866,8 @@ static void test_cap_acceptor_unicast(void)
{ {
init(); init();
test_start_adv();
auto_start_sink_streams = true; auto_start_sink_streams = true;
/* TODO: wait for audio stream to pass */ /* TODO: wait for audio stream to pass */
@ -881,6 +881,8 @@ static void test_cap_acceptor_unicast_timeout(void)
{ {
init(); init();
test_start_adv();
auto_start_sink_streams = false; /* Cause unicast_audio_start timeout */ auto_start_sink_streams = false; /* Cause unicast_audio_start timeout */
/* TODO: wait for audio stream to pass */ /* TODO: wait for audio stream to pass */
@ -1035,6 +1037,8 @@ static void test_cap_acceptor_broadcast_reception(void)
init(); init();
test_start_adv();
WAIT_FOR_FLAG(flag_pa_request); WAIT_FOR_FLAG(flag_pa_request);
WAIT_FOR_FLAG(flag_bis_sync_requested); WAIT_FOR_FLAG(flag_bis_sync_requested);
@ -1072,6 +1076,8 @@ static void test_cap_acceptor_capture_and_render(void)
{ {
init(); init();
test_start_adv();
WAIT_FOR_FLAG(flag_connected); WAIT_FOR_FLAG(flag_connected);
PASS("CAP acceptor unicast passed\n"); PASS("CAP acceptor unicast passed\n");