* [to-be-updated] selftests-ksft_exit_fail_perror-support-printf-style-arguments.patch removed from -mm tree
@ 2026-04-02 3:28 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-04-02 3:28 UTC (permalink / raw)
To: mm-commits, chuhu, akpm
The quilt patch titled
Subject: selftests: ksft_exit_fail_perror: support printf style arguments
has been removed from the -mm tree. Its filename was
selftests-ksft_exit_fail_perror-support-printf-style-arguments.patch
This patch was dropped because an updated version will be issued
------------------------------------------------------
From: Chunyu Hu <chuhu@redhat.com>
Subject: selftests: ksft_exit_fail_perror: support printf style arguments
Date: Mon, 30 Mar 2026 23:15:00 +0800
The ksft_exit_fail_perror function previously only accepted a single string
argument, which limited its flexibility for providing specific context to
failure messages.
This change updates ksft_exit_fail_perror to support variable arguments,
similar to ksft_exit_fail_msg. Adding the __printf(1, 2) attribute enables
compile-time checking for format string correctness.
Link: https://lkml.kernel.org/r/20260330151503.670415-5-chuhu@redhat.com
Signed-off-by: Chunyu Hu <chuhu@redhat.com>
Cc: David Hildenbrand (Arm) <david@kernel.org>
Cc: Li Wang <liwang@redhat.com>
Cc: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
Cc: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
tools/testing/selftests/kselftest.h | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
--- a/tools/testing/selftests/kselftest.h~selftests-ksft_exit_fail_perror-support-printf-style-arguments
+++ a/tools/testing/selftests/kselftest.h
@@ -43,7 +43,7 @@
* the program is aborting before finishing all tests):
*
* ksft_exit_fail_msg(fmt, ...);
- * ksft_exit_fail_perror(msg);
+ * ksft_exit_fail_perror(fmt, ...);
*
*/
#ifndef __KSELFTEST_H
@@ -417,9 +417,24 @@ static inline __noreturn __printf(1, 2)
exit(KSFT_FAIL);
}
-static inline __noreturn void ksft_exit_fail_perror(const char *msg)
+static inline __noreturn __printf(1, 2) void ksft_exit_fail_perror(const char *msg, ...)
{
- ksft_exit_fail_msg("%s: %s (%d)\n", msg, strerror(errno), errno);
+ va_list args;
+ char *buf = NULL;
+ int saved_errno = errno;
+
+ va_start(args, msg);
+ if (vasprintf(&buf, msg, args) == -1) {
+ va_end(args);
+ ksft_exit_fail_msg("vasprintf failed: %s (%d)\n", strerror(saved_errno),
+ saved_errno);
+ }
+ va_end(args);
+
+ errno = saved_errno;
+ ksft_exit_fail_msg("%s: %s (%d)\n", buf, strerror(errno), errno);
+
+ free(buf);
}
static inline __noreturn void ksft_exit_xfail(void)
_
Patches currently in -mm which might be from chuhu@redhat.com are
selftests-mm-vm_util-robust-write_file.patch
selftests-mm-split_huge_page_test-skip-the-test-when-thp-is-not-available.patch
selftests-mm-transhuge_stress-skip-the-test-when-thp-not-available.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-04-02 3:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-02 3:28 [to-be-updated] selftests-ksft_exit_fail_perror-support-printf-style-arguments.patch removed from -mm tree Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox