summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/kselftest.h
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2024-02-29 01:59:15 +0100
committerDavid S. Miller <davem@davemloft.net>2024-03-01 11:30:29 +0100
commit732e2035280bf499a4b002677e2a1845f557d403 (patch)
treecdf517fb5bd30b434a62b67208143c32116084c6 /tools/testing/selftests/kselftest.h
parentselftests: kselftest: add ksft_test_result_code(), handling all exit codes (diff)
downloadlinux-732e2035280bf499a4b002677e2a1845f557d403.tar.xz
linux-732e2035280bf499a4b002677e2a1845f557d403.zip
selftests: kselftest_harness: print test name for SKIP
Jakub points out that for parsers it's rather useful to always have the test name on the result line. Currently if we SKIP (or soon XFAIL or XPASS), we will print: ok 17 # SKIP SCTP doesn't support IP_BIND_ADDRESS_NO_PORT ^ no test name Always print the test name. KTAP format seems to allow or even call for it, per: https://docs.kernel.org/dev-tools/ktap.html Suggested-by: Jakub Sitnicki <jakub@cloudflare.com> Link: https://lore.kernel.org/all/87jzn6lnou.fsf@cloudflare.com/ 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.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h
index 12ad7f8dfe3a..25e29626566e 100644
--- a/tools/testing/selftests/kselftest.h
+++ b/tools/testing/selftests/kselftest.h
@@ -255,8 +255,9 @@ static inline __printf(1, 2) void ksft_test_result_error(const char *msg, ...)
va_end(args);
}
-static inline __printf(2, 3)
-void ksft_test_result_code(int exit_code, const char *msg, ...)
+static inline __printf(3, 4)
+void ksft_test_result_code(int exit_code, const char *test_name,
+ const char *msg, ...)
{
const char *tap_code = "ok";
const char *directive = "";
@@ -287,7 +288,7 @@ void ksft_test_result_code(int exit_code, const char *msg, ...)
}
va_start(args, msg);
- printf("%s %u%s", tap_code, ksft_test_num(), directive);
+ printf("%s %u %s%s", tap_code, ksft_test_num(), test_name, directive);
errno = saved_errno;
vprintf(msg, args);
va_end(args);