Skip to content
This repository has been archived by the owner on Feb 18, 2023. It is now read-only.

Commit

Permalink
support run specific integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
fAuernigg committed Oct 4, 2022
1 parent 5bf765a commit 474a5c2
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,20 @@ static const struct test *find_test(const char *name)
}


static const struct test *find_test_int(const char *name)
{
size_t i;

for (i=0; i<ARRAY_SIZE(tests_integration); i++) {

if (0 == str_casecmp(name, tests_integration[i].name))
return &tests_integration[i];
}

return NULL;
}


/**
* Run a single testcase in OOM (Out-of-memory) mode.
*
Expand Down Expand Up @@ -1034,6 +1048,29 @@ int test_integration(const char *name, bool verbose)

(void)re_fprintf(stderr, "integration tests\n");

if (name) {
test = find_test_int(name);
if (!test) {
(void)re_fprintf(stderr, "no such test: %s\n", name);
return ENOENT;
}

if (!test->name)
return EINVAL;

(void)re_fprintf(stderr, " %-24s: ", test->name);

if (test->exec)
err = test->exec();

if (err)
DEBUG_WARNING(" %-24s: NOK: %m\n", test->name, err);
else
(void)re_fprintf(stderr, "\x1b[32mOK\x1b[;m\n");

return err;
}

for (i=0; i<ARRAY_SIZE(tests_integration); i++) {

test = &tests_integration[i];
Expand Down

0 comments on commit 474a5c2

Please sign in to comment.