bluetooth: controller: update unittests for LLCP to use proper ZTEST API

Update unittests for the following areas/controll procedures
- API
- collision handling
- invalid PDUs
- unsupported procedures
- buffer allocation
- TX queue
- Data Length Update
- PHY update
- Encryption
- Ping
- Version
- Channel map update
- Min. used channels
- Connection update
- SCA
- Terminate connection
- CTE request
- CIS create
- CIS terminate

Also moved the internal API tests from the ull_llcp* files
to the proper unittest C-file

Unused files  are removed

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
This commit is contained in:
Andries Kruithof 2022-12-07 15:01:12 +01:00 committed by Carles Cufí
commit e6ba1eed90
114 changed files with 2464 additions and 1494 deletions

View file

@ -1829,12 +1829,12 @@ void ull_cp_rx(struct ll_conn *conn, struct node_rx_pdu *rx)
#ifdef ZTEST_UNITTEST
static uint16_t local_ctx_buffers_free(void)
uint16_t local_ctx_buffers_free(void)
{
return mem_free_count_get(mem_local_ctx.free);
}
static uint16_t remote_ctx_buffers_free(void)
uint16_t remote_ctx_buffers_free(void)
{
return mem_free_count_get(mem_remote_ctx.free);
}
@ -1851,142 +1851,13 @@ uint8_t common_tx_buffer_alloc_count(void)
}
#endif /* LLCP_TX_CTRL_BUF_QUEUE_ENABLE */
void test_int_mem_proc_ctx(void)
struct proc_ctx *pub_proc_ctx_acquire(void)
{
struct proc_ctx *ctx1;
struct proc_ctx *ctx2;
int nr_of_free_ctx;
ull_cp_init();
nr_of_free_ctx = ctx_buffers_free();
zassert_equal(nr_of_free_ctx, CONFIG_BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM +
CONFIG_BT_CTLR_LLCP_REMOTE_PROC_CTX_BUF_NUM, NULL);
for (int i = 0U; i < CONFIG_BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM; i++) {
ctx1 = proc_ctx_acquire(&mem_local_ctx);
/* The previous acquire should be valid */
zassert_not_null(ctx1, NULL);
}
nr_of_free_ctx = local_ctx_buffers_free();
zassert_equal(nr_of_free_ctx, 0);
ctx2 = proc_ctx_acquire(&mem_local_ctx);
/* The last acquire should fail */
zassert_is_null(ctx2, NULL);
llcp_proc_ctx_release(ctx1);
nr_of_free_ctx = local_ctx_buffers_free();
zassert_equal(nr_of_free_ctx, 1);
ctx1 = proc_ctx_acquire(&mem_local_ctx);
/* Releasing returns the context to the avilable pool */
zassert_not_null(ctx1, NULL);
return proc_ctx_acquire(&mem_local_ctx);
}
void test_int_mem_tx(void)
struct proc_ctx *pub_create_procedure(enum llcp_proc proc)
{
bool peek;
#if defined(LLCP_TX_CTRL_BUF_QUEUE_ENABLE)
#define TX_BUFFER_POOL_SIZE (CONFIG_BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM + \
CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM)
#else /* LLCP_TX_CTRL_BUF_QUEUE_ENABLE */
#define TX_BUFFER_POOL_SIZE (CONFIG_BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM + \
CONFIG_BT_CTLR_LLCP_CONN * \
CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM)
#endif /* LLCP_TX_CTRL_BUF_QUEUE_ENABLE */
struct ll_conn conn;
struct node_tx *txl[TX_BUFFER_POOL_SIZE];
struct proc_ctx *ctx;
ull_cp_init();
ull_llcp_init(&conn);
ctx = llcp_create_local_procedure(PROC_CONN_UPDATE);
for (int i = 0U; i < TX_BUFFER_POOL_SIZE; i++) {
peek = llcp_tx_alloc_peek(&conn, ctx);
/* The previous tx alloc peek should be valid */
zassert_true(peek, NULL);
txl[i] = llcp_tx_alloc(&conn, ctx);
/* The previous alloc should be valid */
zassert_not_null(txl[i], NULL);
}
peek = llcp_tx_alloc_peek(&conn, ctx);
/* The last tx alloc peek should fail */
zassert_false(peek, NULL);
/* Release all */
for (int i = 0U; i < TX_BUFFER_POOL_SIZE; i++) {
ull_cp_release_tx(&conn, txl[i]);
}
for (int i = 0U; i < TX_BUFFER_POOL_SIZE; i++) {
peek = llcp_tx_alloc_peek(&conn, ctx);
/* The previous tx alloc peek should be valid */
zassert_true(peek, NULL);
txl[i] = llcp_tx_alloc(&conn, ctx);
/* The previous alloc should be valid */
zassert_not_null(txl[i], NULL);
}
peek = llcp_tx_alloc_peek(&conn, ctx);
/* The last tx alloc peek should fail */
zassert_false(peek, NULL);
/* Release all */
for (int i = 0U; i < TX_BUFFER_POOL_SIZE; i++) {
ull_cp_release_tx(&conn, txl[i]);
}
return create_procedure(proc, &mem_local_ctx);
}
void test_int_create_proc(void)
{
struct proc_ctx *ctx;
ull_cp_init();
ctx = create_procedure(PROC_VERSION_EXCHANGE, &mem_local_ctx);
zassert_not_null(ctx, NULL);
zassert_equal(ctx->proc, PROC_VERSION_EXCHANGE);
zassert_equal(ctx->collision, 0);
for (int i = 0U; i < CONFIG_BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM; i++) {
zassert_not_null(ctx, NULL);
ctx = create_procedure(PROC_VERSION_EXCHANGE, &mem_local_ctx);
}
zassert_is_null(ctx, NULL);
}
void test_int_llcp_init(void)
{
struct ll_conn conn;
ull_cp_init();
ull_llcp_init(&conn);
memset(&conn.llcp, 0xAA, sizeof(conn.llcp));
ull_llcp_init(&conn);
zassert_equal(conn.llcp.local.pause, 0);
zassert_equal(conn.llcp.remote.pause, 0);
}
#endif

View file

@ -738,8 +738,17 @@ void llcp_pdu_decode_cis_rsp(struct proc_ctx *ctx, struct pdu_data *pdu);
#ifdef ZTEST_UNITTEST
bool lr_is_disconnected(struct ll_conn *conn);
bool lr_is_idle(struct ll_conn *conn);
struct proc_ctx *pub_lr_dequeue(struct ll_conn *conn);
bool rr_is_disconnected(struct ll_conn *conn);
bool rr_is_idle(struct ll_conn *conn);
struct proc_ctx *pub_rr_dequeue(struct ll_conn *conn);
void pub_rr_enqueue(struct ll_conn *conn, struct proc_ctx *ctx);
uint16_t local_ctx_buffers_free(void);
uint16_t remote_ctx_buffers_free(void);
uint16_t ctx_buffers_free(void);
uint8_t common_tx_buffer_alloc_count(void);
struct proc_ctx *pub_proc_ctx_acquire(void);
struct proc_ctx *pub_create_procedure(enum llcp_proc proc);
#endif

View file

@ -610,38 +610,9 @@ bool lr_is_idle(struct ll_conn *conn)
return conn->llcp.local.state == LR_STATE_IDLE;
}
void test_int_local_pending_requests(void)
struct proc_ctx *pub_lr_dequeue(struct ll_conn *conn)
{
struct ll_conn conn;
struct proc_ctx *peek_ctx;
struct proc_ctx *dequeue_ctx;
struct proc_ctx ctx;
ull_cp_init();
ull_tx_q_init(&conn.tx_q);
ull_llcp_init(&conn);
peek_ctx = llcp_lr_peek(&conn);
zassert_is_null(peek_ctx, NULL);
dequeue_ctx = lr_dequeue(&conn);
zassert_is_null(dequeue_ctx, NULL);
llcp_lr_enqueue(&conn, &ctx);
peek_ctx = (struct proc_ctx *)sys_slist_peek_head(&conn.llcp.local.pend_proc_list);
zassert_equal_ptr(peek_ctx, &ctx, NULL);
peek_ctx = llcp_lr_peek(&conn);
zassert_equal_ptr(peek_ctx, &ctx, NULL);
dequeue_ctx = lr_dequeue(&conn);
zassert_equal_ptr(dequeue_ctx, &ctx, NULL);
peek_ctx = llcp_lr_peek(&conn);
zassert_is_null(peek_ctx, NULL);
dequeue_ctx = lr_dequeue(&conn);
zassert_is_null(dequeue_ctx, NULL);
return lr_dequeue(conn);
}
#endif

View file

@ -930,38 +930,14 @@ bool rr_is_idle(struct ll_conn *conn)
return conn->llcp.remote.state == RR_STATE_IDLE;
}
void test_int_remote_pending_requests(void)
struct proc_ctx *pub_rr_dequeue(struct ll_conn *conn)
{
struct ll_conn conn;
struct proc_ctx *peek_ctx;
struct proc_ctx *dequeue_ctx;
struct proc_ctx ctx;
return rr_dequeue(conn);
}
ull_cp_init();
ull_tx_q_init(&conn.tx_q);
ull_llcp_init(&conn);
peek_ctx = llcp_rr_peek(&conn);
zassert_is_null(peek_ctx, NULL);
dequeue_ctx = rr_dequeue(&conn);
zassert_is_null(dequeue_ctx, NULL);
rr_enqueue(&conn, &ctx);
peek_ctx = (struct proc_ctx *)sys_slist_peek_head(&conn.llcp.remote.pend_proc_list);
zassert_equal_ptr(peek_ctx, &ctx, NULL);
peek_ctx = llcp_rr_peek(&conn);
zassert_equal_ptr(peek_ctx, &ctx, NULL);
dequeue_ctx = rr_dequeue(&conn);
zassert_equal_ptr(dequeue_ctx, &ctx, NULL);
peek_ctx = llcp_rr_peek(&conn);
zassert_is_null(peek_ctx, NULL);
dequeue_ctx = rr_dequeue(&conn);
zassert_is_null(dequeue_ctx, NULL);
void pub_rr_enqueue(struct ll_conn *conn, struct proc_ctx *ctx)
{
rr_enqueue(conn, ctx);
}
#endif

View file

@ -1,68 +0,0 @@
#
# 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 ll_sw_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
${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/ll_addr.c
${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/ll_feat.c
)
FILE(GLOB mock_sources
${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/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
)
FILE(GLOB common_sources
${ZEPHYR_BASE}/tests/bluetooth/controller/common/src/helper_pdu.c
${ZEPHYR_BASE}/tests/bluetooth/controller/common/src/helper_util.c
)
add_definitions(-include kconfig.h)
if(KCONFIG_OVERRIDE_FILE)
add_definitions(-include ${KCONFIG_OVERRIDE_FILE})
endif()
add_definitions(-include ztest.h)
add_definitions(-include soc.h)

View file

@ -4,11 +4,13 @@ cmake_minimum_required(VERSION 3.20.0)
project(bluetooth_ull_llcp_api)
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/uut uut)
target_link_libraries(testbinary PRIVATE uut common)
target_sources(testbinary
PRIVATE
src/main.c
${ll_sw_sources}
${mock_sources}
${common_sources}
)

View file

@ -0,0 +1,29 @@
# Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# some of the control procedures in the BT LL depend on
# the following configs been set
config SOC_COMPATIBLE_NRF
default y
config BT_CTLR_DATA_LEN_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_CODED_SUPPORT
default y
config BT_CTLR_PHY_2M_SUPPORT
default y
config ENTROPY_NRF_FORCE_ALT
default n
config ENTROPY_NRF5_RNG
default n
# Include Zephyr's Kconfig
source "Kconfig"

View file

@ -0,0 +1,30 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
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
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y

View file

@ -6,7 +6,6 @@
#include <zephyr/types.h>
#include <zephyr/ztest.h>
#include "kconfig.h"
#include <zephyr/bluetooth/hci.h>
#include <zephyr/sys/byteorder.h>
@ -27,7 +26,7 @@
#include "ll_feat.h"
#include "lll.h"
#include "lll_df_types.h"
#include "lll/lll_df_types.h"
#include "lll_conn.h"
#include "lll_conn_iso.h"
@ -43,13 +42,13 @@
#include "helper_pdu.h"
#include "helper_util.h"
struct ll_conn conn;
static struct ll_conn conn;
/*
* Note API and internal test are not yet split out here
*/
void test_api_init(void)
ZTEST(public, test_api_init)
{
ull_cp_init();
ull_tx_q_init(&conn.tx_q);
@ -60,14 +59,7 @@ void test_api_init(void)
zassert_true(rr_is_disconnected(&conn));
}
extern void test_int_mem_proc_ctx(void);
extern void test_int_mem_tx(void);
extern void test_int_create_proc(void);
extern void test_int_llcp_init(void);
extern void test_int_local_pending_requests(void);
extern void test_int_remote_pending_requests(void);
void test_api_connect(void)
ZTEST(public, test_api_connect)
{
ull_cp_init();
ull_tx_q_init(&conn.tx_q);
@ -78,7 +70,7 @@ void test_api_connect(void)
zassert_true(rr_is_idle(&conn));
}
void test_api_disconnect(void)
ZTEST(public, test_api_disconnect)
{
ull_cp_init();
ull_tx_q_init(&conn.tx_q);
@ -97,7 +89,7 @@ void test_api_disconnect(void)
zassert_true(rr_is_disconnected(&conn));
}
void test_int_disconnect_loc(void)
ZTEST(public, test_int_disconnect_loc)
{
uint64_t err;
int nr_free_ctx;
@ -154,7 +146,7 @@ void test_int_disconnect_loc(void)
ut_rx_q_is_empty();
}
void test_int_disconnect_rem(void)
ZTEST(public, test_int_disconnect_rem)
{
int nr_free_ctx;
struct pdu_data_llctrl_version_ind remote_version_ind = {
@ -205,7 +197,7 @@ void test_int_disconnect_rem(void)
#define SIZE 2
void test_int_pause_resume_data_path(void)
ZTEST(public, test_int_pause_resume_data_path)
{
struct node_tx *node;
struct node_tx nodes[SIZE] = { 0 };
@ -342,22 +334,213 @@ void test_int_pause_resume_data_path(void)
zassert_equal_ptr(node, NULL, "");
}
void test_main(void)
ZTEST(internal, test_int_mem_proc_ctx)
{
ztest_test_suite(internal,
ztest_unit_test(test_int_mem_proc_ctx),
ztest_unit_test(test_int_mem_tx),
ztest_unit_test(test_int_create_proc),
ztest_unit_test(test_int_llcp_init),
ztest_unit_test(test_int_local_pending_requests),
ztest_unit_test(test_int_remote_pending_requests),
ztest_unit_test(test_int_disconnect_loc),
ztest_unit_test(test_int_disconnect_rem),
ztest_unit_test(test_int_pause_resume_data_path));
struct proc_ctx *ctx1;
struct proc_ctx *ctx2;
int nr_of_free_ctx;
ztest_test_suite(public, ztest_unit_test(test_api_init), ztest_unit_test(test_api_connect),
ztest_unit_test(test_api_disconnect));
ull_cp_init();
ztest_run_test_suite(internal);
ztest_run_test_suite(public);
nr_of_free_ctx = ctx_buffers_free();
zassert_equal(nr_of_free_ctx, CONFIG_BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM +
CONFIG_BT_CTLR_LLCP_REMOTE_PROC_CTX_BUF_NUM, NULL);
for (int i = 0U; i < CONFIG_BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM; i++) {
ctx1 = pub_proc_ctx_acquire();
/* The previous acquire should be valid */
zassert_not_null(ctx1, NULL);
}
nr_of_free_ctx = local_ctx_buffers_free();
zassert_equal(nr_of_free_ctx, 0);
ctx2 = pub_proc_ctx_acquire();
/* The last acquire should fail */
zassert_is_null(ctx2, NULL);
llcp_proc_ctx_release(ctx1);
nr_of_free_ctx = local_ctx_buffers_free();
zassert_equal(nr_of_free_ctx, 1);
ctx1 = pub_proc_ctx_acquire();
/* Releasing returns the context to the avilable pool */
zassert_not_null(ctx1, NULL);
}
ZTEST(internal, test_int_mem_tx)
{
bool peek;
#if defined(LLCP_TX_CTRL_BUF_QUEUE_ENABLE)
#define TX_BUFFER_POOL_SIZE (CONFIG_BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM + \
CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM)
#else /* LLCP_TX_CTRL_BUF_QUEUE_ENABLE */
#define TX_BUFFER_POOL_SIZE (CONFIG_BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM + \
CONFIG_BT_CTLR_LLCP_CONN * \
CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM)
#endif /* LLCP_TX_CTRL_BUF_QUEUE_ENABLE */
struct ll_conn conn;
struct node_tx *txl[TX_BUFFER_POOL_SIZE];
struct proc_ctx *ctx;
ull_cp_init();
ull_llcp_init(&conn);
ctx = llcp_create_local_procedure(PROC_CONN_UPDATE);
for (int i = 0U; i < TX_BUFFER_POOL_SIZE; i++) {
peek = llcp_tx_alloc_peek(&conn, ctx);
/* The previous tx alloc peek should be valid */
zassert_true(peek, NULL);
txl[i] = llcp_tx_alloc(&conn, ctx);
/* The previous alloc should be valid */
zassert_not_null(txl[i], NULL);
}
peek = llcp_tx_alloc_peek(&conn, ctx);
/* The last tx alloc peek should fail */
zassert_false(peek, NULL);
/* Release all */
for (int i = 0U; i < TX_BUFFER_POOL_SIZE; i++) {
ull_cp_release_tx(&conn, txl[i]);
}
for (int i = 0U; i < TX_BUFFER_POOL_SIZE; i++) {
peek = llcp_tx_alloc_peek(&conn, ctx);
/* The previous tx alloc peek should be valid */
zassert_true(peek, NULL);
txl[i] = llcp_tx_alloc(&conn, ctx);
/* The previous alloc should be valid */
zassert_not_null(txl[i], NULL);
}
peek = llcp_tx_alloc_peek(&conn, ctx);
/* The last tx alloc peek should fail */
zassert_false(peek, NULL);
/* Release all */
for (int i = 0U; i < TX_BUFFER_POOL_SIZE; i++) {
ull_cp_release_tx(&conn, txl[i]);
}
}
ZTEST(internal, test_int_create_proc)
{
struct proc_ctx *ctx;
ull_cp_init();
ctx = pub_create_procedure(PROC_VERSION_EXCHANGE);
zassert_not_null(ctx, NULL);
zassert_equal(ctx->proc, PROC_VERSION_EXCHANGE);
zassert_equal(ctx->collision, 0);
for (int i = 0U; i < CONFIG_BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM; i++) {
zassert_not_null(ctx, NULL);
ctx = pub_create_procedure(PROC_VERSION_EXCHANGE);
}
zassert_is_null(ctx, NULL);
}
ZTEST(internal, test_int_llcp_init)
{
struct ll_conn conn;
ull_cp_init();
ull_llcp_init(&conn);
memset(&conn.llcp, 0xAA, sizeof(conn.llcp));
ull_llcp_init(&conn);
zassert_equal(conn.llcp.local.pause, 0);
zassert_equal(conn.llcp.remote.pause, 0);
}
ZTEST(internal, test_int_local_pending_requests)
{
struct ll_conn conn;
struct proc_ctx *peek_ctx;
struct proc_ctx *dequeue_ctx;
struct proc_ctx ctx;
ull_cp_init();
ull_tx_q_init(&conn.tx_q);
ull_llcp_init(&conn);
peek_ctx = llcp_lr_peek(&conn);
zassert_is_null(peek_ctx, NULL);
dequeue_ctx = pub_lr_dequeue(&conn);
zassert_is_null(dequeue_ctx, NULL);
llcp_lr_enqueue(&conn, &ctx);
peek_ctx = (struct proc_ctx *)sys_slist_peek_head(&conn.llcp.local.pend_proc_list);
zassert_equal_ptr(peek_ctx, &ctx, NULL);
peek_ctx = llcp_lr_peek(&conn);
zassert_equal_ptr(peek_ctx, &ctx, NULL);
dequeue_ctx = pub_lr_dequeue(&conn);
zassert_equal_ptr(dequeue_ctx, &ctx, NULL);
peek_ctx = llcp_lr_peek(&conn);
zassert_is_null(peek_ctx, NULL);
dequeue_ctx = pub_lr_dequeue(&conn);
zassert_is_null(dequeue_ctx, NULL);
}
ZTEST(internal, test_int_remote_pending_requests)
{
struct ll_conn conn;
struct proc_ctx *peek_ctx;
struct proc_ctx *dequeue_ctx;
struct proc_ctx ctx;
ull_cp_init();
ull_tx_q_init(&conn.tx_q);
ull_llcp_init(&conn);
peek_ctx = llcp_rr_peek(&conn);
zassert_is_null(peek_ctx, NULL);
dequeue_ctx = pub_rr_dequeue(&conn);
zassert_is_null(dequeue_ctx, NULL);
pub_rr_enqueue(&conn, &ctx);
peek_ctx = (struct proc_ctx *)sys_slist_peek_head(&conn.llcp.remote.pend_proc_list);
zassert_equal_ptr(peek_ctx, &ctx, NULL);
peek_ctx = llcp_rr_peek(&conn);
zassert_equal_ptr(peek_ctx, &ctx, NULL);
dequeue_ctx = pub_rr_dequeue(&conn);
zassert_equal_ptr(dequeue_ctx, &ctx, NULL);
peek_ctx = llcp_rr_peek(&conn);
zassert_is_null(peek_ctx, NULL);
dequeue_ctx = pub_rr_dequeue(&conn);
zassert_is_null(dequeue_ctx, NULL);
}
ZTEST_SUITE(public, NULL, NULL, NULL, NULL, NULL);
ZTEST_SUITE(internal, NULL, NULL, NULL, NULL, NULL);

View file

@ -2,13 +2,15 @@
cmake_minimum_required(VERSION 3.20.0)
project(bluetooth_ctrl_ull_conn)
project(bluetooth_ull_llcp_chmu)
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/uut uut)
target_link_libraries(testbinary PRIVATE uut common)
target_sources(testbinary
PRIVATE
src/main.c
${ll_sw_sources}
${mock_sources}
${common_sources}
)

View file

@ -0,0 +1,29 @@
# Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# some of the control procedures in the BT LL depend on
# the following configs been set
config SOC_COMPATIBLE_NRF
default y
config BT_CTLR_DATA_LEN_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_CODED_SUPPORT
default y
config BT_CTLR_PHY_2M_SUPPORT
default y
config ENTROPY_NRF_FORCE_ALT
default n
config ENTROPY_NRF5_RNG
default n
# Include Zephyr's Kconfig
source "Kconfig"

View file

@ -0,0 +1,30 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
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
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y

View file

@ -6,7 +6,6 @@
#include <zephyr/types.h>
#include <zephyr/ztest.h>
#include "kconfig.h"
#define ULL_LLCP_UNITTEST
@ -28,7 +27,7 @@
#include "ll_settings.h"
#include "lll.h"
#include "lll_df_types.h"
#include "lll/lll_df_types.h"
#include "lll_conn.h"
#include "lll_conn_iso.h"
@ -47,7 +46,7 @@
static struct ll_conn conn;
static void setup(void)
static void chmu_setup(void *data)
{
test_setup(&conn);
}
@ -57,7 +56,7 @@ static bool is_instant_reached(struct ll_conn *conn, uint16_t instant)
return ((event_counter(conn) - instant) & 0xFFFF) <= 0x7FFF;
}
void test_channel_map_update_central_loc(void)
ZTEST(chmu, test_channel_map_update_central_loc)
{
uint8_t chm[5] = { 0x00, 0x04, 0x05, 0x06, 0x00 };
uint8_t initial_chm[5];
@ -139,7 +138,7 @@ void test_channel_map_update_central_loc(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_channel_map_update_central_invalid(void)
ZTEST(chmu, test_channel_map_update_central_invalid)
{
uint8_t chm[5] = { 0x00, 0x04, 0x05, 0x06, 0x00 };
uint8_t err;
@ -210,7 +209,7 @@ void test_channel_map_update_central_invalid(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_channel_map_update_periph_rem(void)
ZTEST(chmu, test_channel_map_update_periph_rem)
{
uint8_t chm[5] = { 0x00, 0x04, 0x05, 0x06, 0x00 };
uint8_t initial_chm[5];
@ -281,7 +280,7 @@ void test_channel_map_update_periph_rem(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_channel_map_update_periph_invalid(void)
ZTEST(chmu, test_channel_map_update_periph_invalid)
{
struct pdu_data_llctrl_chan_map_ind chmu_ind = {
.instant = 6,
@ -340,7 +339,7 @@ void test_channel_map_update_periph_invalid(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_channel_map_update_periph_loc(void)
ZTEST(chmu, test_channel_map_update_periph_loc)
{
uint8_t err;
uint8_t chm[5] = { 0x00, 0x06, 0x06, 0x06, 0x00 };
@ -358,19 +357,4 @@ void test_channel_map_update_periph_loc(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_main(void)
{
ztest_test_suite(chmu,
ztest_unit_test_setup_teardown(test_channel_map_update_central_loc, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_channel_map_update_central_invalid,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_channel_map_update_periph_rem, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_channel_map_update_periph_invalid,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_channel_map_update_periph_loc, setup,
unit_test_noop));
ztest_run_test_suite(chmu);
}
ZTEST_SUITE(chmu, NULL, NULL, chmu_setup, NULL, NULL);

View file

@ -1,14 +1,16 @@
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.13.1)
cmake_minimum_required(VERSION 3.20.0)
project(bluetooth_ull_llcp_cis_create)
find_package(ZephyrUnittest HINTS $ENV{ZEPHYR_BASE})
include(${ZEPHYR_BASE}/tests/bluetooth/controller/common/defaults_cmake.txt)
find_package(Zephyr COMPONENTS unittest HINTS $ENV{ZEPHYR_BASE})
add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/controller/common common)
add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/controller/uut uut)
target_link_libraries(testbinary PRIVATE uut common)
target_sources(testbinary
PRIVATE
src/main.c
${ll_sw_sources}
${mock_sources}
${common_sources}
PRIVATE
src/main.c
)

View file

@ -0,0 +1,29 @@
# Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# some of the control procedures in the BT LL depend on
# the following configs been set
config SOC_COMPATIBLE_NRF
default y
config BT_CTLR_DATA_LEN_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_CODED_SUPPORT
default y
config BT_CTLR_PHY_2M_SUPPORT
default y
config ENTROPY_NRF_FORCE_ALT
default n
config ENTROPY_NRF5_RNG
default n
# Include Zephyr's Kconfig
source "Kconfig"

View file

@ -0,0 +1,40 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
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
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y
CONFIG_BT_CTLR_ADV_EXT=y
CONFIG_BT_CTLR_ADV_ISO=y
CONFIG_BT_CTLR_SYNC_ISO=y
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_CTLR_PERIPHERAL_ISO=y
CONFIG_BT_PER_ADV_SYNC=y
CONFIG_BT_EXT_ADV=y
CONFIG_BT_PER_ADV_SYNC_MAX=1

View file

@ -6,7 +6,6 @@
#include <zephyr/types.h>
#include <zephyr/ztest.h>
#include "kconfig.h"
#include <zephyr/bluetooth/hci.h>
#include <zephyr/sys/byteorder.h>
@ -26,7 +25,7 @@
#include "ll_settings.h"
#include "lll.h"
#include "lll_df_types.h"
#include "lll/lll_df_types.h"
#include "lll_conn_iso.h"
#include "lll_conn.h"
@ -43,9 +42,9 @@
#include "helper_pdu.h"
#include "helper_util.h"
struct ll_conn conn;
static struct ll_conn conn;
static void setup(void)
static void cis_create_setup(void *data)
{
test_setup(&conn);
}
@ -115,7 +114,7 @@ static struct pdu_data_llctrl_cis_ind remote_cis_ind = {
* | LE CIS ESTABLISHED | |
* |<--------------------------| |
*/
static void test_cc_create_periph_rem_host_accept(void)
ZTEST(cis_create, test_cc_create_periph_rem_host_accept)
{
struct node_tx *tx;
struct node_rx_pdu *ntf;
@ -241,7 +240,7 @@ static void test_cc_create_periph_rem_host_accept(void)
* | |-------------------------->|
* | | |
*/
static void test_cc_create_periph_rem_host_reject(void)
ZTEST(cis_create, test_cc_create_periph_rem_host_reject)
{
struct node_tx *tx;
struct node_rx_pdu *ntf;
@ -315,7 +314,7 @@ static void test_cc_create_periph_rem_host_reject(void)
* | |-------------------------->|
* | | |
*/
static void test_cc_create_periph_rem_host_accept_to(void)
ZTEST(cis_create, test_cc_create_periph_rem_host_accept_to)
{
struct node_tx *tx;
struct node_rx_pdu *ntf;
@ -391,7 +390,7 @@ static void test_cc_create_periph_rem_host_accept_to(void)
* | |------------------------------>|
* | | |
*/
static void test_cc_create_periph_rem_invalid_phy(void)
ZTEST(cis_create, test_cc_create_periph_rem_invalid_phy)
{
static struct pdu_data_llctrl_cis_req remote_cis_req_invalid_phy = {
.cig_id = 0x01,
@ -450,18 +449,4 @@ static void test_cc_create_periph_rem_invalid_phy(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_main(void)
{
ztest_test_suite(
cis_create,
ztest_unit_test_setup_teardown(test_cc_create_periph_rem_host_accept, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_cc_create_periph_rem_host_reject, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_cc_create_periph_rem_host_accept_to, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_cc_create_periph_rem_invalid_phy, setup,
unit_test_noop));
ztest_run_test_suite(cis_create);
}
ZTEST_SUITE(cis_create, NULL, NULL, cis_create_setup, NULL, NULL);

View file

@ -1,14 +1,16 @@
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.13.1)
cmake_minimum_required(VERSION 3.20.0)
project(bluetooth_ull_llcp_cis_terminate)
find_package(ZephyrUnittest HINTS $ENV{ZEPHYR_BASE})
include(${ZEPHYR_BASE}/tests/bluetooth/controller/common/defaults_cmake.txt)
find_package(Zephyr COMPONENTS unittest HINTS $ENV{ZEPHYR_BASE})
add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/controller/common common)
add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/controller/uut uut)
target_link_libraries(testbinary PRIVATE uut common)
target_sources(testbinary
PRIVATE
src/main.c
${ll_sw_sources}
${mock_sources}
${common_sources}
PRIVATE
src/main.c
)

View file

@ -0,0 +1,29 @@
# Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# some of the control procedures in the BT LL depend on
# the following configs been set
config SOC_COMPATIBLE_NRF
default y
config BT_CTLR_DATA_LEN_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_CODED_SUPPORT
default y
config BT_CTLR_PHY_2M_SUPPORT
default y
config ENTROPY_NRF_FORCE_ALT
default n
config ENTROPY_NRF5_RNG
default n
# Include Zephyr's Kconfig
source "Kconfig"

View file

@ -0,0 +1,40 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
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
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y
CONFIG_BT_CTLR_ADV_EXT=y
CONFIG_BT_CTLR_ADV_ISO=y
CONFIG_BT_CTLR_SYNC_ISO=y
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_CTLR_PERIPHERAL_ISO=y
CONFIG_BT_PER_ADV_SYNC=y
CONFIG_BT_EXT_ADV=y
CONFIG_BT_PER_ADV_SYNC_MAX=1

View file

@ -6,7 +6,6 @@
#include <zephyr/types.h>
#include <zephyr/ztest.h>
#include "kconfig.h"
#include <zephyr/bluetooth/hci.h>
#include <zephyr/sys/byteorder.h>
@ -26,7 +25,7 @@
#include "ll_settings.h"
#include "lll.h"
#include "lll_df_types.h"
#include "lll/lll_df_types.h"
#include "lll_conn.h"
#include "lll_conn_iso.h"
@ -43,9 +42,9 @@
#include "helper_pdu.h"
#include "helper_util.h"
struct ll_conn conn;
static struct ll_conn conn;
static void setup(void)
static void cis_terminate_setup(void *data)
{
test_setup(&conn);
}
@ -76,12 +75,12 @@ static void test_cis_terminate_rem(uint8_t role)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_cis_terminate_cen_rem(void)
ZTEST(cis_terminate, test_cis_terminate_cen_rem)
{
test_cis_terminate_rem(BT_HCI_ROLE_CENTRAL);
}
void test_cis_terminate_per_rem(void)
ZTEST(cis_terminate, test_cis_terminate_per_rem)
{
test_cis_terminate_rem(BT_HCI_ROLE_PERIPHERAL);
}
@ -149,24 +148,14 @@ void test_cis_terminate_loc(uint8_t role)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_cis_terminate_cen_loc(void)
ZTEST(cis_terminate, test_cis_terminate_cen_loc)
{
test_cis_terminate_loc(BT_HCI_ROLE_CENTRAL);
}
void test_cis_terminate_per_loc(void)
ZTEST(cis_terminate, test_cis_terminate_per_loc)
{
test_cis_terminate_loc(BT_HCI_ROLE_PERIPHERAL);
}
void test_main(void)
{
ztest_test_suite(
cis_term,
ztest_unit_test_setup_teardown(test_cis_terminate_cen_rem, setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_cis_terminate_per_rem, setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_cis_terminate_cen_loc, setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_cis_terminate_per_loc, setup, unit_test_noop));
ztest_run_test_suite(cis_term);
}
ZTEST_SUITE(cis_terminate, NULL, NULL, cis_terminate_setup, NULL, NULL);

View file

@ -4,12 +4,13 @@ cmake_minimum_required(VERSION 3.20.0)
project(bluetooth_ull_llcp_collision)
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/uut uut)
target_link_libraries(testbinary PRIVATE uut common)
target_sources(testbinary
PRIVATE
src/main.c
${ll_sw_sources}
${mock_sources}
${common_sources}
)

View file

@ -0,0 +1,29 @@
# Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# some of the control procedures in the BT LL depend on
# the following configs been set
config SOC_COMPATIBLE_NRF
default y
config BT_CTLR_DATA_LEN_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_CODED_SUPPORT
default y
config BT_CTLR_PHY_2M_SUPPORT
default y
config ENTROPY_NRF_FORCE_ALT
default n
config ENTROPY_NRF5_RNG
default n
# Include Zephyr's Kconfig
source "Kconfig"

View file

@ -0,0 +1,30 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
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
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y

View file

@ -6,7 +6,6 @@
#include <zephyr/types.h>
#include <zephyr/ztest.h>
#include "kconfig.h"
#define ULL_LLCP_UNITTEST
@ -28,7 +27,7 @@
#include "ll_settings.h"
#include "lll.h"
#include "lll_df_types.h"
#include "lll/lll_df_types.h"
#include "lll_conn.h"
#include "lll_conn_iso.h"
@ -92,7 +91,7 @@ struct pdu_data_llctrl_conn_param_rsp conn_param_rsp = { .interval_min = INTVL_M
struct pdu_data_llctrl_conn_param_req *req_B = &conn_param_req_B;
static void setup(void)
static void collision_setup(void *data)
{
test_setup(&conn);
@ -147,8 +146,7 @@ static bool is_instant_reached(struct ll_conn *conn, uint16_t instant)
return ((event_counter(conn) - instant) & 0xFFFF) <= 0x7FFF;
}
void test_phy_update_central_loc_collision(void)
ZTEST(collision, test_phy_update_central_loc_collision)
{
uint8_t err;
struct node_tx *tx;
@ -317,7 +315,7 @@ void test_phy_update_central_loc_collision(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_phy_update_central_rem_collision(void)
ZTEST(collision, test_phy_update_central_rem_collision)
{
uint8_t err;
struct node_tx *tx;
@ -489,7 +487,7 @@ void test_phy_update_central_rem_collision(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_phy_update_periph_loc_collision(void)
ZTEST(collision, test_phy_update_periph_loc_collision)
{
uint8_t err;
struct node_tx *tx;
@ -613,7 +611,7 @@ void test_phy_update_periph_loc_collision(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_phy_conn_update_central_loc_collision(void)
ZTEST(collision, test_phy_conn_update_central_loc_collision)
{
uint8_t err;
struct node_tx *tx;
@ -751,19 +749,4 @@ void test_phy_conn_update_central_loc_collision(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_main(void)
{
ztest_test_suite(
collision,
ztest_unit_test_setup_teardown(test_phy_update_central_loc_collision, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_phy_update_central_rem_collision, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_phy_update_periph_loc_collision, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_phy_conn_update_central_loc_collision, setup,
unit_test_noop));
ztest_run_test_suite(collision);
}
ZTEST_SUITE(collision, NULL, NULL, collision_setup, NULL, NULL);

View file

@ -2,13 +2,15 @@
cmake_minimum_required(VERSION 3.20.0)
project(bluetooth_ctrl_ull_conn)
project(bluetooth_ull_llcp_conn_update)
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/uut uut)
target_link_libraries(testbinary PRIVATE uut common)
target_sources(testbinary
PRIVATE
src/main.c
${ll_sw_sources}
${mock_sources}
${common_sources}
)

View file

@ -0,0 +1,29 @@
# Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# some of the control procedures in the BT LL depend on
# the following configs been set
config SOC_COMPATIBLE_NRF
default y
config BT_CTLR_DATA_LEN_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_CODED_SUPPORT
default y
config BT_CTLR_PHY_2M_SUPPORT
default y
config ENTROPY_NRF_FORCE_ALT
default n
config ENTROPY_NRF5_RNG
default n
# Include Zephyr's Kconfig
source "Kconfig"

View file

@ -0,0 +1,33 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
CONFIG_BT_HCI=y
CONFIG_BT_CTLR=y
CONFIG_BT_LL_SW_SPLIT=y
CONFIG_BT_MAX_CONN=4
CONFIG_BT_LLL_VENDOR_NORDIC=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_CTLR_PERIPHERAL_ISO=y
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_CTLR_CONN_PARAM_REQ=y
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
CONFIG_BT_CTLR_USER_EXT=y
CONFIG_BT_CTLR_USER_CPR_ANCHOR_POINT_MOVE=n
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y

View file

@ -0,0 +1,33 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
CONFIG_BT_HCI=y
CONFIG_BT_CTLR=y
CONFIG_BT_LL_SW_SPLIT=y
CONFIG_BT_MAX_CONN=4
CONFIG_BT_LLL_VENDOR_NORDIC=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_CTLR_PERIPHERAL_ISO=y
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_CTLR_CONN_PARAM_REQ=y
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
CONFIG_BT_CTLR_USER_EXT=y
CONFIG_BT_CTLR_USER_CPR_ANCHOR_POINT_MOVE=y
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y

View file

@ -0,0 +1,33 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
CONFIG_BT_HCI=y
CONFIG_BT_CTLR=y
CONFIG_BT_LL_SW_SPLIT=y
CONFIG_BT_MAX_CONN=4
CONFIG_BT_LLL_VENDOR_NORDIC=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_CTLR_PERIPHERAL_ISO=y
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_CTLR_CONN_PARAM_REQ=n
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
CONFIG_BT_CTLR_USER_EXT=y
CONFIG_BT_CTLR_USER_CPR_ANCHOR_POINT_MOVE=n
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y

View file

@ -1,13 +0,0 @@
/*
* Copyright (c) 2021 Demant
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Override common Kconfig settings
*/
#ifdef CONFIG_BT_CTLR_CONN_PARAM_REQ
#undef CONFIG_BT_CTLR_CONN_PARAM_REQ
#endif

View file

@ -1,13 +0,0 @@
/*
* Copyright (c) 2021 Demant
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Override common Kconfig settings
*/
#ifndef CONFIG_BT_CTLR_USER_CPR_ANCHOR_POINT_MOVE
#define CONFIG_BT_CTLR_USER_CPR_ANCHOR_POINT_MOVE
#endif

View file

@ -27,7 +27,7 @@
#include "ll_settings.h"
#include "lll.h"
#include "lll_df_types.h"
#include "lll/lll_df_types.h"
#include "lll_conn.h"
#include "lll_conn_iso.h"
@ -188,10 +188,15 @@ static bool test_get_feature_conn_param_req(struct ll_conn *conn)
}
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
static void setup(void)
static void conn_update_setup(void *data)
{
test_setup(&conn);
conn_param_req.reference_conn_event_count = -1;
#if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ)
conn_param_rsp.reference_conn_event_count = -1;
#endif
/* Initialize lll conn parameters (different from new) */
struct lll_conn *lll = &conn.lll;
@ -233,7 +238,7 @@ static bool is_instant_reached(struct ll_conn *conn, uint16_t instant)
* |<--------------------------| |
* | | |
*/
void test_conn_update_central_loc_accept(void)
ZTEST(central_loc, test_conn_update_central_loc_accept)
{
uint8_t err;
struct node_tx *tx;
@ -367,7 +372,7 @@ void test_conn_update_central_loc_accept(void)
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* | | |
*/
void test_conn_update_central_loc_accept_reject_2nd_cpr(void)
ZTEST(central_loc, test_conn_update_central_loc_accept_reject_2nd_cpr)
{
struct ll_conn conn_2nd;
struct ll_conn conn_3rd;
@ -392,7 +397,6 @@ void test_conn_update_central_loc_accept_reject_2nd_cpr(void)
test_set_role(&conn_2nd, BT_HCI_ROLE_PERIPHERAL);
/* Role */
test_set_role(&conn_3rd, BT_HCI_ROLE_PERIPHERAL);
/* Connect */
ull_cp_state_set(&conn, ULL_CP_CONNECTED);
@ -401,7 +405,6 @@ void test_conn_update_central_loc_accept_reject_2nd_cpr(void)
/* Connect */
ull_cp_state_set(&conn_3rd, ULL_CP_CONNECTED);
/* Initiate a Connection Parameter Request Procedure */
err = ull_cp_conn_update(&conn, INTVL_MIN, INTVL_MAX, LATENCY, TIMEOUT, NULL);
zassert_equal(err, BT_HCI_ERR_SUCCESS);
@ -608,7 +611,7 @@ void test_conn_update_central_loc_accept_reject_2nd_cpr(void)
* | | |
* | | |
*/
void test_conn_update_central_loc_invalid_param_rsp(void)
ZTEST(central_loc, test_conn_update_central_loc_invalid_param_rsp)
{
uint8_t err;
struct node_tx *tx;
@ -678,7 +681,7 @@ void test_conn_update_central_loc_invalid_param_rsp(void)
* | | |
* | | |
*/
void test_conn_update_central_loc_invalid_rsp(void)
ZTEST(central_loc, test_conn_update_central_loc_invalid_rsp)
{
uint8_t err;
struct node_tx *tx;
@ -746,7 +749,7 @@ void test_conn_update_central_loc_invalid_rsp(void)
* |<--------------------------| |
* | | |
*/
void test_conn_update_central_loc_reject(void)
ZTEST(central_loc, test_conn_update_central_loc_reject)
{
uint8_t err;
struct node_tx *tx;
@ -822,7 +825,7 @@ void test_conn_update_central_loc_reject(void)
* |<--------------------------| |
* | | |
*/
void test_conn_update_central_loc_remote_legacy(void)
ZTEST(central_loc, test_conn_update_central_loc_remote_legacy)
{
bool feature_bit_param_req;
uint8_t err;
@ -948,7 +951,7 @@ void test_conn_update_central_loc_remote_legacy(void)
* |<--------------------------| |
* | | |
*/
void test_conn_update_central_loc_unsupp_wo_feat_exch(void)
ZTEST(central_loc, test_conn_update_central_loc_unsupp_wo_feat_exch)
{
bool feature_bit_param_req;
uint8_t err;
@ -1067,7 +1070,7 @@ void test_conn_update_central_loc_unsupp_wo_feat_exch(void)
* |<--------------------------| |
* | | |
*/
void test_conn_update_central_loc_unsupp_w_feat_exch(void)
ZTEST(central_loc, test_conn_update_central_loc_unsupp_w_feat_exch)
{
uint8_t err;
struct node_tx *tx;
@ -1185,7 +1188,7 @@ void test_conn_update_central_loc_unsupp_w_feat_exch(void)
* |<--------------------------| |
* | | |
*/
void test_conn_update_central_loc_collision(void)
ZTEST(central_loc, test_conn_update_central_loc_collision)
{
uint8_t err;
struct node_tx *tx;
@ -1338,7 +1341,7 @@ void test_conn_update_central_loc_collision(void)
* |<--------------------------| |
* | | |
*/
void test_conn_update_central_rem_accept(void)
ZTEST(central_rem, test_conn_update_central_rem_accept)
{
struct node_tx *tx;
struct node_rx_pdu *ntf;
@ -1446,7 +1449,7 @@ void test_conn_update_central_rem_accept(void)
* | | |
* | | |
*/
void test_conn_update_central_rem_invalid_req(void)
ZTEST(central_rem, test_conn_update_central_rem_invalid_req)
{
struct node_tx *tx;
struct pdu_data_llctrl_reject_ext_ind reject_ext_ind = {
@ -1509,7 +1512,7 @@ void test_conn_update_central_rem_invalid_req(void)
* | |-------------------------->|
* | | |
*/
void test_conn_update_central_rem_reject(void)
ZTEST(central_rem, test_conn_update_central_rem_reject)
{
struct node_tx *tx;
struct node_rx_pdu *ntf;
@ -1630,7 +1633,7 @@ void test_conn_update_central_rem_reject(void)
* |<--------------------------| | (B)
* | | |
*/
void test_conn_update_central_rem_collision(void)
ZTEST(central_rem, test_conn_update_central_rem_collision)
{
uint8_t err;
struct node_tx *tx;
@ -1827,7 +1830,7 @@ void test_conn_update_central_rem_collision(void)
* |<--------------------------| |
* | | |
*/
void test_conn_update_periph_loc_accept(void)
ZTEST(periph_loc, test_conn_update_periph_loc_accept)
{
uint8_t err;
struct node_tx *tx;
@ -1848,6 +1851,7 @@ void test_conn_update_periph_loc_accept(void)
/* Prepare */
event_prepare(&conn);
conn_param_req.reference_conn_event_count = event_counter(&conn);
/* Tx Queue should have one LL Control PDU */
lt_rx(LL_CONNECTION_PARAM_REQ, &conn, &tx, &conn_param_req);
@ -1928,7 +1932,7 @@ void test_conn_update_periph_loc_accept(void)
* |<--------------------------| |
* | | |
*/
void test_conn_update_periph_loc_reject(void)
ZTEST(periph_loc, test_conn_update_periph_loc_reject)
{
uint8_t err;
struct node_tx *tx;
@ -1953,6 +1957,7 @@ void test_conn_update_periph_loc_reject(void)
/* Prepare */
event_prepare(&conn);
conn_param_req.reference_conn_event_count = event_counter(&conn);
/* Tx Queue should have one LL Control PDU */
lt_rx(LL_CONNECTION_PARAM_REQ, &conn, &tx, &conn_param_req);
@ -2008,7 +2013,7 @@ void test_conn_update_periph_loc_reject(void)
* |<--------------------------| |
* | | |
*/
void test_conn_update_periph_loc_unsupp_feat_wo_feat_exch(void)
ZTEST(periph_loc, test_conn_update_periph_loc_unsupp_feat_wo_feat_exch)
{
uint8_t err;
struct node_tx *tx;
@ -2032,6 +2037,7 @@ void test_conn_update_periph_loc_unsupp_feat_wo_feat_exch(void)
/* Prepare */
event_prepare(&conn);
conn_param_req.reference_conn_event_count = event_counter(&conn);
/* Tx Queue should have one LL Control PDU */
lt_rx(LL_CONNECTION_PARAM_REQ, &conn, &tx, &conn_param_req);
@ -2080,7 +2086,7 @@ void test_conn_update_periph_loc_unsupp_feat_wo_feat_exch(void)
* | |-------------------------->|
* | | |
*/
void test_conn_update_periph_loc_unsupp_feat_w_feat_exch(void)
ZTEST(periph_loc, test_conn_update_periph_loc_unsupp_feat_w_feat_exch)
{
uint8_t err;
@ -2165,7 +2171,7 @@ void test_conn_update_periph_loc_unsupp_feat_w_feat_exch(void)
* | Complete | |
* |<--------------------------| | (B)
*/
void test_conn_update_periph_loc_collision(void)
ZTEST(periph_loc, test_conn_update_periph_loc_collision)
{
uint8_t err;
struct node_tx *tx;
@ -2337,7 +2343,7 @@ void test_conn_update_periph_loc_collision(void)
* |<--------------------------| |
* | | |
*/
void test_conn_update_periph_rem_accept(void)
ZTEST(periph_rem, test_conn_update_periph_rem_accept)
{
struct node_tx *tx;
struct node_rx_pdu *ntf;
@ -2464,7 +2470,7 @@ void test_conn_update_periph_rem_accept(void)
* | | |
* | | |
*/
void test_conn_update_periph_rem_apm_accept_right_away(void)
ZTEST(periph_rem, test_conn_update_periph_rem_apm_accept_right_away)
{
#if defined(CONFIG_BT_CTLR_USER_CPR_ANCHOR_POINT_MOVE)
struct node_tx *tx;
@ -2611,7 +2617,7 @@ void test_conn_update_periph_rem_apm_accept_right_away(void)
* | | |
* | | |
*/
void test_conn_update_periph_rem_apm_reject_right_away(void)
ZTEST(periph_rem, test_conn_update_periph_rem_apm_reject_right_away)
{
#if defined(CONFIG_BT_CTLR_USER_CPR_ANCHOR_POINT_MOVE)
struct node_tx *tx;
@ -2726,7 +2732,7 @@ void test_conn_update_periph_rem_apm_reject_right_away(void)
* | | |
* | | |
*/
void test_conn_update_periph_rem_apm_accept_defered(void)
ZTEST(periph_rem, test_conn_update_periph_rem_apm_accept_defered)
{
#if defined(CONFIG_BT_CTLR_USER_CPR_ANCHOR_POINT_MOVE)
uint16_t offsets[6] = {
@ -2899,7 +2905,7 @@ void test_conn_update_periph_rem_apm_accept_defered(void)
* | | |
* | | |
*/
void test_conn_update_periph_rem_apm_reject_defered(void)
ZTEST(periph_rem, test_conn_update_periph_rem_apm_reject_defered)
{
#if defined(CONFIG_BT_CTLR_USER_CPR_ANCHOR_POINT_MOVE)
struct node_tx *tx;
@ -3072,7 +3078,7 @@ void test_conn_update_periph_rem_apm_reject_defered(void)
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* | | |
*/
void test_conn_update_periph_loc_collision_reject_2nd_cpr(void)
ZTEST(periph_loc, test_conn_update_periph_loc_collision_reject_2nd_cpr)
{
struct ll_conn conn_2nd;
struct ll_conn conn_3rd;
@ -3116,6 +3122,7 @@ void test_conn_update_periph_loc_collision_reject_2nd_cpr(void)
/* Prepare */
event_prepare(&conn);
conn_param_req.reference_conn_event_count = event_counter(&conn);
/* (A) Tx Queue should have one LL Control PDU */
lt_rx(LL_CONNECTION_PARAM_REQ, &conn, &tx1, &conn_param_req);
@ -3370,7 +3377,7 @@ void test_conn_update_periph_loc_collision_reject_2nd_cpr(void)
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* | | |
*/
void test_conn_update_periph_rem_accept_reject_2nd_cpr(void)
ZTEST(periph_rem, test_conn_update_periph_rem_accept_reject_2nd_cpr)
{
uint8_t err;
struct ll_conn conn_2nd;
@ -3604,7 +3611,7 @@ void test_conn_update_periph_rem_accept_reject_2nd_cpr(void)
* | | |
* | | |
*/
void test_conn_update_periph_rem_invalid_req(void)
ZTEST(periph_rem, test_conn_update_periph_rem_invalid_req)
{
struct node_tx *tx;
struct pdu_data_llctrl_reject_ext_ind reject_ext_ind = {
@ -3673,7 +3680,7 @@ void test_conn_update_periph_rem_invalid_req(void)
* | | |
* | | |
*/
void test_conn_update_periph_rem_invalid_ind(void)
ZTEST(periph_rem, test_conn_update_periph_rem_invalid_ind)
{
struct node_tx *tx;
struct node_rx_pdu *ntf;
@ -3900,7 +3907,7 @@ void test_conn_update_periph_rem_invalid_ind(void)
* | |-------------------------->|
* | | |
*/
void test_conn_update_periph_rem_reject(void)
ZTEST(periph_rem, test_conn_update_periph_rem_reject)
{
struct node_tx *tx;
struct node_rx_pdu *ntf;
@ -4024,7 +4031,7 @@ void test_conn_update_periph_rem_reject(void)
* |<--------------------------| | (B)
* | | |
*/
void test_conn_update_periph_rem_collision(void)
ZTEST(periph_rem, test_conn_update_periph_rem_collision)
{
uint8_t err;
struct node_tx *tx;
@ -4069,7 +4076,6 @@ void test_conn_update_periph_rem_collision(void)
event_done(&conn);
/*******************/
/* (A) There should be one host notification */
ut_rx_pdu(LL_CONNECTION_PARAM_REQ, &ntf, &conn_param_req);
ut_rx_q_is_empty();
@ -4086,6 +4092,7 @@ void test_conn_update_periph_rem_collision(void)
/* Prepare */
event_prepare(&conn);
conn_param_rsp.reference_conn_event_count = conn_param_req.reference_conn_event_count;
/* (A) Tx Queue should have one LL Control PDU */
lt_rx(LL_CONNECTION_PARAM_RSP, &conn, &tx, &conn_param_rsp);
@ -4187,7 +4194,7 @@ void test_conn_update_periph_rem_collision(void)
zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free());
}
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
#else /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
/*
* Parameter Request Procedure not supported.
@ -4214,7 +4221,7 @@ void test_conn_update_periph_rem_collision(void)
* | not receive a ntf.) | |
* | | |
*/
void test_conn_update_central_loc_accept_no_param_req(void)
ZTEST(central_loc_no_param_req, test_conn_update_central_loc_accept_no_param_req)
{
uint8_t err;
struct node_tx *tx;
@ -4321,7 +4328,7 @@ void test_conn_update_central_loc_accept_no_param_req(void)
* | | |
* | | |
*/
void test_conn_update_central_rem_unknown_no_param_req(void)
ZTEST(central_rem_no_param_req, test_conn_update_central_rem_unknown_no_param_req)
{
struct node_tx *tx;
@ -4407,7 +4414,7 @@ void test_conn_update_central_rem_unknown_no_param_req(void)
* | | |
* | | |
*/
void test_conn_update_periph_rem_unknown_no_param_req(void)
ZTEST(periph_rem_no_param_req, test_conn_update_periph_rem_unknown_no_param_req)
{
struct node_tx *tx;
@ -4471,7 +4478,7 @@ void test_conn_update_periph_rem_unknown_no_param_req(void)
* | not receive a ntf.) | |
* | | |
*/
void test_conn_update_periph_rem_accept_no_param_req(void)
ZTEST(periph_rem_no_param_req, test_conn_update_periph_rem_accept_no_param_req)
{
struct node_rx_pdu *ntf;
uint16_t instant;
@ -4555,7 +4562,7 @@ void test_conn_update_periph_rem_accept_no_param_req(void)
* |<--------------------------| |
* | | |
*/
void test_conn_update_periph_loc_disallowed_no_param_req(void)
ZTEST(periph_loc_no_param_req, test_conn_update_periph_loc_disallowed_no_param_req)
{
uint8_t err;
@ -4584,108 +4591,16 @@ void test_conn_update_periph_loc_disallowed_no_param_req(void)
zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free());
}
#endif
void test_main(void)
{
#if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ)
ztest_test_suite(
central_loc,
ztest_unit_test_setup_teardown(test_conn_update_central_loc_accept,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_central_loc_invalid_param_rsp,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_central_loc_invalid_rsp,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_central_loc_reject,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_central_loc_accept_reject_2nd_cpr,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_central_loc_remote_legacy,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_central_loc_unsupp_wo_feat_exch,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_central_loc_unsupp_w_feat_exch,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_central_loc_collision,
setup, unit_test_noop));
ztest_test_suite(central_rem,
ztest_unit_test_setup_teardown(test_conn_update_central_rem_accept,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_central_rem_invalid_req,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_central_rem_reject,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_central_rem_collision,
setup, unit_test_noop));
ztest_test_suite(
periph_loc,
ztest_unit_test_setup_teardown(test_conn_update_periph_loc_accept,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_periph_loc_reject,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_periph_loc_unsupp_feat_wo_feat_exch,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_periph_loc_unsupp_feat_w_feat_exch,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_periph_loc_collision_reject_2nd_cpr,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_periph_loc_collision,
setup, unit_test_noop));
ztest_test_suite(
periph_rem,
ztest_unit_test_setup_teardown(test_conn_update_periph_rem_accept,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_periph_rem_apm_accept_right_away,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_periph_rem_apm_reject_right_away,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_periph_rem_apm_accept_defered,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_periph_rem_apm_reject_defered,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_periph_rem_invalid_req,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_periph_rem_invalid_ind,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_periph_rem_collision,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_periph_rem_accept_reject_2nd_cpr,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_conn_update_periph_rem_reject,
setup, unit_test_noop));
ztest_run_test_suite(central_loc);
ztest_run_test_suite(central_rem);
ztest_run_test_suite(periph_loc);
ztest_run_test_suite(periph_rem);
#else /* !CONFIG_BT_CTLR_CONN_PARAM_REQ */
ztest_test_suite(central_loc_no_param_req, ztest_unit_test_setup_teardown(
test_conn_update_central_loc_accept_no_param_req,
setup, unit_test_noop));
ztest_test_suite(central_rem_no_param_req, ztest_unit_test_setup_teardown(
test_conn_update_central_rem_unknown_no_param_req,
setup, unit_test_noop));
ztest_test_suite(
periph_loc_no_param_req,
ztest_unit_test_setup_teardown(test_conn_update_periph_loc_disallowed_no_param_req,
setup, unit_test_noop));
ztest_test_suite(periph_rem_no_param_req,
ztest_unit_test_setup_teardown(
test_conn_update_periph_rem_accept_no_param_req,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(
test_conn_update_periph_rem_unknown_no_param_req,
setup, unit_test_noop));
ztest_run_test_suite(central_loc_no_param_req);
ztest_run_test_suite(central_rem_no_param_req);
ztest_run_test_suite(periph_loc_no_param_req);
ztest_run_test_suite(periph_rem_no_param_req);
ZTEST_SUITE(central_loc, NULL, NULL, conn_update_setup, NULL, NULL);
ZTEST_SUITE(central_rem, NULL, NULL, conn_update_setup, NULL, NULL);
ZTEST_SUITE(periph_loc, NULL, NULL, conn_update_setup, NULL, NULL);
ZTEST_SUITE(periph_rem, NULL, NULL, conn_update_setup, NULL, NULL);
#else
ZTEST_SUITE(central_loc_no_param_req, NULL, NULL, conn_update_setup, NULL, NULL);
ZTEST_SUITE(central_rem_no_param_req, NULL, NULL, conn_update_setup, NULL, NULL);
ZTEST_SUITE(periph_loc_no_param_req, NULL, NULL, conn_update_setup, NULL, NULL);
ZTEST_SUITE(periph_rem_no_param_req, NULL, NULL, conn_update_setup, NULL, NULL);
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
}

View file

@ -6,8 +6,8 @@ tests:
bluetooth.controller.ctrl_conn_update.apm_test:
type: unit
extra_args: KCONFIG_OVERRIDE_FILE="kconfig_override_apm.h"
extra_args: CONF_FILE=prj_apm.conf
bluetooth.controller.ctrl_conn_update.no_param_req_test:
type: unit
extra_args: KCONFIG_OVERRIDE_FILE="kconfig_override.h"
extra_args: CONF_FILE=prj_no_param_req.conf

View file

@ -1,18 +1,16 @@
#
# Copyright (c) 2021 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.20.0)
project(bluetooth_ull_llcp_le_cte_req)
project(bluetooth_ull_llcp_cte_req)
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/uut uut)
target_link_libraries(testbinary PRIVATE uut common)
target_sources(testbinary
PRIVATE
src/main.c
${ll_sw_sources}
${mock_sources}
${common_sources}
)
set(CMAKE_BUILD_TYPE Debug)

View file

@ -0,0 +1,47 @@
# Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# some of the control procedures in the BT LL depend on
# the following configs been set
config SOC_COMPATIBLE_NRF
default y
config BT_CTLR_DATA_LEN_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_CODED_SUPPORT
default y
config BT_CTLR_PHY_2M_SUPPORT
default y
config BT_CTLR_DF_SUPPORT
default y
config BT_CTLR_DF_CTE_TX_SUPPORT
default y
config BT_CTLR_DF_CTE_RX_SUPPORT
default y
config BT_CTLR_DF_CTE_RX_SAMPLE_1US_SUPPORT
default y
config BT_CTLR_DF_ANT_SWITCH_1US_SUPPORT
default y
config BT_CTLR_DF_ANT_SWITCH_2US_SUPPORT
default y
config ENTROPY_NRF_FORCE_ALT
default n
config ENTROPY_NRF5_RNG
default n
# Include Zephyr's Kconfig
source "Kconfig"

View file

@ -0,0 +1,47 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
CONFIG_BT_HCI=y
CONFIG_BT_CTLR=y
CONFIG_BT_LL_SW_SPLIT=y
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_LLL_VENDOR_NORDIC=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_CTLR_PERIPHERAL_ISO=y
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y
CONFIG_BT_DATA_LEN_UPDATE=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_CTLR_DF=y
CONFIG_BT_CTLR_DF_CTE_TX=y
CONFIG_BT_CTLR_DF_CTE_RX_SAMPLE_1US=y
CONFIG_BT_CTLR_DF_ANT_SWITCH_1US=y
CONFIG_BT_CTLR_DF_CONN_CTE_RX=y
CONFIG_BT_CTLR_DF_CONN_CTE_TX=y
CONFIG_BT_CTLR_DF_CONN_CTE_REQ=y
CONFIG_BT_CTLR_DF_CONN_CTE_RSP=y
CONFIG_BT_CTLR_DF_ANT_SWITCH_TX=y
CONFIG_BT_CTLR_DF_CTE_RX=y

View file

@ -6,7 +6,6 @@
#include <zephyr/types.h>
#include <zephyr/ztest.h>
#include "kconfig.h"
#include <zephyr/bluetooth/hci.h>
#include <zephyr/sys/byteorder.h>
@ -27,7 +26,7 @@
#include "lll.h"
#include "ll_feat.h"
#include "lll_df_types.h"
#include "lll/lll_df_types.h"
#include "lll_conn.h"
#include "lll_conn_iso.h"
@ -44,9 +43,9 @@
#include "helper_pdu.h"
#include "helper_util.h"
struct ll_conn conn;
static struct ll_conn conn;
static void setup(void *data)
static void cte_req_setup(void *data)
{
test_setup(&conn);
@ -56,7 +55,7 @@ static void setup(void *data)
static void fex_setup(void *data)
{
setup(data);
cte_req_setup(data);
/* Emulate valid feature exchange and all features valid for local and peer devices */
memset(&conn.llcp.fex, 0, sizeof(conn.llcp.fex));
@ -1475,5 +1474,5 @@ ZTEST(cte_req_after_fex, test_peripheral_cte_req_wait_for_remote_phy_update_comp
test_cte_req_wait_for_remote_phy_update_complete(BT_HCI_ROLE_PERIPHERAL);
}
ZTEST_SUITE(cte_req, NULL, NULL, setup, NULL, NULL);
ZTEST_SUITE(cte_req, NULL, NULL, cte_req_setup, NULL, NULL);
ZTEST_SUITE(cte_req_after_fex, NULL, NULL, fex_setup, NULL, NULL);

View file

@ -3,5 +3,3 @@ common:
tests:
bluetooth.controller.ctrl_cte_req.test:
type: unit
extra_configs:
- CONFIG_ZTEST_NEW_API=y

View file

@ -2,24 +2,15 @@
cmake_minimum_required(VERSION 3.20.0)
if(CONFIG_BT_CTLR_PHY_CODED)
add_compile_definitions(CONFIG_BT_CTLR_PHY_CODED)
endif(CONFIG_BT_CTLR_PHY_CODED)
if(CONFIG_BT_CTLR_PHY)
add_compile_definitions(CONFIG_BT_CTLR_PHY)
endif(CONFIG_BT_CTLR_PHY)
project(bluetooth_ull_llcp_data_length_update)
find_package(Zephyr COMPONENTS unittest HINTS $ENV{ZEPHYR_BASE})
include(${ZEPHYR_BASE}/tests/bluetooth/controller/common/defaults_cmake.txt)
if(NOT CONFIG_BT_CTLR_PHY)
list(REMOVE_ITEM ll_sw_sources ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/ull_llcp_phy.c)
endif()
add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/controller/common common)
add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/controller/uut uut)
target_link_libraries(testbinary PRIVATE uut common)
target_sources(testbinary
PRIVATE
src/main.c
${ll_sw_sources}
${mock_sources}
${common_sources}
)

View file

@ -1,19 +1,29 @@
# Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) 2022, Nordic Semiconductor ASA
config BT_CTLR_PHY
prompt "Bluetooth 5.0 phy"
help
This is generally a hidden symbol but for unit testing a prompt is
defined to allow controlling this setting in the build.
# some of the control procedures in the BT LL depend on
# the following configs been set
config BT_CTLR_PHY_CODED
bool "Coded PHY Support"
depends on BT_CTLR_PHY
help
This is symbol generally has more dependencies but to allow for easy
unit testing of this source module the Kconfig setting allows to strip
extra dependencies.
config SOC_COMPATIBLE_NRF
default y
source "Kconfig.zephyr"
config BT_CTLR_DATA_LEN_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_CODED_SUPPORT
default y
config BT_CTLR_PHY_2M_SUPPORT
default y
config ENTROPY_NRF_FORCE_ALT
default n
config ENTROPY_NRF5_RNG
default n
# Include Zephyr's Kconfig
source "Kconfig"

View file

@ -0,0 +1,37 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
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
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_DATA_LEN_UPDATE=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y

View file

@ -0,0 +1,37 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
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
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_DATA_LEN_UPDATE=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=n

View file

@ -0,0 +1,35 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
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
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_DATA_LEN_UPDATE=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=n

View file

@ -1,14 +0,0 @@
/*
* Copyright (c) 2020 Demant
* Copyright (c) 2020 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Common Kconfig settings
*/
#ifdef CONFIG_BT_CTLR_PHY
#undef CONFIG_BT_CTLR_PHY
#endif

View file

@ -29,7 +29,7 @@
#include "ll_settings.h"
#include "lll.h"
#include "lll_df_types.h"
#include "lll/lll_df_types.h"
#include "lll_conn.h"
#include "lll_conn_iso.h"
@ -49,9 +49,9 @@
#include "helper_util.h"
#include "helper_features.h"
struct ll_conn conn;
static struct ll_conn conn;
static void setup(void)
static void dle_setup(void *data)
{
test_setup(&conn);
}
@ -79,7 +79,7 @@ static void setup(void)
* | | |
*/
void test_data_length_update_central_loc(void)
ZTEST(dle_central, test_data_length_update_central_loc)
{
uint8_t err;
struct node_tx *tx;
@ -157,7 +157,7 @@ void test_data_length_update_central_loc(void)
* | | |
* | | |
*/
void test_data_length_update_central_loc_unknown_rsp(void)
ZTEST(dle_central, test_data_length_update_central_loc_unknown_rsp)
{
uint8_t err;
struct node_tx *tx;
@ -228,7 +228,7 @@ void test_data_length_update_central_loc_unknown_rsp(void)
* | | |
* | | |
*/
void test_data_length_update_central_loc_invalid_rsp(void)
ZTEST(dle_central, test_data_length_update_central_loc_invalid_rsp)
{
uint8_t err;
struct node_tx *tx;
@ -337,7 +337,7 @@ void test_data_length_update_central_loc_invalid_rsp(void)
* | |<-----------------------------|
* | | |
*/
void test_data_length_update_central_loc_no_eff_change(void)
ZTEST(dle_central, test_data_length_update_central_loc_no_eff_change)
{
uint8_t err;
struct node_tx *tx;
@ -409,7 +409,7 @@ void test_data_length_update_central_loc_no_eff_change(void)
* | | |
*/
void test_data_length_update_central_loc_no_eff_change2(void)
ZTEST(dle_central, test_data_length_update_central_loc_no_eff_change2)
{
uint8_t err;
struct node_tx *tx;
@ -477,7 +477,7 @@ void test_data_length_update_central_loc_no_eff_change2(void)
conn.lll.event_counter);
}
void test_data_length_update_periph_loc(void)
ZTEST(dle_periph, test_data_length_update_periph_loc)
{
uint64_t err;
struct node_tx *tx;
@ -538,7 +538,7 @@ void test_data_length_update_periph_loc(void)
* | | |
*/
void test_data_length_update_central_rem(void)
ZTEST(dle_central, test_data_length_update_central_rem)
{
struct node_tx *tx;
@ -597,7 +597,7 @@ void test_data_length_update_central_rem(void)
* | | |
*/
void test_data_length_update_periph_rem(void)
ZTEST(dle_periph, test_data_length_update_periph_rem)
{
struct node_tx *tx;
@ -672,7 +672,7 @@ void test_data_length_update_periph_rem(void)
* | | |
*/
void test_data_length_update_periph_rem_and_loc(void)
ZTEST(dle_periph, test_data_length_update_periph_rem_and_loc)
{
uint64_t err;
struct node_tx *tx;
@ -737,7 +737,7 @@ void test_data_length_update_periph_rem_and_loc(void)
ut_rx_q_is_empty();
}
void test_data_length_update_dle_max_time_get(void)
ZTEST(dle_util, test_data_length_update_dle_max_time_get)
{
uint16_t max_time = 0xffff;
uint16_t max_octets = 211;
@ -833,37 +833,6 @@ void test_data_length_update_dle_max_time_get(void)
#endif
}
void test_main(void)
{
ztest_test_suite(
data_length_update_central,
ztest_unit_test_setup_teardown(test_data_length_update_central_loc, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_data_length_update_central_loc_unknown_rsp,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_data_length_update_central_loc_invalid_rsp,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_data_length_update_central_loc_no_eff_change,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_data_length_update_central_loc_no_eff_change2,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_data_length_update_central_rem, setup,
unit_test_noop));
ztest_test_suite(data_length_update_peripheral,
ztest_unit_test_setup_teardown(test_data_length_update_periph_loc, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_data_length_update_periph_rem, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_data_length_update_periph_rem_and_loc,
setup, unit_test_noop)
);
ztest_test_suite(data_length_update_util,
ztest_unit_test_setup_teardown(test_data_length_update_dle_max_time_get,
setup, unit_test_noop));
ztest_run_test_suite(data_length_update_central);
ztest_run_test_suite(data_length_update_peripheral);
ztest_run_test_suite(data_length_update_util);
}
ZTEST_SUITE(dle_central, NULL, NULL, dle_setup, NULL, NULL);
ZTEST_SUITE(dle_periph, NULL, NULL, dle_setup, NULL, NULL);
ZTEST_SUITE(dle_util, NULL, NULL, dle_setup, NULL, NULL);

View file

@ -3,10 +3,11 @@ common:
tests:
bluetooth.controller.ctrl_data_length_update.test:
type: unit
extra_args: CONFIG_BT_CTLR_PHY=y
bluetooth.controller.ctrl_data_length_update.test_codedphy:
bluetooth.controller.ctrl_data_length_update.test_nocodedphy:
type: unit
extra_args: CONFIG_BT_CTLR_PHY=y CONFIG_BT_CTLR_PHY_CODED=y
extra_args: CONF_FILE=prj_nocoded.conf
bluetooth.controller.ctrl_data_length_update.test_nophy:
type: unit
extra_args: KCONFIG_OVERRIDE_FILE="kconfig_override.h"
extra_args: CONF_FILE=prj_nophy.conf

View file

@ -4,11 +4,13 @@ cmake_minimum_required(VERSION 3.20.0)
project(bluetooth_ull_llcp_encrypt)
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/uut uut)
target_link_libraries(testbinary PRIVATE uut common)
target_sources(testbinary
PRIVATE
src/main.c
${ll_sw_sources}
${mock_sources}
${common_sources}
)

View file

@ -0,0 +1,29 @@
# Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# some of the control procedures in the BT LL depend on
# the following configs been set
config SOC_COMPATIBLE_NRF
default y
config BT_CTLR_DATA_LEN_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_CODED_SUPPORT
default y
config BT_CTLR_PHY_2M_SUPPORT
default y
config ENTROPY_NRF_FORCE_ALT
default n
config ENTROPY_NRF5_RNG
default n
# Include Zephyr's Kconfig
source "Kconfig"

View file

@ -0,0 +1,37 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
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
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_DATA_LEN_UPDATE=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y

View file

@ -6,7 +6,6 @@
#include <zephyr/types.h>
#include <zephyr/ztest.h>
#include "kconfig.h"
#define ULL_LLCP_UNITTEST
@ -29,7 +28,7 @@
#include "ll_settings.h"
#include "lll.h"
#include "lll_df_types.h"
#include "lll/lll_df_types.h"
#include "lll_conn.h"
#include "lll_conn_iso.h"
@ -96,9 +95,9 @@
zassert_equal(_conn.lll.ccm_tx.direction, _dir, "CCM Tx Direction is wrong");\
} while (0)
struct ll_conn conn;
static struct ll_conn conn;
static void setup(void)
static void enc_setup(void *data)
{
test_setup(&conn);
@ -179,7 +178,7 @@ int lll_csrand_get(void *buf, size_t len)
* |<---------------------------| |
* | | |
*/
void test_encryption_start_central_loc(void)
ZTEST(encryption_start, test_encryption_start_central_loc)
{
uint8_t err;
struct node_tx *tx;
@ -336,7 +335,7 @@ void test_encryption_start_central_loc(void)
* |<---------------------------| |
* | | |
*/
void test_encryption_start_central_loc_limited_memory(void)
ZTEST(encryption_start, test_encryption_start_central_loc_limited_memory)
{
uint8_t err;
struct node_tx *tx;
@ -548,7 +547,7 @@ void test_encryption_start_central_loc_limited_memory(void)
* |<---------------------------| |
* | | |
*/
void test_encryption_start_central_loc_reject_ext(void)
ZTEST(encryption_start, test_encryption_start_central_loc_reject_ext)
{
uint8_t err;
struct node_tx *tx;
@ -650,7 +649,7 @@ void test_encryption_start_central_loc_reject_ext(void)
* |<---------------------------| |
* | | |
*/
void test_encryption_start_central_loc_reject(void)
ZTEST(encryption_start, test_encryption_start_central_loc_reject)
{
uint8_t err;
struct node_tx *tx;
@ -750,7 +749,7 @@ void test_encryption_start_central_loc_reject(void)
* |<---------------------------| |
* | | |
*/
void test_encryption_start_central_loc_no_ltk(void)
ZTEST(encryption_start, test_encryption_start_central_loc_no_ltk)
{
uint8_t err;
struct node_tx *tx;
@ -861,7 +860,7 @@ void test_encryption_start_central_loc_no_ltk(void)
* |<---------------------------| |
* | | |
*/
void test_encryption_start_central_loc_no_ltk_2(void)
ZTEST(encryption_start, test_encryption_start_central_loc_no_ltk_2)
{
uint8_t err;
struct node_tx *tx;
@ -967,7 +966,7 @@ void test_encryption_start_central_loc_no_ltk_2(void)
* |<---------------------------| |
* | | |
*/
void test_encryption_start_central_loc_mic(void)
ZTEST(encryption_start, test_encryption_start_central_loc_mic)
{
uint8_t err;
struct node_tx *tx;
@ -1112,7 +1111,7 @@ void test_encryption_start_central_loc_mic(void)
* | |---------------| | |
* | | |
*/
void test_encryption_start_periph_rem(void)
ZTEST(encryption_start, test_encryption_start_periph_rem)
{
struct node_tx *tx;
struct node_rx_pdu *ntf;
@ -1328,7 +1327,7 @@ void test_encryption_start_periph_rem(void)
* | |---------------| | |
* | | |
*/
void test_encryption_start_periph_rem_limited_memory(void)
ZTEST(encryption_start, test_encryption_start_periph_rem_limited_memory)
{
struct node_tx *tx;
struct node_rx_pdu *ntf;
@ -1607,7 +1606,7 @@ void test_encryption_start_periph_rem_limited_memory(void)
* | | LL_REJECT_EXT_IND |
* | |-------------------->|
*/
void test_encryption_start_periph_rem_no_ltk(void)
ZTEST(encryption_start, test_encryption_start_periph_rem_no_ltk)
{
struct node_tx *tx;
struct node_rx_pdu *ntf;
@ -1746,7 +1745,7 @@ void test_encryption_start_periph_rem_no_ltk(void)
* | |<--------------------|
* | | |
*/
void test_encryption_start_periph_rem_mic(void)
ZTEST(encryption_start, test_encryption_start_periph_rem_mic)
{
struct node_tx *tx;
struct node_rx_pdu *ntf;
@ -1879,7 +1878,7 @@ void test_encryption_start_periph_rem_mic(void)
}
void test_encryption_pause_central_loc(void)
ZTEST(encryption_pause, test_encryption_pause_central_loc)
{
uint8_t err;
struct node_tx *tx;
@ -2025,7 +2024,7 @@ void test_encryption_pause_central_loc(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_encryption_pause_periph_rem(void)
ZTEST(encryption_pause, test_encryption_pause_periph_rem)
{
struct node_tx *tx;
struct node_rx_pdu *ntf;
@ -2196,39 +2195,5 @@ void test_encryption_pause_periph_rem(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_main(void)
{
ztest_test_suite(
encryption_start,
ztest_unit_test_setup_teardown(test_encryption_start_central_loc, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_encryption_start_central_loc_limited_memory,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_encryption_start_central_loc_reject_ext, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_encryption_start_central_loc_reject, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_encryption_start_central_loc_no_ltk, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_encryption_start_central_loc_no_ltk_2, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_encryption_start_central_loc_mic, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_encryption_start_periph_rem, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_encryption_start_periph_rem_limited_memory,
setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_encryption_start_periph_rem_no_ltk, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_encryption_start_periph_rem_mic, setup,
unit_test_noop));
ztest_test_suite(encryption_pause,
ztest_unit_test_setup_teardown(test_encryption_pause_central_loc, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_encryption_pause_periph_rem, setup,
unit_test_noop));
ztest_run_test_suite(encryption_start);
ztest_run_test_suite(encryption_pause);
}
ZTEST_SUITE(encryption_start, NULL, NULL, enc_setup, NULL, NULL);
ZTEST_SUITE(encryption_pause, NULL, NULL, enc_setup, NULL, NULL);

View file

@ -7,6 +7,9 @@
config SOC_COMPATIBLE_NRF
default y
config BT_CTLR_DATA_LEN_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_UPDATE_SUPPORT
default y

View file

@ -2,13 +2,15 @@
cmake_minimum_required(VERSION 3.20.0)
project(bluetooth_ull_llcp_feature_exchange)
project(bluetooth_ull_llcp_hci_api)
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/uut uut)
target_link_libraries(testbinary PRIVATE uut common)
target_sources(testbinary
PRIVATE
src/main.c
${ll_sw_sources}
${mock_sources}
${common_sources}
)

View file

@ -0,0 +1,29 @@
# Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# some of the control procedures in the BT LL depend on
# the following configs been set
config SOC_COMPATIBLE_NRF
default y
config BT_CTLR_DATA_LEN_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_CODED_SUPPORT
default y
config BT_CTLR_PHY_2M_SUPPORT
default y
config ENTROPY_NRF_FORCE_ALT
default n
config ENTROPY_NRF5_RNG
default n
# Include Zephyr's Kconfig
source "Kconfig"

View file

@ -1,4 +1,38 @@
CONFIG_TEST=y
CONFIG_ZTEST=y
CONFIG_ZTEST_ASSERT_VERBOSE=1
CONFIG_ZTEST_STACK_SIZE=4096
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
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
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_MAX_CONN=4
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_DATA_LEN_UPDATE=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_CTLR_CONN_RSSI=y
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y

View file

@ -7,7 +7,6 @@
#include <zephyr/types.h>
#include <zephyr/sys/byteorder.h>
#include <zephyr/ztest.h>
#include "kconfig.h"
#define ULL_LLCP_UNITTEST
@ -29,7 +28,7 @@
#include "ll_settings.h"
#include "lll.h"
#include "lll_df_types.h"
#include "lll/lll_df_types.h"
#include "lll_conn.h"
#include "lll_conn_iso.h"
@ -50,9 +49,9 @@
#include "helper_util.h"
#include "helper_features.h"
struct ll_conn *conn_from_pool;
static struct ll_conn *conn_from_pool;
static void setup(void)
static void hci_setup(void *data)
{
ull_conn_init();
@ -82,7 +81,7 @@ static void setup(void)
* |<---------------------------| |
* | | |
*/
void test_hci_feature_exchange(void)
ZTEST(hci_fex, test_hci_feature_exchange)
{
uint64_t err;
uint64_t set_feature = DEFAULT_FEATURE;
@ -126,7 +125,7 @@ void test_hci_feature_exchange(void)
ll_conn_release(conn_from_pool);
}
void test_hci_feature_exchange_wrong_handle(void)
ZTEST(hci_fex, test_hci_feature_exchange_wrong_handle)
{
uint16_t conn_handle;
uint64_t err;
@ -150,7 +149,7 @@ void test_hci_feature_exchange_wrong_handle(void)
zassert_equal(err, BT_HCI_ERR_CMD_DISALLOWED, "Wrong reply for no-resource condition\n");
}
void test_hci_version_ind(void)
ZTEST(hci_version, test_hci_version_ind)
{
uint64_t err;
uint16_t conn_handle;
@ -192,7 +191,7 @@ void test_hci_version_ind(void)
ll_conn_release(conn_from_pool);
}
void test_hci_version_ind_wrong_handle(void)
ZTEST(hci_version, test_hci_version_ind_wrong_handle)
{
uint16_t conn_handle;
uint64_t err;
@ -215,7 +214,7 @@ void test_hci_version_ind_wrong_handle(void)
zassert_equal(err, BT_HCI_ERR_CMD_DISALLOWED, "Wrong reply for no-resource condition\n");
}
void test_hci_apto(void)
ZTEST(hci_apto, test_hci_apto)
{
uint16_t conn_handle;
uint64_t err;
@ -246,7 +245,7 @@ void test_hci_apto(void)
zassert_equal(err, BT_HCI_ERR_UNKNOWN_CONN_ID);
}
void test_hci_phy(void)
ZTEST(hci_phy, test_hci_phy)
{
uint16_t conn_handle;
uint64_t err;
@ -293,7 +292,7 @@ void test_hci_phy(void)
zassert_equal(phy_rx, 0x03);
}
void test_hci_dle(void)
ZTEST(hci_dle, test_hci_dle)
{
uint16_t conn_handle;
uint64_t err;
@ -340,7 +339,7 @@ void test_hci_dle(void)
zassert_equal(max_tx_time, 0x3FF);
}
void test_hci_terminate(void)
ZTEST(hci_terminate, test_hci_terminate)
{
uint16_t conn_handle;
uint64_t err;
@ -364,7 +363,7 @@ void test_hci_terminate(void)
}
void test_hci_conn_update(void)
ZTEST(hci_conn_update, test_hci_conn_update)
{
uint16_t conn_handle;
uint8_t err;
@ -428,7 +427,7 @@ void test_hci_conn_update(void)
/* 'Define' out Central API tests because ull_central.c is mock'ed, so API is not supported */
#define ULL_CENTRAL_MOCKED
void test_hci_chmap(void)
ZTEST(hci_channelmap, test_hci_chmap)
{
#ifndef ULL_CENTRAL_MOCKED
uint16_t conn_handle;
@ -469,7 +468,7 @@ void test_hci_chmap(void)
#endif /* !defined(ULL_CENTRAL_MOCKED) */
}
void test_hci_rssi(void)
ZTEST(hci_rssi, test_hci_rssi)
{
uint16_t conn_handle;
uint64_t err;
@ -492,7 +491,7 @@ void test_hci_rssi(void)
zassert_equal(rssi, 0xcd, "RSSI %d", err);
}
void test_hci_enc(void)
ZTEST(hci_encryption, test_hci_enc)
{
#ifndef ULL_CENTRAL_MOCKED
uint16_t conn_handle;
@ -524,26 +523,13 @@ void test_hci_enc(void)
#endif /* !defined(ULL_CENTRAL_MOCKED) */
}
void test_main(void)
{
ztest_test_suite(
hci_interface,
ztest_unit_test_setup_teardown(test_hci_feature_exchange, setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_hci_feature_exchange_wrong_handle, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_hci_version_ind, setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_hci_version_ind_wrong_handle, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_hci_apto, setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_hci_phy, setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_hci_dle, setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_hci_terminate, setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_hci_conn_update, setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_hci_chmap, setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_hci_enc, setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_hci_rssi, setup, unit_test_noop)
);
ztest_run_test_suite(hci_interface);
}
ZTEST_SUITE(hci_fex, NULL, NULL, hci_setup, NULL, NULL);
ZTEST_SUITE(hci_version, NULL, NULL, hci_setup, NULL, NULL);
ZTEST_SUITE(hci_apto, NULL, NULL, hci_setup, NULL, NULL);
ZTEST_SUITE(hci_phy, NULL, NULL, hci_setup, NULL, NULL);
ZTEST_SUITE(hci_dle, NULL, NULL, hci_setup, NULL, NULL);
ZTEST_SUITE(hci_terminate, NULL, NULL, hci_setup, NULL, NULL);
ZTEST_SUITE(hci_conn_update, NULL, NULL, hci_setup, NULL, NULL);
ZTEST_SUITE(hci_channelmap, NULL, NULL, hci_setup, NULL, NULL);
ZTEST_SUITE(hci_rssi, NULL, NULL, hci_setup, NULL, NULL);
ZTEST_SUITE(hci_encryption, NULL, NULL, hci_setup, NULL, NULL);

View file

@ -4,12 +4,13 @@ cmake_minimum_required(VERSION 3.20.0)
project(bluetooth_ull_llcp_invalid)
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/uut uut)
target_link_libraries(testbinary PRIVATE uut common)
target_sources(testbinary
PRIVATE
src/main.c
${ll_sw_sources}
${mock_sources}
${common_sources}
)

View file

@ -0,0 +1,29 @@
# Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# some of the control procedures in the BT LL depend on
# the following configs been set
config SOC_COMPATIBLE_NRF
default y
config BT_CTLR_DATA_LEN_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_CODED_SUPPORT
default y
config BT_CTLR_PHY_2M_SUPPORT
default y
config ENTROPY_NRF_FORCE_ALT
default n
config ENTROPY_NRF5_RNG
default n
# Include Zephyr's Kconfig
source "Kconfig"

View file

@ -0,0 +1,37 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
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
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_DATA_LEN_UPDATE=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y

View file

@ -26,7 +26,7 @@
#include "ll_feat.h"
#include "lll.h"
#include "lll_df_types.h"
#include "lll/lll_df_types.h"
#include "lll_conn.h"
#include "lll_conn_iso.h"
#include "ull_tx_queue.h"
@ -42,9 +42,9 @@
#include "helper_pdu.h"
#include "helper_util.h"
struct ll_conn test_conn;
static struct ll_conn test_conn;
static void setup(void)
static void invalid_setup(void *data)
{
test_setup(&test_conn);
}
@ -114,7 +114,7 @@ static void lt_tx_invalid_pdu_size(enum helper_pdu_opcode opcode, int adj_size)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_invalid_pdu_ignore_rx(void)
ZTEST(invalid, test_invalid_pdu_ignore_rx)
{
/* Role */
test_set_role(&test_conn, BT_HCI_ROLE_PERIPHERAL);
@ -181,11 +181,4 @@ void test_invalid_pdu_ignore_rx(void)
lt_tx_invalid_pdu_size(LL_CTE_RSP, 1);
}
void test_main(void)
{
ztest_test_suite(invalid,
ztest_unit_test_setup_teardown(test_invalid_pdu_ignore_rx, setup,
unit_test_noop));
ztest_run_test_suite(invalid);
}
ZTEST_SUITE(invalid, NULL, NULL, invalid_setup, NULL, NULL);

View file

@ -4,11 +4,13 @@ cmake_minimum_required(VERSION 3.20.0)
project(bluetooth_ull_llcp_le_ping)
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/uut uut)
target_link_libraries(testbinary PRIVATE uut common)
target_sources(testbinary
PRIVATE
src/main.c
${ll_sw_sources}
${mock_sources}
${common_sources}
)

View file

@ -0,0 +1,29 @@
# Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# some of the control procedures in the BT LL depend on
# the following configs been set
config SOC_COMPATIBLE_NRF
default y
config BT_CTLR_DATA_LEN_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_CODED_SUPPORT
default y
config BT_CTLR_PHY_2M_SUPPORT
default y
config ENTROPY_NRF_FORCE_ALT
default n
config ENTROPY_NRF5_RNG
default n
# Include Zephyr's Kconfig
source "Kconfig"

View file

@ -0,0 +1,37 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
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
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_DATA_LEN_UPDATE=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y

View file

@ -6,7 +6,6 @@
#include <zephyr/types.h>
#include <zephyr/ztest.h>
#include "kconfig.h"
#include <zephyr/bluetooth/hci.h>
#include <zephyr/sys/byteorder.h>
@ -26,7 +25,7 @@
#include "ll_settings.h"
#include "lll.h"
#include "lll_df_types.h"
#include "lll/lll_df_types.h"
#include "lll_conn.h"
#include "lll_conn_iso.h"
@ -43,9 +42,9 @@
#include "helper_pdu.h"
#include "helper_util.h"
struct ll_conn conn;
static struct ll_conn conn;
static void setup(void)
static void le_ping_setup(void *data)
{
test_setup(&conn);
}
@ -75,7 +74,7 @@ static void setup(void)
* | |<------------------|
* | | |
*/
void test_ping_central_loc(void)
ZTEST(ping_central, test_ping_central_loc)
{
uint8_t err;
struct node_tx *tx;
@ -165,7 +164,7 @@ void test_ping_central_loc(void)
* ~~~~~~~~~~~~~~~~~ TERMINATE CONNECTION ~~~~~~~~~~~~~~
* | | |
*/
void test_ping_central_loc_invalid_rsp(void)
ZTEST(ping_central, test_ping_central_loc_invalid_rsp)
{
uint8_t err;
struct node_tx *tx;
@ -266,7 +265,7 @@ void test_ping_central_loc_invalid_rsp(void)
* | | |
* | | |
*/
void test_ping_periph_loc(void)
ZTEST(ping_periph, test_ping_periph_loc)
{
uint8_t err;
struct node_tx *tx;
@ -319,7 +318,7 @@ void test_ping_periph_loc(void)
* | |------------------>|
* | | |
*/
void test_ping_central_rem(void)
ZTEST(ping_central, test_ping_central_rem)
{
struct node_tx *tx;
@ -373,7 +372,7 @@ void test_ping_central_rem(void)
* | |------------------>|
* | | |
*/
void test_ping_periph_rem(void)
ZTEST(ping_periph, test_ping_periph_rem)
{
struct node_tx *tx;
@ -416,20 +415,5 @@ void test_ping_periph_rem(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_main(void)
{
ztest_test_suite(ping,
ztest_unit_test_setup_teardown(test_ping_central_loc, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_ping_central_loc_invalid_rsp, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_ping_periph_loc, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_ping_central_rem, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_ping_periph_rem, setup,
unit_test_noop)
);
ztest_run_test_suite(ping);
}
ZTEST_SUITE(ping_central, NULL, NULL, le_ping_setup, NULL, NULL);
ZTEST_SUITE(ping_periph, NULL, NULL, le_ping_setup, NULL, NULL);

View file

@ -4,11 +4,13 @@ cmake_minimum_required(VERSION 3.20.0)
project(bluetooth_ull_llcp_min_used_chans)
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/uut uut)
target_link_libraries(testbinary PRIVATE uut common)
target_sources(testbinary
PRIVATE
src/main.c
${ll_sw_sources}
${mock_sources}
${common_sources}
PRIVATE
src/main.c
)

View file

@ -0,0 +1,29 @@
# Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# some of the control procedures in the BT LL depend on
# the following configs been set
config SOC_COMPATIBLE_NRF
default y
config BT_CTLR_DATA_LEN_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_CODED_SUPPORT
default y
config BT_CTLR_PHY_2M_SUPPORT
default y
config ENTROPY_NRF_FORCE_ALT
default n
config ENTROPY_NRF5_RNG
default n
# Include Zephyr's Kconfig
source "Kconfig"

View file

@ -0,0 +1,37 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
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
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_DATA_LEN_UPDATE=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y

View file

@ -6,7 +6,6 @@
#include <zephyr/types.h>
#include <zephyr/ztest.h>
#include "kconfig.h"
#include <zephyr/bluetooth/hci.h>
#include <zephyr/sys/byteorder.h>
@ -26,7 +25,7 @@
#include "ll_settings.h"
#include "lll.h"
#include "lll_df_types.h"
#include "lll/lll_df_types.h"
#include "lll_conn.h"
#include "lll_conn_iso.h"
@ -43,9 +42,9 @@
#include "helper_pdu.h"
#include "helper_util.h"
struct ll_conn conn;
static struct ll_conn conn;
static void setup(void)
static void muc_setup(void *data)
{
test_setup(&conn);
}
@ -64,7 +63,7 @@ static void setup(void)
* | | |
* | | |
*/
void test_min_used_chans_periph_loc(void)
ZTEST(muc_periph, test_min_used_chans_periph_loc)
{
uint8_t err;
struct node_tx *tx;
@ -111,7 +110,7 @@ void test_min_used_chans_periph_loc(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_min_used_chans_central_loc(void)
ZTEST(muc_central, test_min_used_chans_central_loc)
{
uint8_t err;
@ -129,7 +128,7 @@ void test_min_used_chans_central_loc(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_min_used_chans_central_rem(void)
ZTEST(muc_central, test_min_used_chans_central_rem)
{
struct pdu_data_llctrl_min_used_chans_ind remote_muc_ind = { .phys = 1,
.min_used_chans = 2 };
@ -165,17 +164,5 @@ void test_min_used_chans_central_rem(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_main(void)
{
ztest_test_suite(
muc,
ztest_unit_test_setup_teardown(test_min_used_chans_periph_loc, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_min_used_chans_central_loc, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_min_used_chans_central_rem, setup,
unit_test_noop)
);
ztest_run_test_suite(muc);
}
ZTEST_SUITE(muc_central, NULL, NULL, muc_setup, NULL, NULL);
ZTEST_SUITE(muc_periph, NULL, NULL, muc_setup, NULL, NULL);

View file

@ -4,11 +4,13 @@ cmake_minimum_required(VERSION 3.20.0)
project(bluetooth_ull_llcp_phy_update)
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/uut uut)
target_link_libraries(testbinary PRIVATE uut common)
target_sources(testbinary
PRIVATE
src/main.c
${ll_sw_sources}
${mock_sources}
${common_sources}
)

View file

@ -0,0 +1,29 @@
# Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# some of the control procedures in the BT LL depend on
# the following configs been set
config SOC_COMPATIBLE_NRF
default y
config BT_CTLR_DATA_LEN_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_CODED_SUPPORT
default y
config BT_CTLR_PHY_2M_SUPPORT
default y
config ENTROPY_NRF_FORCE_ALT
default n
config ENTROPY_NRF5_RNG
default n
# Include Zephyr's Kconfig
source "Kconfig"

View file

@ -0,0 +1,37 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
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
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_DATA_LEN_UPDATE=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y

View file

@ -0,0 +1,40 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
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
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_MAX_CONN=2
CONFIG_BT_CTLR_LLCP_CONN=2
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_DATA_LEN_UPDATE=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y

View file

@ -1,11 +0,0 @@
/*
* Copyright (c) 2021 Demant
* Copyright (c) 2021 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifdef CONFIG_BT_CTLR_LLCP_CONN
#undef CONFIG_BT_CTLR_LLCP_CONN
#define CONFIG_BT_CTLR_LLCP_CONN 2
#endif

View file

@ -6,7 +6,6 @@
#include <zephyr/types.h>
#include <zephyr/ztest.h>
#include "kconfig.h"
#define ULL_LLCP_UNITTEST
@ -28,7 +27,7 @@
#include "ll_settings.h"
#include "lll.h"
#include "lll_df_types.h"
#include "lll/lll_df_types.h"
#include "lll_conn.h"
#include "lll_conn_iso.h"
@ -53,7 +52,7 @@
static struct ll_conn conn;
static void setup(void)
static void phy_setup(void *data)
{
test_setup(&conn);
@ -112,7 +111,7 @@ static bool is_instant_reached(struct ll_conn *conn, uint16_t instant)
* +-----+ +-------+ +-----+
* | | |
*/
void test_phy_update_central_loc(void)
ZTEST(phy_central, test_phy_update_central_loc)
{
uint8_t err;
struct node_tx *tx;
@ -231,7 +230,7 @@ void test_phy_update_central_loc(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_phy_update_central_loc_invalid(void)
ZTEST(phy_central, test_phy_update_central_loc_invalid)
{
uint8_t err;
struct node_tx *tx;
@ -279,7 +278,7 @@ void test_phy_update_central_loc_invalid(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_phy_update_central_loc_unsupp_feat(void)
ZTEST(phy_central, test_phy_update_central_loc_unsupp_feat)
{
uint8_t err;
struct node_tx *tx;
@ -330,7 +329,7 @@ void test_phy_update_central_loc_unsupp_feat(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_phy_update_central_rem(void)
ZTEST(phy_central, test_phy_update_central_rem)
{
struct node_tx *tx;
struct node_rx_pdu *ntf;
@ -424,7 +423,7 @@ void test_phy_update_central_rem(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_phy_update_periph_loc(void)
ZTEST(phy_periph, test_phy_update_periph_loc)
{
uint8_t err;
struct node_tx *tx;
@ -513,7 +512,7 @@ void test_phy_update_periph_loc(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_phy_update_periph_rem(void)
ZTEST(phy_periph, test_phy_update_periph_rem)
{
struct node_tx *tx;
struct node_rx_pdu *ntf;
@ -612,7 +611,7 @@ void test_phy_update_periph_rem(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_phy_update_periph_loc_unsupp_feat(void)
ZTEST(phy_periph, test_phy_update_periph_loc_unsupp_feat)
{
uint8_t err;
struct node_tx *tx;
@ -663,7 +662,7 @@ void test_phy_update_periph_loc_unsupp_feat(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_phy_update_periph_rem_invalid(void)
ZTEST(phy_periph, test_phy_update_periph_rem_invalid)
{
struct node_tx *tx;
struct pdu_data_llctrl_phy_req req = { .rx_phys = PHY_1M, .tx_phys = PHY_2M };
@ -719,7 +718,7 @@ void test_phy_update_periph_rem_invalid(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_phy_update_central_loc_collision(void)
ZTEST(phy_central, test_phy_update_central_loc_collision)
{
uint8_t err;
struct node_tx *tx;
@ -888,7 +887,7 @@ void test_phy_update_central_loc_collision(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_phy_update_central_rem_collision(void)
ZTEST(phy_central, test_phy_update_central_rem_collision)
{
uint8_t err;
struct node_tx *tx;
@ -1065,7 +1064,7 @@ void test_phy_update_central_rem_collision(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_phy_update_periph_loc_collision(void)
ZTEST(phy_periph, test_phy_update_periph_loc_collision)
{
uint8_t err;
struct node_tx *tx;
@ -1189,7 +1188,7 @@ void test_phy_update_periph_loc_collision(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_phy_update_central_loc_no_act_change(void)
ZTEST(phy_central, test_phy_update_central_loc_no_act_change)
{
uint8_t err;
struct node_tx *tx;
@ -1275,7 +1274,7 @@ void test_phy_update_central_loc_no_act_change(void)
ctx_buffers_free());
}
void test_phy_update_central_rem_no_actual_change(void)
ZTEST(phy_central, test_phy_update_central_rem_no_actual_change)
{
struct node_tx *tx;
struct pdu_data *pdu;
@ -1340,7 +1339,7 @@ void test_phy_update_central_rem_no_actual_change(void)
ctx_buffers_free());
}
void test_phy_update_periph_loc_no_actual_change(void)
ZTEST(phy_periph, test_phy_update_periph_loc_no_actual_change)
{
uint8_t err;
struct node_tx *tx;
@ -1403,7 +1402,7 @@ void test_phy_update_periph_loc_no_actual_change(void)
ctx_buffers_free());
}
void test_phy_update_periph_rem_no_actual_change(void)
ZTEST(phy_periph, test_phy_update_periph_rem_no_actual_change)
{
struct node_tx *tx;
struct pdu_data_llctrl_phy_req req = { .rx_phys = PHY_1M, .tx_phys = PHY_1M };
@ -1467,36 +1466,5 @@ void test_phy_update_periph_rem_no_actual_change(void)
ctx_buffers_free());
}
void test_main(void)
{
ztest_test_suite(
phy,
ztest_unit_test_setup_teardown(test_phy_update_central_loc_invalid, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_phy_update_central_loc, setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_phy_update_central_loc_unsupp_feat, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_phy_update_central_rem, setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_phy_update_periph_loc, setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_phy_update_periph_loc_unsupp_feat, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_phy_update_periph_rem, setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_phy_update_periph_rem_invalid, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_phy_update_central_loc_collision, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_phy_update_central_rem_collision, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_phy_update_periph_loc_collision, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_phy_update_central_loc_no_act_change, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_phy_update_central_rem_no_actual_change, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_phy_update_periph_rem_no_actual_change, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_phy_update_periph_loc_no_actual_change, setup,
unit_test_noop));
ztest_run_test_suite(phy);
}
ZTEST_SUITE(phy_central, NULL, NULL, phy_setup, NULL, NULL);
ZTEST_SUITE(phy_periph, NULL, NULL, phy_setup, NULL, NULL);

View file

@ -5,4 +5,4 @@ tests:
type: unit
bluetooth.controller.ctrl_phy_update.test_reduced_buf:
type: unit
extra_args: KCONFIG_OVERRIDE_FILE="kconfig_override_rx_cnt.h"
extra_args: CONF_FILE=prj_rx_cnt.conf

View file

@ -2,11 +2,15 @@
cmake_minimum_required(VERSION 3.20.0)
FILE(GLOB SOURCES
src/*.c
)
project(bluetooth_ull_llcp_sca_update)
find_package(Zephyr COMPONENTS unittest HINTS $ENV{ZEPHYR_BASE})
include(${ZEPHYR_BASE}/tests/bluetooth/controller/common/defaults_cmake.txt)
target_sources(testbinary PRIVATE ${ll_sw_sources} ${mock_sources} ${common_sources})
add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/controller/common common)
add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/controller/uut uut)
target_link_libraries(testbinary PRIVATE uut common)
target_sources(testbinary
PRIVATE
src/main.c
)

View file

@ -0,0 +1,29 @@
# Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# some of the control procedures in the BT LL depend on
# the following configs been set
config SOC_COMPATIBLE_NRF
default y
config BT_CTLR_DATA_LEN_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_CODED_SUPPORT
default y
config BT_CTLR_PHY_2M_SUPPORT
default y
config ENTROPY_NRF_FORCE_ALT
default n
config ENTROPY_NRF5_RNG
default n
# Include Zephyr's Kconfig
source "Kconfig"

View file

@ -0,0 +1,37 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
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
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_DATA_LEN_UPDATE=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y

View file

@ -6,7 +6,6 @@
#include <zephyr/types.h>
#include <zephyr/ztest.h>
#include "kconfig.h"
#include <zephyr/bluetooth/hci.h>
#include <zephyr/sys/byteorder.h>
@ -27,7 +26,7 @@
#include "ll_settings.h"
#include "lll.h"
#include "lll_df_types.h"
#include "lll/lll_df_types.h"
#include "lll_conn.h"
#include "lll_conn_iso.h"
@ -45,9 +44,9 @@
#include "helper_pdu.h"
#include "helper_util.h"
struct ll_conn conn;
static struct ll_conn conn;
static void setup(void)
static void sca_setup(void *data)
{
test_setup(&conn);
}
@ -77,7 +76,7 @@ static void setup(void)
* | |<-------------------------------|
* | | |
*/
void test_sca_central_loc(void)
ZTEST(sca_central, test_sca_central_loc)
{
uint8_t err;
struct node_tx *tx;
@ -185,7 +184,7 @@ void test_sca_central_loc(void)
* ~~~~~~~~~~~~~~~~~ TERMINATE CONNECTION ~~~~~~~~~~~~~~
* | | |
*/
void test_sca_central_loc_invalid_rsp(void)
ZTEST(sca_central, test_sca_central_loc_invalid_rsp)
{
uint8_t err;
struct node_tx *tx;
@ -287,7 +286,7 @@ void test_sca_central_loc_invalid_rsp(void)
* ~~~~~~~~~~~~~~~~~ TERMINATE CONNECTION ~~~~~~~~~~~~~~
* | | |
*/
void test_sca_peripheral_loc_invalid_rsp(void)
ZTEST(sca_periph, test_sca_peripheral_loc_invalid_rsp)
{
uint8_t err;
struct node_tx *tx;
@ -388,7 +387,7 @@ void test_sca_peripheral_loc_invalid_rsp(void)
* | | |
* | | |
*/
void test_ping_periph_loc(void)
ZTEST(sca_periph, test_ping_periph_loc)
{
uint8_t err;
struct node_tx *tx;
@ -447,7 +446,7 @@ void test_ping_periph_loc(void)
* | | |
* | | |
*/
void test_ping_central_rem(void)
ZTEST(sca_central, test_ping_central_rem)
{
struct node_tx *tx;
@ -504,7 +503,7 @@ void test_ping_central_rem(void)
* | | |
* | | |
*/
void test_ping_periph_rem(void)
ZTEST(sca_periph, test_ping_periph_rem)
{
struct node_tx *tx;
@ -549,22 +548,5 @@ void test_ping_periph_rem(void)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_main(void)
{
ztest_test_suite(sca,
ztest_unit_test_setup_teardown(test_sca_central_loc, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_sca_central_loc_invalid_rsp, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_ping_periph_loc, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_sca_peripheral_loc_invalid_rsp, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_ping_central_rem, setup,
unit_test_noop),
ztest_unit_test_setup_teardown(test_ping_periph_rem, setup,
unit_test_noop)
);
ztest_run_test_suite(sca);
}
ZTEST_SUITE(sca_central, NULL, NULL, sca_setup, NULL, NULL);
ZTEST_SUITE(sca_periph, NULL, NULL, sca_setup, NULL, NULL);

View file

@ -4,11 +4,13 @@ cmake_minimum_required(VERSION 3.20.0)
project(bluetooth_ull_llcp_terminate)
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/uut uut)
target_link_libraries(testbinary PRIVATE uut common)
target_sources(testbinary
PRIVATE
src/main.c
${ll_sw_sources}
${mock_sources}
${common_sources}
PRIVATE
src/main.c
)

View file

@ -0,0 +1,29 @@
# Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# some of the control procedures in the BT LL depend on
# the following configs been set
config SOC_COMPATIBLE_NRF
default y
config BT_CTLR_DATA_LEN_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_CODED_SUPPORT
default y
config BT_CTLR_PHY_2M_SUPPORT
default y
config ENTROPY_NRF_FORCE_ALT
default n
config ENTROPY_NRF5_RNG
default n
# Include Zephyr's Kconfig
source "Kconfig"

View file

@ -0,0 +1,37 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
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
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_DATA_LEN_UPDATE=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y

View file

@ -7,7 +7,6 @@
#include <zephyr/types.h>
#include <zephyr/ztest.h>
#include "kconfig.h"
#include <zephyr/bluetooth/hci.h>
#include <zephyr/sys/byteorder.h>
@ -27,7 +26,7 @@
#include "ll_settings.h"
#include "lll.h"
#include "lll_df_types.h"
#include "lll/lll_df_types.h"
#include "lll_conn.h"
#include "lll_conn_iso.h"
@ -45,9 +44,9 @@
#include "helper_pdu.h"
#include "helper_util.h"
struct ll_conn conn;
static struct ll_conn conn;
static void setup(void)
static void term_setup(void *data)
{
test_setup(&conn);
}
@ -87,17 +86,17 @@ static void test_terminate_rem(uint8_t role)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_terminate_central_rem(void)
ZTEST(term_central, test_terminate_central_rem)
{
test_terminate_rem(BT_HCI_ROLE_CENTRAL);
}
void test_terminate_periph_rem(void)
ZTEST(term_periph, test_terminate_periph_rem)
{
test_terminate_rem(BT_HCI_ROLE_PERIPHERAL);
}
void test_terminate_loc(uint8_t role)
static void test_terminate_loc(uint8_t role)
{
uint8_t err;
struct node_tx *tx;
@ -139,24 +138,15 @@ void test_terminate_loc(uint8_t role)
"Free CTX buffers %d", ctx_buffers_free());
}
void test_terminate_central_loc(void)
ZTEST(term_central, test_terminate_central_loc)
{
test_terminate_loc(BT_HCI_ROLE_CENTRAL);
}
void test_terminate_periph_loc(void)
ZTEST(term_periph, test_terminate_periph_loc)
{
test_terminate_loc(BT_HCI_ROLE_PERIPHERAL);
}
void test_main(void)
{
ztest_test_suite(
term,
ztest_unit_test_setup_teardown(test_terminate_central_rem, setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_terminate_periph_rem, setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_terminate_central_loc, setup, unit_test_noop),
ztest_unit_test_setup_teardown(test_terminate_periph_loc, setup, unit_test_noop));
ztest_run_test_suite(term);
}
ZTEST_SUITE(term_central, NULL, NULL, term_setup, NULL, NULL);
ZTEST_SUITE(term_periph, NULL, NULL, term_setup, NULL, NULL);

View file

@ -2,17 +2,15 @@
cmake_minimum_required(VERSION 3.20.0)
if(CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM GREATER_EQUAL 0)
add_compile_definitions(CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM=${CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM})
endif(CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM)
project(bluetooth_ull_llcp_tx_buffer_alloc)
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/uut uut)
target_link_libraries(testbinary PRIVATE uut common)
target_sources(testbinary
PRIVATE
src/main.c
${ll_sw_sources}
${mock_sources}
${common_sources}
)

View file

@ -0,0 +1,29 @@
# Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# some of the control procedures in the BT LL depend on
# the following configs been set
config SOC_COMPATIBLE_NRF
default y
config BT_CTLR_DATA_LEN_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_CODED_SUPPORT
default y
config BT_CTLR_PHY_2M_SUPPORT
default y
config ENTROPY_NRF_FORCE_ALT
default n
config ENTROPY_NRF5_RNG
default n
# Include Zephyr's Kconfig
source "Kconfig"

View file

@ -0,0 +1,39 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
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
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_DATA_LEN_UPDATE=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM=0
CONFIG_BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM=2
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y

View file

@ -0,0 +1,40 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
CONFIG_BT_HCI=y
CONFIG_BT_CTLR=y
CONFIG_BT_LL_SW_SPLIT=y
CONFIG_BT_LLL_VENDOR_NORDIC=y
CONFIG_BT_MAX_CONN=4
CONFIG_BT_CENTRAL=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_CTLR_PERIPHERAL_ISO=y
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_DATA_LEN_UPDATE=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM=1
CONFIG_BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM=2
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y

View file

@ -0,0 +1,40 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
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
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_MAX_CONN=4
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_DATA_LEN_UPDATE=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM=2
CONFIG_BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM=2
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y

View file

@ -0,0 +1,40 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
CONFIG_BT_HCI=y
CONFIG_BT_CTLR=y
CONFIG_BT_LL_SW_SPLIT=y
CONFIG_BT_LLL_VENDOR_NORDIC=y
CONFIG_BT_MAX_CONN=4
CONFIG_BT_CENTRAL=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_CTLR_PERIPHERAL_ISO=y
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_DATA_LEN_UPDATE=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM=3
CONFIG_BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM=2
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y

View file

@ -0,0 +1,40 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
CONFIG_BT_HCI=y
CONFIG_BT_CTLR=y
CONFIG_BT_LL_SW_SPLIT=y
CONFIG_BT_LLL_VENDOR_NORDIC=y
CONFIG_BT_MAX_CONN=4
CONFIG_BT_CENTRAL=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_CTLR_PERIPHERAL_ISO=y
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_DATA_LEN_UPDATE=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM=4
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y

View file

@ -0,0 +1,43 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
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
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_DATA_LEN_UPDATE=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM=0
CONFIG_BT_MAX_CONN=4
CONFIG_BT_CTLR_LLCP_CONN=4
# CONFIG_BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM=CONFIG_BT_CTLR_LLCP_CONN * CONFIG_BT_CTLR_LLCP_TX_PER_CONN_TX_CTRL_BUF_NUM_MAX
CONFIG_BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM=16
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y

View file

@ -1,15 +0,0 @@
/*
* Copyright (c) 2020 Demant
* Copyright (c) 2020 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Common Kconfig settings
*/
#ifdef CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM
#undef CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM
#define CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM 0
#endif /* CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM */

View file

@ -1,16 +0,0 @@
/*
* Copyright (c) 2020 Demant
* Copyright (c) 2020 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Common Kconfig settings
*/
#ifdef CONFIG_BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM
#undef CONFIG_BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM
#define CONFIG_BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM \
(CONFIG_BT_CTLR_LLCP_CONN * CONFIG_BT_CTLR_LLCP_TX_PER_CONN_TX_CTRL_BUF_NUM_MAX)
#endif /* CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM */

View file

@ -6,7 +6,6 @@
#include <zephyr/types.h>
#include <zephyr/ztest.h>
#include "kconfig.h"
#define ULL_LLCP_UNITTEST
@ -49,12 +48,13 @@
static struct ll_conn conn[CONFIG_BT_CTLR_LLCP_CONN];
static void setup(void)
static void alloc_setup(void *data)
{
ull_conn_init();
test_setup(&conn[0]);
}
void test_tx_buffer_alloc(void)
ZTEST(tx_buffer_alloc, test_tx_buffer_alloc)
{
struct proc_ctx *ctxs[CONFIG_BT_CTLR_LLCP_CONN];
struct node_tx *tx[CONFIG_BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM +
@ -181,11 +181,4 @@ void test_tx_buffer_alloc(void)
#endif /* LLCP_TX_CTRL_BUF_QUEUE_ENABLE */
}
void test_main(void)
{
ztest_test_suite(
tx_buffer_alloc, ztest_unit_test_setup_teardown(test_tx_buffer_alloc, setup,
unit_test_noop));
ztest_run_test_suite(tx_buffer_alloc);
}
ZTEST_SUITE(tx_buffer_alloc, NULL, NULL, alloc_setup, NULL, NULL);

View file

@ -3,19 +3,23 @@ common:
tests:
bluetooth.controller.ctrl_tx_buffer_alloc.test_0_per_conn:
type: unit
extra_args: CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM=0
bluetooth.controller.ctrl_tx_buffer_alloc.test_1_per_conn:
type: unit
extra_args: CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM=1
extra_args: CONF_FILE=prj_1.conf
bluetooth.controller.ctrl_tx_buffer_alloc.test_2_per_conn:
type: unit
extra_args: CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM=2
extra_args: CONF_FILE=prj_2.conf
bluetooth.controller.ctrl_tx_buffer_alloc.test_3_per_conn:
type: unit
extra_args: CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM=3
extra_args: CONF_FILE=prj_3.conf
bluetooth.controller.ctrl_tx_buffer_alloc.test_max_per_conn_alloc:
type: unit
extra_args: CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM=4
extra_args: CONF_FILE=prj_max.conf
bluetooth.controller.ctrl_tx_buffer_alloc.test_max_common_alloc:
type: unit
extra_args: KCONFIG_OVERRIDE_FILE="kconfig_override_max_common.h"
extra_args: CONF_FILE=prj_max_common.conf

View file

@ -4,11 +4,13 @@ cmake_minimum_required(VERSION 3.20.0)
project(bluetooth_ull_llcp_tx_queue)
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/uut uut)
target_link_libraries(testbinary PRIVATE uut common)
target_sources(testbinary
PRIVATE
src/main.c
${ll_sw_sources}
${mock_sources}
${common_sources}
)

View file

@ -0,0 +1,29 @@
# Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# some of the control procedures in the BT LL depend on
# the following configs been set
config SOC_COMPATIBLE_NRF
default y
config BT_CTLR_DATA_LEN_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_UPDATE_SUPPORT
default y
config BT_CTLR_PHY_CODED_SUPPORT
default y
config BT_CTLR_PHY_2M_SUPPORT
default y
config ENTROPY_NRF_FORCE_ALT
default n
config ENTROPY_NRF5_RNG
default n
# Include Zephyr's Kconfig
source "Kconfig"

View file

@ -0,0 +1,37 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2
CONFIG_ASSERT_VERBOSE=y
CONFIG_BT=y
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
CONFIG_BT_CTLR_CENTRAL_ISO=y
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_DATA_LEN_UPDATE=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_ASSERT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y
CONFIG_BT_CTLR_SCA_UPDATE=y
CONFIG_BT_SCA_UPDATE=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y

View file

@ -17,20 +17,18 @@
#include "pdu_df.h"
#include "lll/pdu_vendor.h"
#include "hal/ccm.h"
#include "pdu.h"
#include "lll.h"
#include "lll_df_types.h"
/* mock ccm which is used in lll_conn.h */
struct ccm {
};
#include "lll/lll_df_types.h"
#include "lll_conn.h"
#include "ull_tx_queue.h"
#define SIZE 10U
void test_init(void)
ZTEST(tx_q, test_init)
{
struct ull_tx_q tx_q;
struct node_tx *node;
@ -48,7 +46,7 @@ void test_init(void)
* Dequeue and verify order of the ctrl nodes from (1).
* Verify Tx Queue is empty.
*/
void test_ctrl(void)
ZTEST(tx_q, test_ctrl)
{
struct ull_tx_q tx_q;
struct node_tx *node;
@ -77,7 +75,7 @@ void test_ctrl(void)
* Dequeue and verify order of the data nodes from (1).
* Verify Tx Queue is empty.
*/
void test_data(void)
ZTEST(tx_q, test_data)
{
struct ull_tx_q tx_q;
struct node_tx *node;
@ -106,7 +104,7 @@ void test_data(void)
* Dequeue and verify order of the data and ctrl nodes from (1).
* Verify Tx Queue is empty.
*/
void test_ctrl_and_data_1(void)
ZTEST(tx_q, test_ctrl_and_data_1)
{
struct ull_tx_q tx_q;
struct node_tx *node;
@ -142,7 +140,7 @@ void test_ctrl_and_data_1(void)
* Dequeue and verify order of the data and ctrl nodes from (1).
* Verify Tx Queue is empty.
*/
void test_ctrl_and_data_2(void)
ZTEST(tx_q, test_ctrl_and_data_2)
{
struct ull_tx_q tx_q;
struct node_tx *node;
@ -188,7 +186,7 @@ void test_ctrl_and_data_2(void)
* Dequeue and verify order of ctrl nodes from (2).
* Verify Tx Queue is empty.
*/
void test_ctrl_and_data_3(void)
ZTEST(tx_q, test_ctrl_and_data_3)
{
struct ull_tx_q tx_q;
struct node_tx *node;
@ -244,7 +242,7 @@ void test_ctrl_and_data_3(void)
* Dequeue and verify order of data nodes from (2).
* Verify Tx Queue is empty.
*/
void test_ctrl_and_data_4(void)
ZTEST(tx_q, test_ctrl_and_data_4)
{
struct ull_tx_q tx_q;
struct node_tx *node;
@ -311,7 +309,7 @@ void test_ctrl_and_data_4(void)
* Dequeue and verify order of ctrl and data nodes from (3).
* Verify Tx Queue is empty.
*/
void test_ctrl_and_data_5(void)
ZTEST(tx_q, test_ctrl_and_data_5)
{
struct ull_tx_q tx_q;
struct node_tx *node;
@ -398,7 +396,7 @@ void test_ctrl_and_data_5(void)
* Resume Tx Queue.
* Dequeue and verify order of data nodes from (2).
*/
void test_multiple_pause_resume(void)
ZTEST(tx_q, test_multiple_pause_resume)
{
struct ull_tx_q tx_q;
struct node_tx *node;
@ -452,14 +450,4 @@ void test_multiple_pause_resume(void)
zassert_equal_ptr(node, NULL, "");
}
void test_main(void)
{
ztest_test_suite(test, ztest_unit_test(test_init), ztest_unit_test(test_ctrl),
ztest_unit_test(test_data), ztest_unit_test(test_ctrl_and_data_1),
ztest_unit_test(test_ctrl_and_data_2),
ztest_unit_test(test_ctrl_and_data_3),
ztest_unit_test(test_ctrl_and_data_4),
ztest_unit_test(test_ctrl_and_data_5),
ztest_unit_test(test_multiple_pause_resume));
ztest_run_test_suite(test);
}
ZTEST_SUITE(tx_q, NULL, NULL, NULL, NULL, NULL);

View file

@ -2,44 +2,15 @@
cmake_minimum_required(VERSION 3.20.0)
# Propagate NO_ENC to compile
if(NO_ENC)
add_compile_definitions(NO_ENC)
endif()
# Propagate NO_PER_FEAT_EXCH to compile
if(NO_PER_FEAT_EXCH)
add_compile_definitions(NO_PER_FEAT_EXCH)
endif()
# Propagate NO_CPR to compile
if(NO_CPR)
add_compile_definitions(NO_CPR)
endif()
# Propagate NO_PHY to compile
if(NO_PHY)
add_compile_definitions(NO_PHY)
endif()
project(bluetooth_ull_llcp_unsupported)
find_package(Zephyr COMPONENTS unittest HINTS $ENV{ZEPHYR_BASE})
include(${ZEPHYR_BASE}/tests/bluetooth/controller/common/defaults_cmake.txt)
# Remove ull_llcp_enc.c from compile
if(NO_ENC)
list(REMOVE_ITEM ll_sw_sources ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/ull_llcp_enc.c)
endif()
add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/controller/common common)
add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/controller/uut uut)
# Remove ull_llcp_phy.c from compile
if(NO_PHY)
list(REMOVE_ITEM ll_sw_sources ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/ull_llcp_phy.c)
endif()
target_link_libraries(testbinary PRIVATE uut common)
target_sources(testbinary
PRIVATE
src/main.c
${ll_sw_sources}
${mock_sources}
${common_sources}
)

Some files were not shown because too many files have changed in this diff Show more