Add some test infrastructure.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3658 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2021-09-06 18:23:22 +00:00
parent cadcb236ee
commit 35e0d8b68a
8 changed files with 103 additions and 64 deletions

View File

@ -119,10 +119,12 @@ void shedPrivileges()
static int _tf_command_test(const char* file, int argc, char* argv[])
{
typedef struct args_t {
const char* tests;
bool help;
} args_t;
xoptOption options[] = {
{ "tests", 't', offsetof(args_t, tests), NULL, XOPT_TYPE_STRING, NULL, "Comma-separated list of test names to run." },
{ "help", 'h', offsetof(args_t, help), NULL, XOPT_TYPE_BOOL, NULL, "Shows this help message." },
XOPT_NULLOPTION,
};
@ -140,7 +142,12 @@ static int _tf_command_test(const char* file, int argc, char* argv[])
return 2;
}
tf_tests(file);
tf_test_options_t test_options =
{
.exe_path = file,
.tests = args.tests,
};
tf_tests(&test_options);
return 0;
xopt_help:
if (extras) {