Skip to content

Commit 42ab727

Browse files
kuba-moodavem330
authored andcommitted
selftests: kselftest_harness: separate diagnostic message with # in ksft_test_result_code()
According to the spec we should always print a # if we add a diagnostic message. Having the caller pass in the new line as part of diagnostic message makes handling this a bit counter-intuitive, so append the new line in the helper. 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 732e203 commit 42ab727

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

tools/testing/selftests/kselftest.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,15 @@ void ksft_test_result_code(int exit_code, const char *test_name,
287287
break;
288288
}
289289

290+
/* Docs seem to call for double space if directive is absent */
291+
if (!directive[0] && msg[0])
292+
directive = " # ";
293+
290294
va_start(args, msg);
291295
printf("%s %u %s%s", tap_code, ksft_test_num(), test_name, directive);
292296
errno = saved_errno;
293297
vprintf(msg, args);
298+
printf("\n");
294299
va_end(args);
295300
}
296301

tools/testing/selftests/kselftest_harness.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,7 @@ void __run_test(struct __fixture_metadata *f,
11481148

11491149
if (t->exit_code == KSFT_SKIP)
11501150
ksft_test_result_code(t->exit_code, test_name,
1151-
"%s\n", diagnostic);
1151+
"%s", diagnostic);
11521152
else
11531153
ksft_test_result(__test_passed(t), "%s\n", test_name);
11541154
}

0 commit comments

Comments
 (0)