Skip to content

Commit

Permalink
kunit: rename print_subtest_{start,end} for clarity (s/subtest/suite)
Browse files Browse the repository at this point in the history
These names sound more general than they are.

The _end() function increments a `static int kunit_suite_counter`, so it
can only safely be called on suites, aka top-level subtests.
It would need to have a separate counter for each level of subtest to be
generic enough.

So rename it to make it clear it's only appropriate for suites.

Signed-off-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: David Gow <davidgow@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
  • Loading branch information
Daniel Latypov authored and Shuah Khan committed May 2, 2022
1 parent 9bf2eed commit cae56e1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/kunit/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ size_t kunit_suite_num_test_cases(struct kunit_suite *suite)
}
EXPORT_SYMBOL_GPL(kunit_suite_num_test_cases);

static void kunit_print_subtest_start(struct kunit_suite *suite)
static void kunit_print_suite_start(struct kunit_suite *suite)
{
kunit_log(KERN_INFO, suite, KUNIT_SUBTEST_INDENT "# Subtest: %s",
suite->name);
Expand Down Expand Up @@ -192,7 +192,7 @@ EXPORT_SYMBOL_GPL(kunit_suite_has_succeeded);

static size_t kunit_suite_counter = 1;

static void kunit_print_subtest_end(struct kunit_suite *suite)
static void kunit_print_suite_end(struct kunit_suite *suite)
{
kunit_print_ok_not_ok((void *)suite, false,
kunit_suite_has_succeeded(suite),
Expand Down Expand Up @@ -498,7 +498,7 @@ int kunit_run_tests(struct kunit_suite *suite)
struct kunit_result_stats suite_stats = { 0 };
struct kunit_result_stats total_stats = { 0 };

kunit_print_subtest_start(suite);
kunit_print_suite_start(suite);

kunit_suite_for_each_test_case(suite, test_case) {
struct kunit test = { .param_value = NULL, .param_index = 0 };
Expand Down Expand Up @@ -552,7 +552,7 @@ int kunit_run_tests(struct kunit_suite *suite)
}

kunit_print_suite_stats(suite, suite_stats, total_stats);
kunit_print_subtest_end(suite);
kunit_print_suite_end(suite);

return 0;
}
Expand Down

0 comments on commit cae56e1

Please sign in to comment.