Skip to content

Commit 378193e

Browse files
kuba-moodavem330
authored andcommitted
selftests: kselftest_harness: let PASS / FAIL provide diagnostic
Switch to printing KTAP line for PASS / FAIL with ksft_test_result_code(), this gives us the ability to report diagnostic messages. Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 42ab727 commit 378193e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tools/testing/selftests/kselftest_harness.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,14 +1143,13 @@ void __run_test(struct __fixture_metadata *f,
11431143

11441144
if (t->results->reason[0])
11451145
diagnostic = t->results->reason;
1146+
else if (t->exit_code == KSFT_PASS || t->exit_code == KSFT_FAIL)
1147+
diagnostic = NULL;
11461148
else
11471149
diagnostic = "unknown";
11481150

1149-
if (t->exit_code == KSFT_SKIP)
1150-
ksft_test_result_code(t->exit_code, test_name,
1151-
"%s", diagnostic);
1152-
else
1153-
ksft_test_result(__test_passed(t), "%s\n", test_name);
1151+
ksft_test_result_code(t->exit_code, test_name,
1152+
diagnostic ? "%s" : "", diagnostic);
11541153
}
11551154

11561155
static int test_harness_run(int argc, char **argv)

0 commit comments

Comments
 (0)