Skip to content
Permalink
Browse files

Bluetooth: Controller: Test for user extensions

With pull request #16208 and #16404 hooks for calling user defined
code was implemented. These user extensions are gated by a number of
Kconfigs. The test in this pull request tests that code compiles when
these Kconfigs are enabled.

Signed-off-by: Asger Munk Nielsen <asmk@oticon.com>
  • Loading branch information...
asmk-ot authored and carlescufi committed Jun 4, 2019
1 parent aec04a0 commit 912e117e9e5301e696812213aace4a9279700ac5
@@ -0,0 +1,12 @@
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.13.1)
include_directories("./src")

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(bluetooth_ctrl_user_ext)


FILE(GLOB app_sources src/*.c)

target_sources(app PRIVATE ${app_sources})
@@ -0,0 +1,10 @@
CONFIG_BT=y
CONFIG_BT_CTLR=y
CONFIG_BT_LL_SW_SPLIT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_CENTRAL=y
CONFIG_ZTEST=y
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
CONFIG_BT_CTLR_USER_EXT=y
CONFIG_BT_CTLR_USER_EVT_RANGE=10
CONFIG_BT_RX_USER_PDU_LEN=7
@@ -0,0 +1,27 @@
/* main.c - Application main entry point */

/*
* Copyright (c) 2015-2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/types.h>
#include <stddef.h>
#include <misc/printk.h>
#include <ztest.h>

#include <bluetooth/bluetooth.h>

void test_ctrl_user_ext(void)
{
zassert_false(bt_enable(NULL), "Bluetooth ctrl_user_ext failed");
}

/*test case main entry*/
void test_main(void)
{
ztest_test_suite(test_bluetooth,
ztest_unit_test(test_ctrl_user_ext));
ztest_run_test_suite(test_bluetooth);
}
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2019 Oticon A/S
*
* SPDX-License-Identifier: Apache-2.0
*/

#if defined(CONFIG_BT_CTLR_USER_EXT)

/* The test is made to show that ull.c and other code can compile when
* certain Kconfig options are set. This includes functions that are
* used for vendor specific behavior, as such the function implementations
* in this file are simple stubs without functional behavior.
*/

static inline int ull_user_init(void)
{
return 0;
}

static inline int rx_demux_rx_proprietary(memq_link_t *link,
struct node_rx_hdr *rx,
memq_link_t *tail,
memq_link_t **head)
{
return 0;
}

static inline void ull_proprietary_done(struct node_rx_event_done *evdone)
{
/* Nothing to do */
}

#endif /* CONFIG_BT_CTLR_USER_EXT */
@@ -0,0 +1,6 @@
common:
build_only: true
tags: bluetooth
tests:
bluetooth.ctrl_user_ext.test:
platform_whitelist: nrf52_bsim

0 comments on commit 912e117

Please sign in to comment.
You can’t perform that action at this time.