printf: add escaped-string format tests
PATCH 1/1 printf: add escaped-string format tests
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.
--- lib/tests/printf_kunit.c | 8 ++++++++ 1 file changed, 8 insertions(+)
lib/tests/printf_kunit.c +8 -0
@@ -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
Andy Shevchenko
reviewerQuoted 6 lines · Shuvam Pandey
printf_kunitleavesescaped_str()empty even thoughprintk-formats.rstdocuments %*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.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Andy Shevchenko
reviewerQuoted 10 lines · Andy Shevchenko
Quoted 6 lines · Shuvam Pandey
printf_kunitleavesescaped_str()empty even thoughprintk-formats.rstdocuments %*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 ....
Signature · 2 lines
With Best Regards, Andy Shevchenko