test: adapt modules to the new test infrastructure

This not only provides a structural improvement but also
allows us to (1) specify individual tests to run and (2)
execute each of them concurrently.
This commit is contained in:
furszy
2025-09-09 11:45:17 -04:00
parent 48789dafc2
commit 9ec3bfe22d
8 changed files with 91 additions and 104 deletions

View File

@@ -22,6 +22,7 @@
/* --------------------------------------------------------- */
#define CASE(name) { #name, run_##name }
#define CASE1(name) { #name, name }
#define MAKE_TEST_MODULE(name) { \
#name, \
@@ -29,6 +30,18 @@
sizeof(tests_##name) / sizeof(tests_##name[0]) \
}
/* Macro to wrap a test internal function with a COUNT loop (iterations number) */
#define REPEAT_TEST(fn) REPEAT_TEST_MULT(fn, 1)
#define REPEAT_TEST_MULT(fn, multiplier) \
static void fn(void) { \
int i; \
int repeat = COUNT * (multiplier); \
for (i = 0; i < repeat; i++) \
fn##_internal(); \
}
/* --------------------------------------------------------- */
/* Test Framework API */
/* --------------------------------------------------------- */