@@ -33,6 +33,15 @@ extern "C" {
33
33
*/
34
34
typedef void (* utest_v1_harness_callback_t )(void );
35
35
36
+ /**
37
+ * utest calls this function before running the test specification.
38
+ * Use this function to initialize your scheduler before the first callback is requested.
39
+ *
40
+ * @retval `0` if success
41
+ * @retval non-zero if failure
42
+ */
43
+ typedef int32_t (* utest_v1_scheduler_init_callback_t )(void );
44
+
36
45
/**
37
46
* utest calls this function when it needs to schedule a callback with a delay in milliseconds.
38
47
* `delay_ms` will only be non-zero if an asynchronous test case exists in the test specification.
@@ -66,13 +75,25 @@ typedef void *(*utest_v1_scheduler_post_callback_t)(const utest_v1_harness_callb
66
75
*/
67
76
typedef int32_t (* utest_v1_scheduler_cancel_callback_t )(void * handle );
68
77
78
+ /**
79
+ * utest calls this function at the end of the `Harness::run()` function, after (!) the first callback has been requested.
80
+ * This function is meant to implement an optional event loop, which may very well be blocking (if your scheduler works with that).
81
+ * This assumes that `Harness::run()` will be called on the main stack (ie. not in an interrupt!).
82
+ *
83
+ * @retval `0` if success
84
+ * @retval non-zero if failure
85
+ */
86
+ typedef int32_t (* utest_v1_scheduler_run_callback_t )(void );
87
+
69
88
/**
70
89
* The scheduler interface consists out of the `post` and `cancel` functions,
71
90
* which you must implement to use `utest`.
72
91
*/
73
92
typedef struct {
93
+ utest_v1_scheduler_init_callback_t init ;
74
94
utest_v1_scheduler_post_callback_t post ;
75
95
utest_v1_scheduler_cancel_callback_t cancel ;
96
+ utest_v1_scheduler_run_callback_t run ;
76
97
} utest_v1_scheduler_t ;
77
98
78
99
#ifdef __cplusplus
0 commit comments