2023-07-18 22:16:48

by Thomas Weißschuh

[permalink] [raw]
Subject: [PATCH RFC 6/7] kselftest: support skipping tests with testname

The TAP parser at tools/testing/kunit/kunit.py requires a testname to
properly parse skipped tests.
The current kselftest APIs do not provide this functionality so add it.

Signed-off-by: Thomas Weißschuh <[email protected]>
---
tools/testing/selftests/kselftest.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h
index 811d720d50dd..0206287de5b8 100644
--- a/tools/testing/selftests/kselftest.h
+++ b/tools/testing/selftests/kselftest.h
@@ -219,6 +219,21 @@ static inline void ksft_test_result_skip(const char *msg, ...)
va_end(args);
}

+static inline void ksft_test_result_skip2(const char *name, const char *msg, ...)
+{
+ int saved_errno = errno;
+ va_list args;
+
+ ksft_cnt.ksft_xskip++;
+
+ va_start(args, msg);
+ printf("ok %d %s # SKIP ", ksft_test_num(), name);
+ errno = saved_errno;
+ vprintf(msg, args);
+ va_end(args);
+}
+
+
/* TODO: how does "error" differ from "fail" or "skip"? */
static inline void ksft_test_result_error(const char *msg, ...)
{

--
2.41.0