tests: Bluetooth: Audio: Move role specific mocks files

For the LE Audio unittests there exists a few mock files
that implement mock versions, or callbacks, for some of the
roles and features tested.

These have been moved to where they are actually used,
reducing the scope of these files.

This both allows the individual tests to implement their own
versions of it, but more importantly it prevents issues when
adding tests for these roles. For example, due to the
bap_unicast_client.c mock file, it is impossible to implement
unit tests for the unicast client, as the functions are already
defined.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2024-06-04 16:57:32 +02:00 committed by Fabio Baltieri
commit a94bfe03a4
13 changed files with 77 additions and 4 deletions

View file

@ -17,10 +17,13 @@ add_library(uut STATIC
${ZEPHYR_BASE}/subsys/bluetooth/host/uuid.c
${ZEPHYR_BASE}/subsys/logging/log_minimal.c
${ZEPHYR_BASE}/subsys/net/buf_simple.c
bap_unicast_client.c
bap_unicast_server.c
)
add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/audio/mocks mocks)
target_link_libraries(uut PUBLIC test_interface mocks)
target_include_directories(uut PRIVATE ${ZEPHYR_BASE}/tests/bluetooth/audio/ascs/include)
target_compile_options(uut PRIVATE -std=c11 -include ztest.h)

View file

@ -16,6 +16,7 @@ add_library(uut STATIC
${ZEPHYR_BASE}/subsys/net/buf_simple.c
bap_broadcast_assistant.c
aics.c
cap_commander.c
csip.c
micp.c
vcp.c
@ -25,5 +26,6 @@ add_library(uut STATIC
add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/audio/mocks mocks)
target_link_libraries(uut PUBLIC test_interface mocks)
target_include_directories(uut PRIVATE ${ZEPHYR_BASE}/tests/bluetooth/audio/cap_commander/include)
target_compile_options(uut PRIVATE -std=c11 -include ztest.h)

View file

@ -16,11 +16,14 @@ add_library(uut STATIC
${ZEPHYR_BASE}/subsys/bluetooth/common/bt_str.c
${ZEPHYR_BASE}/subsys/logging/log_minimal.c
${ZEPHYR_BASE}/subsys/net/buf_simple.c
bap_unicast_client.c
cap_initiator.c
csip.c
)
add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/audio/mocks mocks)
target_link_libraries(uut PUBLIC test_interface mocks)
target_include_directories(uut PRIVATE ${ZEPHYR_BASE}/tests/bluetooth/audio/cap_initiator/include)
target_compile_options(uut PRIVATE -std=c11 -include ztest.h)

View file

@ -0,0 +1,69 @@
/*
* Copyright (c) 2023 Codecoup
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/bluetooth/audio/bap.h>
bool bt_bap_ep_is_unicast_client(const struct bt_bap_ep *ep)
{
return false;
}
int bt_bap_unicast_client_config(struct bt_bap_stream *stream,
const struct bt_audio_codec_cfg *codec_cfg)
{
zassert_unreachable("Unexpected call to '%s()' occurred", __func__);
return 0;
}
int bt_bap_unicast_client_qos(struct bt_conn *conn, struct bt_bap_unicast_group *group)
{
zassert_unreachable("Unexpected call to '%s()' occurred", __func__);
return 0;
}
int bt_bap_unicast_client_enable(struct bt_bap_stream *stream, uint8_t meta[],
size_t meta_len)
{
zassert_unreachable("Unexpected call to '%s()' occurred", __func__);
return 0;
}
int bt_bap_unicast_client_metadata(struct bt_bap_stream *stream, uint8_t meta[],
size_t meta_len)
{
zassert_unreachable("Unexpected call to '%s()' occurred", __func__);
return 0;
}
int bt_bap_unicast_client_disable(struct bt_bap_stream *stream)
{
zassert_unreachable("Unexpected call to '%s()' occurred", __func__);
return 0;
}
int bt_bap_unicast_client_connect(struct bt_bap_stream *stream)
{
zassert_unreachable("Unexpected call to '%s()' occurred", __func__);
return 0;
}
int bt_bap_unicast_client_start(struct bt_bap_stream *stream)
{
zassert_unreachable("Unexpected call to '%s()' occurred", __func__);
return 0;
}
int bt_bap_unicast_client_stop(struct bt_bap_stream *stream)
{
zassert_unreachable("Unexpected call to '%s()' occurred", __func__);
return 0;
}
int bt_bap_unicast_client_release(struct bt_bap_stream *stream)
{
zassert_unreachable("Unexpected call to '%s()' occurred", __func__);
return 0;
}

View file

@ -8,10 +8,6 @@
add_library(mocks STATIC
src/bap_stream.c
src/bap_unicast_client.c
src/bap_unicast_server.c
src/cap_commander.c
src/cap_initiator.c
src/conn.c
src/crypto.c
src/fatal.c