1 /* Copyright (c) 2023 Nordic Semiconductor ASA
2  * SPDX-License-Identifier: Apache-2.0
3  */
4 
5 #include <zephyr/kernel.h>
6 
7 #include "bs_types.h"
8 #include "bs_tracing.h"
9 #include "bstests.h"
10 #include <string.h>
11 
12 #include <zephyr/logging/log.h>
13 
14 #include "common.h"
15 
16 #define WAIT_TIME_S 60
17 #define WAIT_TIME   (WAIT_TIME_S * 1e6)
18 
19 LOG_MODULE_REGISTER(bt_bsim_id_settings, LOG_LEVEL_DBG);
20 
21 extern void run_dut1(void);
22 extern void run_dut2(void);
23 
test_tick(bs_time_t HW_device_time)24 void test_tick(bs_time_t HW_device_time)
25 {
26 	if (bst_result != Passed) {
27 		FAIL("Test failed (not passed after %d seconds)\n", WAIT_TIME_S);
28 	}
29 }
30 
test_id_settings_init(void)31 static void test_id_settings_init(void)
32 {
33 	bst_ticker_set_next_tick_absolute(WAIT_TIME);
34 }
35 
36 static const struct bst_test_instance test_def[] = {
37 	{
38 		.test_id = "dut1",
39 		.test_descr = "DUT 1",
40 		.test_post_init_f = test_id_settings_init,
41 		.test_tick_f = test_tick,
42 		.test_main_f = run_dut1,
43 	},
44 	{
45 		.test_id = "dut2",
46 		.test_descr = "DUT 2",
47 		.test_post_init_f = test_id_settings_init,
48 		.test_tick_f = test_tick,
49 		.test_main_f = run_dut2,
50 	},
51 	BSTEST_END_MARKER};
52 
test_id_settings_install(struct bst_test_list * tests)53 struct bst_test_list *test_id_settings_install(struct bst_test_list *tests)
54 {
55 	return bst_add_tests(tests, test_def);
56 }
57 
58 bst_test_install_t test_installers[] = {test_id_settings_install, NULL};
59 
main(void)60 void main(void)
61 {
62 	bst_main();
63 }
64