diff options
author | Stefan Metzmacher <metze@samba.org> | 2020-07-03 14:41:16 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2020-07-07 10:30:39 +0000 |
commit | f6eb56bff29f73732048b31b4caa4138ada0e100 (patch) | |
tree | 5eaa92cd49d31ed0695cd3b6884ab0101be537cd /lib/torture | |
parent | b7832c2c80b7148e6dd5f2f194f8afdee8b7778c (diff) | |
download | samba-f6eb56bff29f73732048b31b4caa4138ada0e100.tar.gz |
lib/torture: make torture_subunit_test_name() public
This makes it easier to modify.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'lib/torture')
-rw-r--r-- | lib/torture/subunit.c | 11 | ||||
-rw-r--r-- | lib/torture/torture.c | 19 | ||||
-rw-r--r-- | lib/torture/torture.h | 4 |
3 files changed, 16 insertions, 18 deletions
diff --git a/lib/torture/subunit.c b/lib/torture/subunit.c index deb96ffa3a9..693d9038bba 100644 --- a/lib/torture/subunit.c +++ b/lib/torture/subunit.c @@ -41,17 +41,6 @@ static void torture_subunit_suite_start(struct torture_context *ctx, { } -static char *torture_subunit_test_name(struct torture_context *ctx, - struct torture_tcase *tcase, - struct torture_test *test) -{ - if (!strcmp(tcase->name, test->name)) { - return talloc_strdup(ctx, test->name); - } else { - return talloc_asprintf(ctx, "%s.%s", tcase->name, test->name); - } -} - static void torture_subunit_report_time(struct torture_context *tctx) { struct timespec tp; diff --git a/lib/torture/torture.c b/lib/torture/torture.c index 40807d92a62..51ec99828dc 100644 --- a/lib/torture/torture.c +++ b/lib/torture/torture.c @@ -313,6 +313,17 @@ struct torture_tcase *torture_suite_add_tcase(struct torture_suite *suite, return tcase; } +char *torture_subunit_test_name(struct torture_context *ctx, + struct torture_tcase *tcase, + struct torture_test *test) +{ + if (!strcmp(tcase->name, test->name)) { + return talloc_strdup(ctx, test->name); + } else { + return talloc_asprintf(ctx, "%s.%s", tcase->name, test->name); + } +} + int torture_suite_children_count(const struct torture_suite *suite) { int ret = 0; @@ -407,13 +418,7 @@ static bool internal_torture_run_test(struct torture_context *context, const char **restricted) { bool success; - char *subunit_testname = NULL; - - if (tcase == NULL || strcmp(test->name, tcase->name) != 0) { - subunit_testname = talloc_asprintf(context, "%s.%s", tcase->name, test->name); - } else { - subunit_testname = talloc_strdup(context, test->name); - } + char *subunit_testname = torture_subunit_test_name(context, tcase, test); if (!test_needs_running(subunit_testname, restricted)) return true; diff --git a/lib/torture/torture.h b/lib/torture/torture.h index dbc711e25a1..a6f829f1ff0 100644 --- a/lib/torture/torture.h +++ b/lib/torture/torture.h @@ -218,6 +218,10 @@ struct torture_tcase *torture_suite_add_simple_test( bool torture_suite_add_suite(struct torture_suite *suite, struct torture_suite *child); +char *torture_subunit_test_name(struct torture_context *ctx, + struct torture_tcase *tcase, + struct torture_test *test); + /* Run the specified testsuite recursively */ bool torture_run_suite(struct torture_context *context, struct torture_suite *suite); |