diff options
author | Ivan Orlov <ivan.orlov0322@gmail.com> | 2024-04-23 16:52:43 +0100 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2024-05-07 11:27:13 +0530 |
commit | f6243d9ce591b3a2085feff23ab2fbe1a6d51a14 (patch) | |
tree | 77e45848934e0ea0e5d09f1b6d232bc122cf8689 /include | |
parent | d4d2582eef7aac442076f955e4024403f8ff3d96 (diff) | |
download | opensbi-f6243d9ce591b3a2085feff23ab2fbe1a6d51a14.zip opensbi-f6243d9ce591b3a2085feff23ab2fbe1a6d51a14.tar.gz opensbi-f6243d9ce591b3a2085feff23ab2fbe1a6d51a14.tar.bz2 |
lib: tests: Add test suite init function
Allow to define an init function for the test suite. It could help us
to initialize global variable once, and use them in multiple test cases
after the initialization.
For instance, if multiple test cases use the same atomic_t var, it
could be helpful to call ATOMIC_INIT once during the suite
initialization.
Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/sbi/sbi_unit_test.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/sbi/sbi_unit_test.h b/include/sbi/sbi_unit_test.h index c63d900..448c048 100644 --- a/include/sbi/sbi_unit_test.h +++ b/include/sbi/sbi_unit_test.h @@ -19,6 +19,7 @@ struct sbiunit_test_case { struct sbiunit_test_suite { const char *name; + void (*init)(void); struct sbiunit_test_case *cases; }; @@ -34,6 +35,7 @@ struct sbiunit_test_suite { #define SBIUNIT_TEST_SUITE(suite_name, cases_arr) \ struct sbiunit_test_suite suite_name = { \ .name = #suite_name, \ + .init = NULL, \ .cases = cases_arr \ } |