test: support running specific tests/modules targets

Add support for specifying single tests or modules to run via the
"--target" or "-t" command-line option. Multiple targets can be
provided; only the specified tests or all tests in the specified
module/s will run instead of the full suite.

Examples:
-t=<test name> runs an specific test.
-t=<module name> runs all tests within the specified module.

Both options can be provided multiple times.
This commit is contained in:
furszy
2025-09-03 17:18:23 -04:00
parent 0302c1a3d7
commit 953f7b0088
2 changed files with 85 additions and 24 deletions

View File

@@ -62,11 +62,12 @@ struct tf_test_module {
typedef int (*setup_ctx_fn)(void);
typedef int (*teardown_fn)(void);
/* Reference to a test in the registry. Group index and test index */
typedef struct {
int group;
int idx;
} tf_test_ref;
struct tf_targets {
/* Target tests indexes */
const struct tf_test_entry* slots[MAX_ARGS];
/* Next available slot */
int size;
};
/* --- Command-line args --- */
struct tf_args {
@@ -76,6 +77,8 @@ struct tf_args {
const char* custom_seed;
/* Whether to print the help msg */
int help;
/* Target tests indexes */
struct tf_targets targets;
};
/* --------------------------------------------------------- */