lib/tests/printf_kunit.c | 8 ++++++++ 1 file changed, 8 insertions(+)
printf_kunit leaves escaped_str() empty even though printk-formats.rst
documents %*pE conversions and says that omitting the field width
escapes one byte only.
Add tests for the documented %*pE, %*pEhp, and %*pEa conversions, and
for the single-byte %pE default when the field width is omitted.
Signed-off-by: Shuvam Pandey <shuvampandey1@gmail.com>
---
lib/tests/printf_kunit.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lib/tests/printf_kunit.c b/lib/tests/printf_kunit.c
index f6f21b445..8ea67abf1 100644
--- a/lib/tests/printf_kunit.c
+++ b/lib/tests/printf_kunit.c
@@ -394,6 +394,14 @@ addr(struct kunit *kunittest)
static void
escaped_str(struct kunit *kunittest)
{
+ const u8 buf[] = { 0x1b, 0x62, 0x20, 0x5c, 0x43,
+ 0x07, 0x22, 0x90, 0x0d, 0x5d };
+
+ test("\\eb \\C\\a\"\\220\\r]", "%*pE", 10, buf);
+ test("\\x1bb \\C\\x07\"\\x90\\x0d]", "%*pEhp", 10, buf);
+ test("\\e\\142\\040\\\\\\103\\a\\\"\\220\\r\\135",
+ "%*pEa", 10, buf);
+ test("\\e", "%pE", buf);
}
static void
On Mon, Apr 06, 2026 at 06:27:37AM +0545, Shuvam Pandey wrote: > printf_kunit leaves escaped_str() empty even though printk-formats.rst > documents %*pE conversions and says that omitting the field width > escapes one byte only. > > Add tests for the documented %*pE, %*pEhp, and %*pEa conversions, and > for the single-byte %pE default when the field width is omitted. NAK. We have much more of them already. Check if they need to be translated to KUnit, though. -- With Best Regards, Andy Shevchenko
On Mon, Apr 06, 2026 at 09:35:01PM +0300, Andy Shevchenko wrote: > On Mon, Apr 06, 2026 at 06:27:37AM +0545, Shuvam Pandey wrote: > > printf_kunit leaves escaped_str() empty even though printk-formats.rst > > documents %*pE conversions and says that omitting the field width > > escapes one byte only. > > > > Add tests for the documented %*pE, %*pEhp, and %*pEa conversions, and > > for the single-byte %pE default when the field width is omitted. > > NAK. We have much more of them already. Check if they need to be translated > to KUnit, though. Really, guys, if you have a mentor, ask them how to use `git grep ...`. -- With Best Regards, Andy Shevchenko
© 2016 - 2026 Red Hat, Inc.