1 /*
2  * Copyright (c) 2021 Nordic Semiconductor
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include "bstests.h"
8 #include "mesh_test.h"
9 
10 #if defined(CONFIG_SETTINGS)
11 extern struct bst_test_list *test_persistence_install(struct bst_test_list *tests);
12 extern struct bst_test_list *test_rpc_install(struct bst_test_list *tests);
13 extern struct bst_test_list *test_provision_pst_install(struct bst_test_list *tests);
14 extern struct bst_test_list *test_dfu_install(struct bst_test_list *test);
15 extern struct bst_test_list *test_blob_pst_install(struct bst_test_list *test);
16 extern struct bst_test_list *test_lcd_install(struct bst_test_list *test);
17 extern struct bst_test_list *test_sar_pst_install(struct bst_test_list *test);
18 #if (CONFIG_BT_MESH_GATT_PROXY && CONFIG_BT_MESH_PROXY_SOLICITATION)
19 extern struct bst_test_list *test_proxy_sol_install(struct bst_test_list *test);
20 #endif
21 #elif defined(CONFIG_BT_MESH_GATT_PROXY)
22 extern struct bst_test_list *test_adv_install(struct bst_test_list *test);
23 extern struct bst_test_list *test_suspend_install(struct bst_test_list *test);
24 extern struct bst_test_list *test_beacon_install(struct bst_test_list *tests);
25 #elif defined(CONFIG_BT_CTLR_LOW_LAT)
26 extern struct bst_test_list *test_transport_install(struct bst_test_list *tests);
27 extern struct bst_test_list *test_friendship_install(struct bst_test_list *tests);
28 extern struct bst_test_list *test_suspend_install(struct bst_test_list *test);
29 extern struct bst_test_list *test_adv_install(struct bst_test_list *test);
30 #else
31 extern struct bst_test_list *test_transport_install(struct bst_test_list *tests);
32 extern struct bst_test_list *test_friendship_install(struct bst_test_list *tests);
33 extern struct bst_test_list *test_provision_install(struct bst_test_list *tests);
34 extern struct bst_test_list *test_beacon_install(struct bst_test_list *tests);
35 extern struct bst_test_list *test_scanner_install(struct bst_test_list *test);
36 extern struct bst_test_list *test_heartbeat_install(struct bst_test_list *test);
37 extern struct bst_test_list *test_access_install(struct bst_test_list *test);
38 extern struct bst_test_list *test_ivi_install(struct bst_test_list *test);
39 extern struct bst_test_list *test_adv_install(struct bst_test_list *test);
40 extern struct bst_test_list *test_suspend_install(struct bst_test_list *test);
41 extern struct bst_test_list *test_blob_install(struct bst_test_list *test);
42 extern struct bst_test_list *test_op_agg_install(struct bst_test_list *test);
43 extern struct bst_test_list *test_sar_install(struct bst_test_list *test);
44 extern struct bst_test_list *test_cdp1_install(struct bst_test_list *test);
45 #endif
46 
47 bst_test_install_t test_installers[] = {
48 #if defined(CONFIG_SETTINGS)
49 	test_persistence_install,
50 	test_rpc_install,
51 	test_provision_pst_install,
52 	test_dfu_install,
53 	test_blob_pst_install,
54 	test_lcd_install,
55 	test_sar_pst_install,
56 #if (CONFIG_BT_MESH_GATT_PROXY && CONFIG_BT_MESH_PROXY_SOLICITATION)
57 	test_proxy_sol_install,
58 #endif
59 #elif defined(CONFIG_BT_MESH_GATT_PROXY)
60 	test_adv_install,
61 	test_suspend_install,
62 	test_beacon_install,
63 #elif defined(CONFIG_BT_CTLR_LOW_LAT)
64 	test_transport_install,
65 	test_friendship_install,
66 	test_suspend_install,
67 	test_adv_install,
68 #else
69 	test_transport_install,
70 	test_friendship_install,
71 	test_provision_install,
72 	test_beacon_install,
73 	test_scanner_install,
74 	test_heartbeat_install,
75 	test_access_install,
76 	test_ivi_install,
77 	test_adv_install,
78 	test_suspend_install,
79 	test_blob_install,
80 	test_op_agg_install,
81 	test_sar_install,
82 	test_cdp1_install,
83 #endif
84 	NULL
85 };
86 
87 static struct k_thread bsim_mesh_thread;
88 static K_KERNEL_STACK_DEFINE(bsim_mesh_thread_stack, 4096);
89 
bsim_mesh_entry_point(void * unused1,void * unused2,void * unused3)90 static void bsim_mesh_entry_point(void *unused1, void *unused2, void *unused3)
91 {
92 	bst_main();
93 }
94 
main(void)95 int main(void)
96 {
97 	k_thread_create(&bsim_mesh_thread, bsim_mesh_thread_stack,
98 			K_KERNEL_STACK_SIZEOF(bsim_mesh_thread_stack), bsim_mesh_entry_point, NULL,
99 			NULL, NULL, K_PRIO_COOP(1), 0, K_NO_WAIT);
100 	k_thread_name_set(&bsim_mesh_thread, "BabbleSim BLE Mesh tests");
101 
102 	return 0;
103 }
104