diff options
Diffstat (limited to 'include/test/ut.h')
-rw-r--r-- | include/test/ut.h | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/include/test/ut.h b/include/test/ut.h index 2e4d8edf826..a51defc3b90 100644 --- a/include/test/ut.h +++ b/include/test/ut.h @@ -480,11 +480,33 @@ struct unit_test_state *ut_get_state(void); void ut_set_state(struct unit_test_state *uts); /** + * ut_init_state() - Set up a new test state + * + * This must be called before using the test state with ut_run_tests() + * + * @uts: Test state to init + */ +void ut_init_state(struct unit_test_state *uts); + +/** + * ut_uninit_state() - Free memory used by test state + * + * This must be called before after the test state with ut_run_tests(). To later + * reuse the test state to run more tests, call test_state_init() first + * + * @uts: Test state to uninit + */ +void ut_uninit_state(struct unit_test_state *uts); + +/** * ut_run_tests() - Run a set of tests * * This runs the test, handling any preparation and clean-up needed. It prints * the name of each test before running it. * + * @uts: Unit-test state, which must be ready for use, i.e. ut_init_state() + * has been called. The caller is responsible for calling + * ut_uninit_state() after this function returns * @category: Category of these tests. This is a string printed at the start to * announce the the number of tests * @prefix: String prefix for the tests. Any tests that have this prefix will be @@ -503,8 +525,9 @@ void ut_set_state(struct unit_test_state *uts); * Pass NULL to disable this * Return: 0 if all tests passed, -1 if any failed */ -int ut_run_list(const char *name, const char *prefix, struct unit_test *tests, - int count, const char *select_name, int runs_per_test, - bool force_run, const char *test_insert); +int ut_run_list(struct unit_test_state *uts, const char *category, + const char *prefix, struct unit_test *tests, int count, + const char *select_name, int runs_per_test, bool force_run, + const char *test_insert); #endif |