tests: entropy: test entropy_bt_hci
Add a testcase to validate behaviour of the ENTROPY_BT_HCI driver. Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
parent
80e7ad7a23
commit
c8ab794ed2
4 changed files with 30 additions and 2 deletions
1
tests/drivers/entropy/api/entropy_bt_hci.conf
Normal file
1
tests/drivers/entropy/api/entropy_bt_hci.conf
Normal file
|
@ -0,0 +1 @@
|
||||||
|
CONFIG_BT=y
|
18
tests/drivers/entropy/api/entropy_bt_hci.overlay
Normal file
18
tests/drivers/entropy/api/entropy_bt_hci.overlay
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021, Commonwealth Scientific and Industrial Research
|
||||||
|
* Organisation (CSIRO) ABN 41 687 119 230.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/ {
|
||||||
|
chosen {
|
||||||
|
zephyr,entropy = &rng_hci;
|
||||||
|
};
|
||||||
|
|
||||||
|
rng_hci: entropy_bt_hci {
|
||||||
|
compatible = "zephyr,bt-hci-entropy";
|
||||||
|
label = "bt_hci_entropy";
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
};
|
|
@ -3,6 +3,7 @@
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
#include <bluetooth/bluetooth.h>
|
||||||
#include <drivers/entropy.h>
|
#include <drivers/entropy.h>
|
||||||
#include <ztest.h>
|
#include <ztest.h>
|
||||||
|
|
||||||
|
@ -21,8 +22,8 @@
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define BUFFER_LENGTH 10
|
#define BUFFER_LENGTH 10
|
||||||
#define RECHECK_RANDOM_ENTROPY 0x10
|
#define RECHECK_RANDOM_ENTROPY 0x10
|
||||||
|
|
||||||
static int random_entropy(const struct device *dev, char *buffer, char num)
|
static int random_entropy(const struct device *dev, char *buffer, char num)
|
||||||
{
|
{
|
||||||
|
@ -104,6 +105,10 @@ static void test_entropy_get_entropy(void)
|
||||||
|
|
||||||
void test_main(void)
|
void test_main(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_BT
|
||||||
|
bt_enable(NULL);
|
||||||
|
#endif /* CONFIG_BT */
|
||||||
|
|
||||||
ztest_test_suite(entropy_api,
|
ztest_test_suite(entropy_api,
|
||||||
ztest_unit_test(test_entropy_get_entropy));
|
ztest_unit_test(test_entropy_get_entropy));
|
||||||
ztest_run_test_suite(entropy_api);
|
ztest_run_test_suite(entropy_api);
|
||||||
|
|
|
@ -2,3 +2,7 @@ tests:
|
||||||
drivers.entropy:
|
drivers.entropy:
|
||||||
filter: CONFIG_ENTROPY_HAS_DRIVER
|
filter: CONFIG_ENTROPY_HAS_DRIVER
|
||||||
tags: drivers entropy
|
tags: drivers entropy
|
||||||
|
drivers.entropy.bt_hci:
|
||||||
|
platform_allow: nrf52_bsim
|
||||||
|
extra_args: DTC_OVERLAY_FILE=./entropy_bt_hci.overlay OVERLAY_CONFIG=./entropy_bt_hci.conf
|
||||||
|
tags: driver entropy bluetooth
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue