diff mbox series

[RFC,6/7] kselftest: support skipping tests with testname

Message ID 20230719-nolibc-ktap-tmp-v1-6-930bd0c52ff1@weissschuh.net (mailing list archive)
State New
Headers show
Series selftests/nolibc: KTAP output | expand

Commit Message

Thomas Weißschuh July 18, 2023, 10 p.m. UTC
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 <linux@weissschuh.net>
---
 tools/testing/selftests/kselftest.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
diff mbox series

Patch

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, ...)
 {