Skip to content

Commit 44b7da5

Browse files
sulixshuahkh
authored andcommitted
kunit: Report test parameter results as (K)TAP subtests
Currently, the results for individial parameters in a parameterised test are simply output as (K)TAP diagnostic lines. As kunit_tool now supports nested subtests, report each parameter as its own subtest. For example, here's what the output now looks like: # Subtest: inode_test_xtimestamp_decoding ok 1 - 1901-12-13 Lower bound of 32bit < 0 timestamp, no extra bits ok 2 - 1969-12-31 Upper bound of 32bit < 0 timestamp, no extra bits ok 3 - 1970-01-01 Lower bound of 32bit >=0 timestamp, no extra bits ok 4 - 2038-01-19 Upper bound of 32bit >=0 timestamp, no extra bits ok 5 - 2038-01-19 Lower bound of 32bit <0 timestamp, lo extra sec bit on ok 6 - 2106-02-07 Upper bound of 32bit <0 timestamp, lo extra sec bit on ok 7 - 2106-02-07 Lower bound of 32bit >=0 timestamp, lo extra sec bit on ok 8 - 2174-02-25 Upper bound of 32bit >=0 timestamp, lo extra sec bit on ok 9 - 2174-02-25 Lower bound of 32bit <0 timestamp, hi extra sec bit on ok 10 - 2242-03-16 Upper bound of 32bit <0 timestamp, hi extra sec bit on ok 11 - 2242-03-16 Lower bound of 32bit >=0 timestamp, hi extra sec bit on ok 12 - 2310-04-04 Upper bound of 32bit >=0 timestamp, hi extra sec bit on ok 13 - 2310-04-04 Upper bound of 32bit>=0 timestamp, hi extra sec bit 1. 1 ns ok 14 - 2378-04-22 Lower bound of 32bit>= timestamp. Extra sec bits 1. Max ns ok 15 - 2378-04-22 Lower bound of 32bit >=0 timestamp. All extra sec bits on ok 16 - 2446-05-10 Upper bound of 32bit >=0 timestamp. All extra sec bits on # inode_test_xtimestamp_decoding: pass:16 fail:0 skip:0 total:16 ok 1 - inode_test_xtimestamp_decoding Signed-off-by: David Gow <[email protected]> Reviewed-by: Daniel Latypov <[email protected]> Reviewed-by: Brendan Higgins <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 37dbb4c commit 44b7da5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/kunit/test.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,8 @@ int kunit_run_tests(struct kunit_suite *suite)
512512
/* Get initial param. */
513513
param_desc[0] = '\0';
514514
test.param_value = test_case->generate_params(NULL, param_desc);
515+
kunit_log(KERN_INFO, &test, KUNIT_SUBTEST_INDENT KUNIT_SUBTEST_INDENT
516+
"# Subtest: %s", test_case->name);
515517

516518
while (test.param_value) {
517519
kunit_run_case_catch_errors(suite, test_case, &test);
@@ -522,9 +524,8 @@ int kunit_run_tests(struct kunit_suite *suite)
522524
}
523525

524526
kunit_log(KERN_INFO, &test,
525-
KUNIT_SUBTEST_INDENT
526-
"# %s: %s %d - %s",
527-
test_case->name,
527+
KUNIT_SUBTEST_INDENT KUNIT_SUBTEST_INDENT
528+
"%s %d - %s",
528529
kunit_status_to_ok_not_ok(test.status),
529530
test.param_index + 1, param_desc);
530531

0 commit comments

Comments
 (0)