summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/kselftest.h
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2024-02-29 03:59:16 +0300
committerDavid S. Miller <davem@davemloft.net>2024-03-01 13:30:29 +0300
commit42ab727eb95fcff83e7a67fcdbf467bbcd53451e (patch)
tree8581d555cef159c2971a3cba46db7d2c9fc6f4af /tools/testing/selftests/kselftest.h
parent732e2035280bf499a4b002677e2a1845f557d403 (diff)
downloadlinux-42ab727eb95fcff83e7a67fcdbf467bbcd53451e.tar.xz
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>
Diffstat (limited to 'tools/testing/selftests/kselftest.h')
-rw-r--r--tools/testing/selftests/kselftest.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h
index 25e29626566e..541bf192e30e 100644
--- a/tools/testing/selftests/kselftest.h
+++ b/tools/testing/selftests/kselftest.h
@@ -287,10 +287,15 @@ void ksft_test_result_code(int exit_code, const char *test_name,
break;
}
+ /* Docs seem to call for double space if directive is absent */
+ if (!directive[0] && msg[0])
+ directive = " # ";
+
va_start(args, msg);
printf("%s %u %s%s", tap_code, ksft_test_num(), test_name, directive);
errno = saved_errno;
vprintf(msg, args);
+ printf("\n");
va_end(args);
}