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:
parent
1b6e0f6479
commit
a94bfe03a4
13 changed files with 77 additions and 4 deletions
|
@ -17,10 +17,13 @@ add_library(uut STATIC
|
||||||
${ZEPHYR_BASE}/subsys/bluetooth/host/uuid.c
|
${ZEPHYR_BASE}/subsys/bluetooth/host/uuid.c
|
||||||
${ZEPHYR_BASE}/subsys/logging/log_minimal.c
|
${ZEPHYR_BASE}/subsys/logging/log_minimal.c
|
||||||
${ZEPHYR_BASE}/subsys/net/buf_simple.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)
|
add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/audio/mocks mocks)
|
||||||
|
|
||||||
target_link_libraries(uut PUBLIC test_interface 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)
|
target_compile_options(uut PRIVATE -std=c11 -include ztest.h)
|
||||||
|
|
|
@ -16,6 +16,7 @@ add_library(uut STATIC
|
||||||
${ZEPHYR_BASE}/subsys/net/buf_simple.c
|
${ZEPHYR_BASE}/subsys/net/buf_simple.c
|
||||||
bap_broadcast_assistant.c
|
bap_broadcast_assistant.c
|
||||||
aics.c
|
aics.c
|
||||||
|
cap_commander.c
|
||||||
csip.c
|
csip.c
|
||||||
micp.c
|
micp.c
|
||||||
vcp.c
|
vcp.c
|
||||||
|
@ -25,5 +26,6 @@ add_library(uut STATIC
|
||||||
add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/audio/mocks mocks)
|
add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/audio/mocks mocks)
|
||||||
|
|
||||||
target_link_libraries(uut PUBLIC test_interface 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)
|
target_compile_options(uut PRIVATE -std=c11 -include ztest.h)
|
||||||
|
|
|
@ -16,11 +16,14 @@ add_library(uut STATIC
|
||||||
${ZEPHYR_BASE}/subsys/bluetooth/common/bt_str.c
|
${ZEPHYR_BASE}/subsys/bluetooth/common/bt_str.c
|
||||||
${ZEPHYR_BASE}/subsys/logging/log_minimal.c
|
${ZEPHYR_BASE}/subsys/logging/log_minimal.c
|
||||||
${ZEPHYR_BASE}/subsys/net/buf_simple.c
|
${ZEPHYR_BASE}/subsys/net/buf_simple.c
|
||||||
|
bap_unicast_client.c
|
||||||
|
cap_initiator.c
|
||||||
csip.c
|
csip.c
|
||||||
)
|
)
|
||||||
|
|
||||||
add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/audio/mocks mocks)
|
add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/audio/mocks mocks)
|
||||||
|
|
||||||
target_link_libraries(uut PUBLIC test_interface 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)
|
target_compile_options(uut PRIVATE -std=c11 -include ztest.h)
|
||||||
|
|
69
tests/bluetooth/audio/cap_initiator/uut/bap_unicast_client.c
Normal file
69
tests/bluetooth/audio/cap_initiator/uut/bap_unicast_client.c
Normal 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;
|
||||||
|
}
|
|
@ -8,10 +8,6 @@
|
||||||
|
|
||||||
add_library(mocks STATIC
|
add_library(mocks STATIC
|
||||||
src/bap_stream.c
|
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/conn.c
|
||||||
src/crypto.c
|
src/crypto.c
|
||||||
src/fatal.c
|
src/fatal.c
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue