diff --git a/tests/bluetooth/audio/cap_commander/CMakeLists.txt b/tests/bluetooth/audio/cap_commander/CMakeLists.txt index 83efe99251b21..0b8ffd3420872 100644 --- a/tests/bluetooth/audio/cap_commander/CMakeLists.txt +++ b/tests/bluetooth/audio/cap_commander/CMakeLists.txt @@ -2,23 +2,43 @@ cmake_minimum_required(VERSION 3.20.0) -find_package(Zephyr COMPONENTS unittest HINTS $ENV{ZEPHYR_BASE}) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(bluetooth_cap_commander) -add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/audio/cap_commander/uut uut) +target_include_directories(app PRIVATE + ${ZEPHYR_BASE}/subsys/bluetooth/ -target_link_libraries(testbinary PRIVATE uut) + ${ZEPHYR_BASE}/tests/bluetooth/audio/cap_commander/include + ${ZEPHYR_BASE}/tests/bluetooth/audio/mocks/include +) + +target_sources(app PRIVATE + # Test source files + src/main.c + src/test_common.c + src/test_vcp.c + src/test_micp.c + src/test_broadcast_reception.c + src/test_distribute_broadcast_code.c + src/test_cancel.c + + # UUT files + uut/bap_broadcast_assistant.c + uut/aics.c + uut/cap_commander.c + uut/csip.c + uut/micp.c + uut/vcp.c + uut/vocs.c -target_include_directories(testbinary PRIVATE include) + # Stack source file + ${ZEPHYR_BASE}/subsys/bluetooth/audio/audio.c + ${ZEPHYR_BASE}/subsys/bluetooth/audio/cap_commander.c + ${ZEPHYR_BASE}/subsys/bluetooth/audio/cap_common.c + ${ZEPHYR_BASE}/subsys/bluetooth/common/addr.c -target_sources(testbinary - PRIVATE - src/main.c - src/test_common.c - src/test_vcp.c - src/test_micp.c - src/test_broadcast_reception.c - src/test_distribute_broadcast_code.c - src/test_cancel.c + # Mock files + ${ZEPHYR_BASE}/tests/bluetooth/audio/mocks/src/conn.c + ${ZEPHYR_BASE}/tests/bluetooth/audio/mocks/src/gatt.c ) diff --git a/tests/bluetooth/audio/cap_commander/Kconfig b/tests/bluetooth/audio/cap_commander/Kconfig new file mode 100644 index 0000000000000..68209587b1877 --- /dev/null +++ b/tests/bluetooth/audio/cap_commander/Kconfig @@ -0,0 +1,131 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config BT_AICS_CLIENT + bool + default y + +config BT_AICS_CLIENT_MAX_INSTANCE_COUNT + int + default 1 + +config BT_ATT_PREPARE_COUNT + int + default 1 + +config BT_AUDIO + bool + default y + +config BT_BAP_BASS_MAX_SUBGROUPS + int + default 2 + +config BT_BAP_BROADCAST_ASSISTANT + bool + default y + +config BT_BAP_SCAN_DELEGATOR + bool + default y + +config BT_BONDABLE + bool + default y + +config BT_BUF_ACL_RX_SIZE + int + default 69 + +config BT_BUF_ACL_TX_COUNT + int + default 5 + +config BT_BUF_EVT_RX_COUNT + int + default 10 + +config BT_CSIP_SET_COORDINATOR + bool + default y + +config BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES + int + default 1 + +config BT_CONN + bool + default y + +config BT_MAX_PAIRED + int + default 1 + +config BT_MICP_MIC_CTLR + bool + default y + +config BT_MICP_MIC_CTLR_AICS + bool + default y + +config BT_MICP_MIC_CTLR_MAX_AICS_INST + int + default 1 + +config BT_GATT_DYNAMIC_DB + bool + default y + +config BT_ISO_PERIPHERAL + bool + default y + +config BT_ISO_MAX_CHAN + int + default 10 + +config BT_L2CAP_TX_MTU + int + default 65 + +config BT_LOG + bool + default y + +config BT_MAX_CONN + int + default 2 + +config BT_PERIPHERAL + bool + default y + +config BT_VCP_VOL_CTLR + bool + default y + +config BT_VCP_VOL_CTLR_MAX_VOCS_INST + int + default 1 + +config BT_VCP_VOL_CTLR_MAX_AICS_INST + int + default 1 + +config BT_VOCS_CLIENT + bool + default y + +config BT_VOCS_CLIENT_MAX_INSTANCE_COUNT + int + default 1 + +config BT_SMP + bool + default y + +# Include Zephyr's Kconfig. +source "Kconfig" +source "subsys/bluetooth/audio/Kconfig" +source "subsys/bluetooth/Kconfig.logging" diff --git a/tests/bluetooth/audio/cap_commander/prj.conf b/tests/bluetooth/audio/cap_commander/prj.conf index 5e4604dd8abe0..5e04d7093eec5 100644 --- a/tests/bluetooth/audio/cap_commander/prj.conf +++ b/tests/bluetooth/audio/cap_commander/prj.conf @@ -1,33 +1,10 @@ CONFIG_ZTEST=y -CONFIG_BT=y -CONFIG_BT_SMP=y -CONFIG_BT_CENTRAL=y -CONFIG_BT_ISO_SYNC_RECEIVER=y -CONFIG_BT_MAX_CONN=2 -CONFIG_BT_OBSERVER=y -CONFIG_BT_GATT_CLIENT=y -CONFIG_BT_GATT_AUTO_DISCOVER_CCC=y -CONFIG_BT_GATT_DYNAMIC_DB=y -CONFIG_BT_GATT_AUTO_UPDATE_MTU=y -CONFIG_BT_AUDIO=y - -# Requirements for CAP commander -CONFIG_BT_VCP_VOL_CTLR=y -CONFIG_BT_VOCS_CLIENT_MAX_INSTANCE_COUNT=1 -CONFIG_BT_VCP_VOL_CTLR_MAX_VOCS_INST=1 -CONFIG_BT_CSIP_SET_COORDINATOR=y -CONFIG_BT_MICP_MIC_CTLR=y -CONFIG_BT_AICS_CLIENT_MAX_INSTANCE_COUNT=1 -CONFIG_BT_MICP_MIC_CTLR_MAX_AICS_INST=1 - CONFIG_BT_CAP_COMMANDER=y -CONFIG_BT_EXT_ADV=y -CONFIG_BT_PER_ADV_SYNC=y -CONFIG_BT_BAP_BROADCAST_ASSISTANT=y + CONFIG_LOG=y CONFIG_BT_CAP_COMMANDER_LOG_LEVEL_DBG=y -CONFIG_BT_BAP_BASS_MAX_SUBGROUPS=2 + CONFIG_ASSERT=y CONFIG_ASSERT_LEVEL=2 CONFIG_ASSERT_VERBOSE=y diff --git a/tests/bluetooth/audio/cap_commander/testcase.yaml b/tests/bluetooth/audio/cap_commander/testcase.yaml index e37b5c0d22a08..2018bf74eae0b 100644 --- a/tests/bluetooth/audio/cap_commander/testcase.yaml +++ b/tests/bluetooth/audio/cap_commander/testcase.yaml @@ -4,4 +4,7 @@ common: - bluetooth_audio tests: bluetooth.audio.cap_commander.test_default: - type: unit + platform_allow: + - native_sim + integration_platforms: + - native_sim diff --git a/tests/bluetooth/audio/cap_commander/uut/CMakeLists.txt b/tests/bluetooth/audio/cap_commander/uut/CMakeLists.txt deleted file mode 100644 index 7940f3c993c4b..0000000000000 --- a/tests/bluetooth/audio/cap_commander/uut/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -# -# Copyright (c) 2023 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# -# CMakeLists.txt file for creating of uut library. -# - -add_library(uut STATIC - ${ZEPHYR_BASE}/subsys/bluetooth/audio/audio.c - ${ZEPHYR_BASE}/subsys/bluetooth/audio/cap_commander.c - ${ZEPHYR_BASE}/subsys/bluetooth/audio/cap_common.c - ${ZEPHYR_BASE}/subsys/logging/log_minimal.c - ${ZEPHYR_BASE}/lib/net_buf/buf_simple.c - bap_broadcast_assistant.c - aics.c - cap_commander.c - csip.c - micp.c - vcp.c - vocs.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_commander/include) - -target_compile_options(uut PRIVATE -std=c11 -include ztest.h)