From: Anshuman Khandual <anshuman.khandual@arm.com>
To: linux-mm@kvack.org
Cc: Anshuman Khandual <anshuman.khandual@arm.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Petr Mladek <pmladek@suse.com>,
Steven Rostedt <rostedt@goodmis.org>,
Jonathan Corbet <corbet@lwn.net>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@redhat.com>,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: [RFC 2/2] kunit: printf: Add test case for pte_t
Date: Wed, 18 Jun 2025 09:42:35 +0530 [thread overview]
Message-ID: <20250618041235.1716143-3-anshuman.khandual@arm.com> (raw)
In-Reply-To: <20250618041235.1716143-1-anshuman.khandual@arm.com>
This adds a new test case for pte_t printf format.
Cc: Petr Mladek <pmladek@suse.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
lib/tests/printf_kunit.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/lib/tests/printf_kunit.c b/lib/tests/printf_kunit.c
index bc54cca2d7a6f..d94c5067e8b0d 100644
--- a/lib/tests/printf_kunit.c
+++ b/lib/tests/printf_kunit.c
@@ -763,6 +763,31 @@ errptr(struct kunit *kunittest)
#endif
}
+struct pte_test {
+ u64 val;
+ const char *name;
+};
+
+static struct pte_test pte_test_cases[] = {
+ { .val = 0xc0ffee, .name = "0x00c0ffee"},
+ { .val = 0xdeadbeef, .name = "0xdeadbeef"},
+ { .val = 0xaabbcc, .name = "0x00aabbcc"},
+};
+
+static void
+pte(struct kunit *kunittest)
+{
+ char buf[64];
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(pte_test_cases); i++) {
+ pte_t pte = __pte(pte_test_cases[i].val);
+
+ snprintf(buf, sizeof(buf), "%ppte", &pte);
+ KUNIT_EXPECT_STREQ(kunittest, buf, pte_test_cases[i].name);
+ }
+}
+
static int printf_suite_init(struct kunit_suite *suite)
{
total_tests = 0;
@@ -811,6 +836,7 @@ static struct kunit_case printf_test_cases[] = {
KUNIT_CASE(errptr),
KUNIT_CASE(fwnode_pointer),
KUNIT_CASE(fourcc_pointer),
+ KUNIT_CASE(pte),
{}
};
--
2.30.2
prev parent reply other threads:[~2025-06-18 4:12 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-18 4:12 [RFC 0/2] lib/vsprintf: Add support for pte_t Anshuman Khandual
2025-06-18 4:12 ` [RFC 1/2] " Anshuman Khandual
2025-06-18 8:18 ` David Hildenbrand
2025-06-18 8:37 ` Anshuman Khandual
2025-06-18 8:44 ` David Hildenbrand
2025-06-18 18:16 ` Pedro Falcato
2025-06-19 13:08 ` Petr Mladek
2025-06-20 6:00 ` Anshuman Khandual
2025-06-18 8:19 ` David Hildenbrand
2025-06-18 8:33 ` Anshuman Khandual
2025-06-18 8:43 ` David Hildenbrand
2025-06-20 6:30 ` Anshuman Khandual
2025-06-18 17:46 ` Andy Shevchenko
2025-06-19 9:35 ` Anshuman Khandual
2025-06-19 12:00 ` Andy Shevchenko
2025-06-20 6:53 ` Anshuman Khandual
2025-06-21 19:14 ` Andy Shevchenko
2025-06-19 13:12 ` Petr Mladek
2025-06-20 6:38 ` Anshuman Khandual
2025-06-18 18:19 ` Pedro Falcato
2025-06-19 9:53 ` Anshuman Khandual
2025-06-19 13:26 ` Matthew Wilcox
2025-06-20 8:12 ` Anshuman Khandual
2025-06-24 13:11 ` Matthew Wilcox
2025-06-24 14:23 ` Steven Rostedt
2025-06-19 14:01 ` Petr Mladek
2025-06-20 8:02 ` Anshuman Khandual
2025-06-24 10:48 ` Petr Mladek
2025-06-24 13:09 ` Andy Shevchenko
2025-06-18 4:12 ` Anshuman Khandual [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250618041235.1716143-3-anshuman.khandual@arm.com \
--to=anshuman.khandual@arm.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=corbet@lwn.net \
--cc=david@redhat.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@rasmusvillemoes.dk \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).