kunit: subtests should be indented 4 spaces according to TAP

Introduce KUNIT_SUBTEST_INDENT macro which corresponds to 4-space
indentation and KUNIT_SUBSUBTEST_INDENT macro which corresponds to
8-space indentation in line with TAP spec (e.g. see "Subtests"
section of https://node-tap.org/tap-protocol/).

Use these macros in place of one or two tabs in strings to clarify
why we are indenting.

Suggested-by: Frank Rowand <frowand.list@gmail.com>
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
Reviewed-by: Frank Rowand <frank.rowand@sony.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
Alan Maguire
2020-03-26 14:25:09 +00:00
committed by Shuah Khan
parent eda8e324f7
commit c3bba690a2
4 changed files with 59 additions and 48 deletions

View File

@@ -69,8 +69,9 @@ EXPORT_SYMBOL_GPL(kunit_suite_num_test_cases);
static void kunit_print_subtest_start(struct kunit_suite *suite)
{
kunit_print_tap_version();
kunit_log(KERN_INFO, suite, "\t# Subtest: %s", suite->name);
kunit_log(KERN_INFO, suite, "\t1..%zd",
kunit_log(KERN_INFO, suite, KUNIT_SUBTEST_INDENT "# Subtest: %s",
suite->name);
kunit_log(KERN_INFO, suite, KUNIT_SUBTEST_INDENT "1..%zd",
kunit_suite_num_test_cases(suite));
}
@@ -96,7 +97,7 @@ static void kunit_print_ok_not_ok(void *test_or_suite,
kunit_status_to_string(is_ok),
test_number, description);
else
kunit_log(KERN_INFO, test, "\t%s %zd - %s",
kunit_log(KERN_INFO, test, KUNIT_SUBTEST_INDENT "%s %zd - %s",
kunit_status_to_string(is_ok),
test_number, description);
}