1 /*
2  * Copyright (c) 2024 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/kernel.h>
8 
9 #include "bs_tracing.h"
10 #include "bstests.h"
11 #include "babblekit/testcase.h"
12 
13 extern void entrypoint_advertiser(void);
14 extern void entrypoint_scanner(void);
15 extern enum bst_result_t bst_result;
16 
test_end_cb(void)17 static void test_end_cb(void)
18 {
19 	/* This callback will fire right before the executable returns */
20 	static const char demo_state[] = "My interesting state";
21 
22 	if (bst_result != Passed) {
23 		TEST_PRINT("Test has not passed. State: %s", demo_state);
24 	}
25 }
26 
27 static const struct bst_test_instance entrypoints[] = {
28 	{
29 		.test_id = "advertiser",
30 		.test_delete_f = test_end_cb,
31 		.test_main_f = entrypoint_advertiser,
32 	},
33 	{
34 		.test_id = "scanner",
35 		.test_delete_f = test_end_cb,
36 		.test_main_f = entrypoint_scanner,
37 	},
38 	BSTEST_END_MARKER,
39 };
40 
install(struct bst_test_list * tests)41 static struct bst_test_list *install(struct bst_test_list *tests)
42 {
43 	return bst_add_tests(tests, entrypoints);
44 };
45 
46 bst_test_install_t test_installers[] = {install, NULL};
47 
main(void)48 int main(void)
49 {
50 	bst_main();
51 
52 	return 0;
53 }
54