diff --git a/tests/bluetooth/controller/common/CMakeLists.txt b/tests/bluetooth/controller/common/CMakeLists.txt new file mode 100644 index 000000000000000..c9fea0ca0271c14 --- /dev/null +++ b/tests/bluetooth/controller/common/CMakeLists.txt @@ -0,0 +1,23 @@ +# +# CMakeLists.txt file for creating of mocks library. +# + +add_library(common STATIC + src/helper_pdu.c + src/helper_util.c +) + +target_include_directories(common PUBLIC + ${ZEPHYR_BASE}/tests/bluetooth/controller/common/include + ${ZEPHYR_BASE}/subsys/bluetooth/controller/include + ${ZEPHYR_BASE}/subsys/bluetooth/controller/util + ${ZEPHYR_BASE}/subsys/bluetooth/controller + ${ZEPHYR_BASE}/subsys/bluetooth + ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw + ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/nordic/lll + ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/nordic + ${ZEPHYR_BASE}/include/zephyr/bluetooth + +) + +target_link_libraries(common PRIVATE test_interface) diff --git a/tests/bluetooth/controller/common/src/helper_pdu.c b/tests/bluetooth/controller/common/src/helper_pdu.c index 00e42fd6926bb96..8470fe1fa27d283 100644 --- a/tests/bluetooth/controller/common/src/helper_pdu.c +++ b/tests/bluetooth/controller/common/src/helper_pdu.c @@ -6,7 +6,7 @@ */ #include "zephyr/types.h" -#include "ztest.h" +#include "zephyr/ztest.h" #include #include diff --git a/tests/bluetooth/controller/common/src/helper_util.c b/tests/bluetooth/controller/common/src/helper_util.c index 551d33f9a203bd1..f29c36dcef626a9 100644 --- a/tests/bluetooth/controller/common/src/helper_util.c +++ b/tests/bluetooth/controller/common/src/helper_util.c @@ -6,7 +6,7 @@ */ #include "zephyr/types.h" -#include "ztest.h" +#include "zephyr/ztest.h" #include #include diff --git a/tests/bluetooth/controller/common/unit_sources.txt b/tests/bluetooth/controller/common/unit_sources.txt new file mode 100644 index 000000000000000..f4d29e62b7994c6 --- /dev/null +++ b/tests/bluetooth/controller/common/unit_sources.txt @@ -0,0 +1,37 @@ +# +# Common include directories and source files for bluetooth unit tests +# + +include_directories( + src + ${ZEPHYR_BASE}/tests/bluetooth/controller/mock_ctrl/include + ${ZEPHYR_BASE}/tests/bluetooth/controller/common/include + ${ZEPHYR_BASE}/include/zephyr/bluetooth + ${ZEPHYR_BASE}/subsys/bluetooth + ${ZEPHYR_BASE}/subsys/bluetooth/controller + ${ZEPHYR_BASE}/subsys/bluetooth/controller/util + ${ZEPHYR_BASE}/subsys/bluetooth/controller/include + ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw + ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/nordic + ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/nordic/lll +) + +FILE(GLOB unit_sources + ${ZEPHYR_BASE}/subsys/bluetooth/controller/util/mem.c + ${ZEPHYR_BASE}/subsys/bluetooth/controller/util/memq.c + ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/ull_chan.c + ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/ull_tx_queue.c + ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/ull_llcp_local.c + ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/ull_llcp_remote.c + ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/ull_llcp_pdu.c + ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/ull_llcp_common.c + ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/ull_llcp_phy.c + ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/ull_llcp_enc.c + ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/ull_llcp_conn_upd.c + ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/ull_llcp_chmu.c + ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/ull_llcp_cc.c + ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/ull_llcp.c + ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/ull_conn.c +) + +add_definitions(-include ztest.h) diff --git a/tests/bluetooth/controller/ctrl_feature_exchange/CMakeLists.txt b/tests/bluetooth/controller/ctrl_feature_exchange/CMakeLists.txt index 57a7c71a2f02d22..b7d479b5676c3ba 100644 --- a/tests/bluetooth/controller/ctrl_feature_exchange/CMakeLists.txt +++ b/tests/bluetooth/controller/ctrl_feature_exchange/CMakeLists.txt @@ -4,12 +4,17 @@ cmake_minimum_required(VERSION 3.20.0) project(bluetooth_ull_llcp_feature_exchange) find_package(Zephyr COMPONENTS unittest HINTS $ENV{ZEPHYR_BASE}) -include(${ZEPHYR_BASE}/tests/bluetooth/controller/common/defaults_cmake.txt) + +add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/controller/common common) +add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/controller/mock_ctrl mocks) + +target_link_libraries(testbinary PRIVATE mocks common) + +include(${ZEPHYR_BASE}/tests/bluetooth/controller/common/unit_sources.txt) + target_sources(testbinary PRIVATE src/main.c src/main_hci.c - ${ll_sw_sources} - ${mock_sources} - ${common_sources} + ${unit_sources} ) diff --git a/tests/bluetooth/controller/ctrl_feature_exchange/Kconfig b/tests/bluetooth/controller/ctrl_feature_exchange/Kconfig index c7af58c529edfd6..f59daf15eb52672 100644 --- a/tests/bluetooth/controller/ctrl_feature_exchange/Kconfig +++ b/tests/bluetooth/controller/ctrl_feature_exchange/Kconfig @@ -15,6 +15,14 @@ config BT_CTLR_PHY_UPDATE_SUPPORT bool default y +config BT_CTLR_PHY_CODED_SUPPORT + bool + default y + +config BT_CTLR_PHY_2M_SUPPORT + bool + default y + config ENTROPY_NRF_FORCE_ALT bool default n diff --git a/tests/bluetooth/controller/ctrl_feature_exchange/prj.conf b/tests/bluetooth/controller/ctrl_feature_exchange/prj.conf index c081523b0cd3f31..168bbc665cb6a7c 100644 --- a/tests/bluetooth/controller/ctrl_feature_exchange/prj.conf +++ b/tests/bluetooth/controller/ctrl_feature_exchange/prj.conf @@ -11,6 +11,8 @@ CONFIG_BT_HCI=y CONFIG_BT_CTLR=y CONFIG_BT_LL_SW_SPLIT=y +CONFIG_BT_LLL_VENDOR_NORDIC=y + CONFIG_BT_CENTRAL=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_CTLR_PERIPHERAL_ISO=y diff --git a/tests/bluetooth/controller/mock_ctrl/CMakeLists.txt b/tests/bluetooth/controller/mock_ctrl/CMakeLists.txt new file mode 100644 index 000000000000000..a7528dab581575a --- /dev/null +++ b/tests/bluetooth/controller/mock_ctrl/CMakeLists.txt @@ -0,0 +1,39 @@ +# +# CMakeLists.txt file for creating of mocks library. +# + +add_library(mocks STATIC + ${ZEPHYR_BASE}/tests/bluetooth/controller/mock_ctrl/src/kernel.c + ${ZEPHYR_BASE}/tests/bluetooth/controller/mock_ctrl/src/ecb.c + ${ZEPHYR_BASE}/tests/bluetooth/controller/mock_ctrl/src/mayfly.c + ${ZEPHYR_BASE}/tests/bluetooth/controller/mock_ctrl/src/lll.c + ${ZEPHYR_BASE}/tests/bluetooth/controller/mock_ctrl/src/lll_conn.c + ${ZEPHYR_BASE}/tests/bluetooth/controller/mock_ctrl/src/ll_assert.c + ${ZEPHYR_BASE}/tests/bluetooth/controller/mock_ctrl/src/assert.c + ${ZEPHYR_BASE}/tests/bluetooth/controller/mock_ctrl/src/util.c + ${ZEPHYR_BASE}/tests/bluetooth/controller/mock_ctrl/src/ticker.c + ${ZEPHYR_BASE}/tests/bluetooth/controller/mock_ctrl/src/ull.c + ${ZEPHYR_BASE}/tests/bluetooth/controller/mock_ctrl/src/ull_conn_iso.c + ${ZEPHYR_BASE}/tests/bluetooth/controller/mock_ctrl/src/ull_peripheral.c + ${ZEPHYR_BASE}/tests/bluetooth/controller/mock_ctrl/src/ull_peripheral_iso.c + ${ZEPHYR_BASE}/tests/bluetooth/controller/mock_ctrl/src/ull_central.c + ${ZEPHYR_BASE}/tests/bluetooth/controller/mock_ctrl/src/ull_scan.c + ${ZEPHYR_BASE}/tests/bluetooth/controller/mock_ctrl/src/lll_clock.c +) + + +target_include_directories(mocks PUBLIC + ${ZEPHYR_BASE}/tests/bluetooth/controller/mock_ctrl/include + ${ZEPHYR_BASE}/subsys/bluetooth/controller/include + ${ZEPHYR_BASE}/subsys/bluetooth/controller/util + ${ZEPHYR_BASE}/subsys/bluetooth/controller + ${ZEPHYR_BASE}/subsys/bluetooth + ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw + ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/nordic/lll + ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/nordic + ${ZEPHYR_BASE}/include/zephyr/bluetooth + +) + +target_link_libraries(mocks PRIVATE test_interface) + diff --git a/tests/bluetooth/controller/mock_ctrl/src/assert.c b/tests/bluetooth/controller/mock_ctrl/src/assert.c index bbf28c0d56e32e2..15d89ebdec37624 100644 --- a/tests/bluetooth/controller/mock_ctrl/src/assert.c +++ b/tests/bluetooth/controller/mock_ctrl/src/assert.c @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include #include #include "assert.h" diff --git a/tests/bluetooth/controller/mock_ctrl/src/ecb.c b/tests/bluetooth/controller/mock_ctrl/src/ecb.c index 180f5d77f5f68ba..18c166e6d887fa2 100644 --- a/tests/bluetooth/controller/mock_ctrl/src/ecb.c +++ b/tests/bluetooth/controller/mock_ctrl/src/ecb.c @@ -3,6 +3,8 @@ * * SPDX-License-Identifier: Apache-2.0 */ +#include +#include #include "hal/ecb.h" __attribute__((weak)) void ecb_encrypt(uint8_t const *const key_le, diff --git a/tests/bluetooth/controller/mock_ctrl/src/ll_assert.c b/tests/bluetooth/controller/mock_ctrl/src/ll_assert.c index 97033603010de96..9ba958cdfc48192 100644 --- a/tests/bluetooth/controller/mock_ctrl/src/ll_assert.c +++ b/tests/bluetooth/controller/mock_ctrl/src/ll_assert.c @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "zephyr/types.h" -#include "ztest.h" +#include +#include #include void bt_ctlr_assert_handle(char *file, uint32_t line) diff --git a/tests/bluetooth/controller/mock_ctrl/src/lll_clock.c b/tests/bluetooth/controller/mock_ctrl/src/lll_clock.c index 96a0df59d2b4f59..a15ffab5b069635 100644 --- a/tests/bluetooth/controller/mock_ctrl/src/lll_clock.c +++ b/tests/bluetooth/controller/mock_ctrl/src/lll_clock.c @@ -5,6 +5,7 @@ */ #include +#include #include #include "hal/debug.h" diff --git a/tests/bluetooth/controller/mock_ctrl/src/lll_conn.c b/tests/bluetooth/controller/mock_ctrl/src/lll_conn.c index 94394d899bb5a93..a59e75f8f67f128 100644 --- a/tests/bluetooth/controller/mock_ctrl/src/lll_conn.c +++ b/tests/bluetooth/controller/mock_ctrl/src/lll_conn.c @@ -9,6 +9,7 @@ #include #include +#include #include #include "hal/cpu.h" diff --git a/tests/bluetooth/controller/mock_ctrl/src/mayfly.c b/tests/bluetooth/controller/mock_ctrl/src/mayfly.c index 7c629071600ef2d..8acb2e6a62ec29e 100644 --- a/tests/bluetooth/controller/mock_ctrl/src/mayfly.c +++ b/tests/bluetooth/controller/mock_ctrl/src/mayfly.c @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include +#include #include "memq.h" #include "mayfly.h" diff --git a/tests/bluetooth/controller/mock_ctrl/src/ticker.c b/tests/bluetooth/controller/mock_ctrl/src/ticker.c index b9cd58caa4d6505..2b96b2ff08d9f8b 100644 --- a/tests/bluetooth/controller/mock_ctrl/src/ticker.c +++ b/tests/bluetooth/controller/mock_ctrl/src/ticker.c @@ -6,6 +6,7 @@ */ #include +#include #include "ticker/ticker.h" diff --git a/tests/bluetooth/controller/mock_ctrl/src/ull.c b/tests/bluetooth/controller/mock_ctrl/src/ull.c index 53781a499e78e30..545ea94799d3a65 100644 --- a/tests/bluetooth/controller/mock_ctrl/src/ull.c +++ b/tests/bluetooth/controller/mock_ctrl/src/ull.c @@ -5,6 +5,7 @@ */ #include +#include #include diff --git a/tests/bluetooth/controller/mock_ctrl/src/ull_central.c b/tests/bluetooth/controller/mock_ctrl/src/ull_central.c index 691ad90b3a26463..cece7ab0929ac3c 100644 --- a/tests/bluetooth/controller/mock_ctrl/src/ull_central.c +++ b/tests/bluetooth/controller/mock_ctrl/src/ull_central.c @@ -5,6 +5,7 @@ */ #include "zephyr/types.h" +#include #include "util/util.h" #include "util/mem.h" #include "util/memq.h" diff --git a/tests/bluetooth/controller/mock_ctrl/src/ull_conn_iso.c b/tests/bluetooth/controller/mock_ctrl/src/ull_conn_iso.c index 71418b505041fff..fcde35cdcb6f301 100644 --- a/tests/bluetooth/controller/mock_ctrl/src/ull_conn_iso.c +++ b/tests/bluetooth/controller/mock_ctrl/src/ull_conn_iso.c @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + #include #include "hal/ccm.h" diff --git a/tests/bluetooth/controller/mock_ctrl/src/ull_peripheral.c b/tests/bluetooth/controller/mock_ctrl/src/ull_peripheral.c index b6e106696bb576f..c8774d858479bd7 100644 --- a/tests/bluetooth/controller/mock_ctrl/src/ull_peripheral.c +++ b/tests/bluetooth/controller/mock_ctrl/src/ull_peripheral.c @@ -5,6 +5,7 @@ */ #include "zephyr/types.h" +#include #include "util/util.h" #include "util/mem.h" #include "util/memq.h" diff --git a/tests/bluetooth/controller/mock_ctrl/src/ull_peripheral_iso.c b/tests/bluetooth/controller/mock_ctrl/src/ull_peripheral_iso.c index e444246dc4714ac..c00b88b5acf15d1 100644 --- a/tests/bluetooth/controller/mock_ctrl/src/ull_peripheral_iso.c +++ b/tests/bluetooth/controller/mock_ctrl/src/ull_peripheral_iso.c @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + #include #include #include diff --git a/tests/bluetooth/controller/mock_ctrl/src/ull_scan.c b/tests/bluetooth/controller/mock_ctrl/src/ull_scan.c index 11ae4d8fafec4f7..1f1f89dace25604 100644 --- a/tests/bluetooth/controller/mock_ctrl/src/ull_scan.c +++ b/tests/bluetooth/controller/mock_ctrl/src/ull_scan.c @@ -5,7 +5,9 @@ * SPDX-License-Identifier: Apache-2.0 */ + #include +#include #include "hci_err.h" #include "util/mem.h" diff --git a/tests/bluetooth/controller/mock_ctrl/src/util.c b/tests/bluetooth/controller/mock_ctrl/src/util.c index 5e965d8c3d1e670..9c5844b136cbdee 100644 --- a/tests/bluetooth/controller/mock_ctrl/src/util.c +++ b/tests/bluetooth/controller/mock_ctrl/src/util.c @@ -7,6 +7,7 @@ #include #include +#include #include "util.h" #include "pdu.h"