[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240229005920.2407409-9-kuba@kernel.org>
Date: Wed, 28 Feb 2024 16:59:15 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: davem@...emloft.net
Cc: netdev@...r.kernel.org,
edumazet@...gle.com,
pabeni@...hat.com,
shuah@...nel.org,
linux-kselftest@...r.kernel.org,
mic@...ikod.net,
linux-security-module@...r.kernel.org,
keescook@...omium.org,
jakub@...udflare.com,
Jakub Kicinski <kuba@...nel.org>
Subject: [PATCH v4 08/12] 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@...udflare.com>
Link: https://lore.kernel.org/all/87jzn6lnou.fsf@cloudflare.com/
Reviewed-by: Kees Cook <keescook@...omium.org>
Signed-off-by: Jakub Kicinski <kuba@...nel.org>
---
tools/testing/selftests/kselftest.h | 7 ++++---
tools/testing/selftests/kselftest_harness.h | 3 ++-
2 files changed, 6 insertions(+), 4 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);
diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
index 4fb30fcc7774..82377051aa54 100644
--- a/tools/testing/selftests/kselftest_harness.h
+++ b/tools/testing/selftests/kselftest_harness.h
@@ -1147,7 +1147,8 @@ void __run_test(struct __fixture_metadata *f,
diagnostic = "unknown";
if (t->exit_code == KSFT_SKIP)
- ksft_test_result_code(t->exit_code, "%s\n", diagnostic);
+ ksft_test_result_code(t->exit_code, test_name,
+ "%s\n", diagnostic);
else
ksft_test_result(__test_passed(t), "%s\n", test_name);
}
--
2.43.2
Powered by blists - more mailing lists