tests: mesh: Convert legacy test to use ztest

This test case makes this test case use ztest apis and
adds CONFIG_ZTEST in all configuration

Signed-off-by: Punit Vara <punit.vara@intel.com>
This commit is contained in:
Punit Vara 2017-09-06 12:00:00 +05:30 committed by Anas Nashif
commit b66a6acad7
12 changed files with 35 additions and 18 deletions

View file

@ -61,3 +61,5 @@ CONFIG_BT_MESH_DEBUG_ACCESS=y
CONFIG_BT_MESH_DEBUG_CRYPTO=y
CONFIG_BT_MESH_DEBUG_ADV=y
CONFIG_BT_MESH_SELF_TEST=y
CONFIG_ZTEST=y

View file

@ -55,3 +55,5 @@ CONFIG_BT_MESH_LABEL_COUNT=3
#CONFIG_BT_MESH_DEBUG_CRYPTO=y
#CONFIG_BT_MESH_DEBUG_ADV=y
#CONFIG_BT_MESH_SELF_TEST=y
CONFIG_ZTEST=y

View file

@ -61,3 +61,5 @@ CONFIG_BT_MESH_LABEL_COUNT=3
#CONFIG_BT_MESH_DEBUG_CRYPTO=y
#CONFIG_BT_MESH_DEBUG_ADV=y
#CONFIG_BT_MESH_SELF_TEST=y
CONFIG_ZTEST=y

View file

@ -61,3 +61,5 @@ CONFIG_BT_MESH_DEBUG_ACCESS=y
CONFIG_BT_MESH_DEBUG_CRYPTO=y
CONFIG_BT_MESH_DEBUG_ADV=y
#CONFIG_BT_MESH_SELF_TEST=y
CONFIG_ZTEST=y

View file

@ -44,3 +44,5 @@ CONFIG_BT_MESH_LABEL_COUNT=0
#CONFIG_BT_MESH_DEBUG_CRYPTO=y
#CONFIG_BT_MESH_DEBUG_ADV=y
#CONFIG_BT_MESH_DEBUG_ACCESS=y
CONFIG_ZTEST=y

View file

@ -55,3 +55,5 @@ CONFIG_BT_MESH_LABEL_COUNT=0
#CONFIG_BT_MESH_DEBUG_CRYPTO=y
#CONFIG_BT_MESH_DEBUG_ADV=y
#CONFIG_BT_MESH_DEBUG_ACCESS=y
CONFIG_ZTEST=y

View file

@ -33,3 +33,5 @@ CONFIG_BT_MESH_LABEL_COUNT=0
#CONFIG_BT_MESH_DEBUG_CRYPTO=y
#CONFIG_BT_MESH_DEBUG_ADV=y
#CONFIG_BT_MESH_DEBUG_ACCESS=y
CONFIG_ZTEST=y

View file

@ -61,3 +61,5 @@ CONFIG_BT_MESH_LABEL_COUNT=3
#CONFIG_BT_MESH_DEBUG_CRYPTO=y
#CONFIG_BT_MESH_DEBUG_ADV=y
#CONFIG_BT_MESH_SELF_TEST=y
CONFIG_ZTEST=y

View file

@ -61,3 +61,5 @@ CONFIG_BT_MESH_DEBUG_ACCESS=y
CONFIG_BT_MESH_DEBUG_CRYPTO=y
CONFIG_BT_MESH_DEBUG_ADV=y
#CONFIG_BT_MESH_SELF_TEST=y
CONFIG_ZTEST=y

View file

@ -61,3 +61,5 @@ CONFIG_BT_MESH_DEBUG_NET=y
#CONFIG_BT_MESH_DEBUG_CRYPTO=y
#CONFIG_BT_MESH_DEBUG_ADV=y
#CONFIG_BT_MESH_SELF_TEST=y
CONFIG_ZTEST=y

View file

@ -1,3 +1,4 @@
obj-y = main.o
include $(ZEPHYR_BASE)/tests/Makefile.test
obj-$(CONFIG_BOARD_BBC_MICROBIT) += microbit.o

View file

@ -10,6 +10,7 @@
#include <bluetooth/bluetooth.h>
#include <bluetooth/mesh.h>
#include <ztest.h>
#include "board.h"
@ -191,33 +192,28 @@ static const struct bt_mesh_prov prov = {
static void bt_ready(int err)
{
if (err) {
printk("Bluetooth init failed (err %d)\n", err);
return;
}
zassert_false(err, "Bluetooth init failed");
printk("Bluetooth initialized\n");
board_init();
err = bt_mesh_init(&prov, &comp);
if (err) {
printk("Initializing mesh failed (err %d)\n", err);
return;
}
zassert_false(bt_mesh_init(&prov, &comp),
"Initializing mesh failed");
printk("Mesh initialized\n");
}
void main(void)
void test_mesh(void)
{
int err;
printk("Initializing...\n");
/* Initialize the Bluetooth Subsystem */
err = bt_enable(bt_ready);
if (err) {
printk("Bluetooth init failed (err %d)\n", err);
}
zassert_false(bt_enable(bt_ready), "Bluetooth init failed");
}
/*test case main entry*/
void test_main(void)
{
ztest_test_suite(test_bluetooth_mesh,
ztest_unit_test(test_mesh));
ztest_run_test_suite(test_bluetooth_mesh);
}