RE: [PATCH RFCv3 3/3] lib/test_printf: add test cases for '%pD'

From: Justin He
Date: Tue Jun 15 2021 - 03:56:18 EST




> -----Original Message-----
> From: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
> Sent: Tuesday, June 15, 2021 3:48 PM
> To: Justin He <Justin.He@xxxxxxx>; Petr Mladek <pmladek@xxxxxxxx>
> Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>; Sergey Senozhatsky
> <senozhatsky@xxxxxxxxxxxx>; Andy Shevchenko
> <andriy.shevchenko@xxxxxxxxxxxxxxx>; Jonathan Corbet <corbet@xxxxxxx>;
> Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>; Linus Torvalds <torvalds@linux-
> foundation.org>; Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>; Eric
> Biggers <ebiggers@xxxxxxxxxx>; Ahmed S. Darwish <a.darwish@xxxxxxxxxxxxx>;
> linux-doc@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux-
> fsdevel@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH RFCv3 3/3] lib/test_printf: add test cases for '%pD'
>
> On 15/06/2021 09.07, Justin He wrote:
> > Hi Petr
> >
>
> >>> +static void __init
> >>> +f_d_path(void)
> >>> +{
> >>> + test("(null)", "%pD", NULL);
> >>> + test("(efault)", "%pD", PTR_INVALID);
> >>> +
> >>> + is_prepend_buf = true;
> >>> + test("/bravo/alfa |/bravo/alfa ", "%-14pD|%*pD", &test_file, -
> 14,
> >> &test_file);
> >>> + test(" /bravo/alfa| /bravo/alfa", "%14pD|%*pD", &test_file, 14,
> >> &test_file);
> >>> + test(" /bravo/alfa|/bravo/alfa ", "%14pD|%-14pD", &test_file,
> >> &test_file);
> >>
> >> Please, add more test for scenarios when the path does not fit into
> >> the buffer or when there are no limitations, ...
> >
> > Indeed, thanks
>
> Doesn't the existing test() helper do this for you automatically?
>
> /*
> * Every fmt+args is subjected to four tests: Three where we
> * tell vsnprintf varying buffer sizes (plenty, not quite
> * enough and 0), and then we also test that kvasprintf would
> * be able to print it as expected.
> */
>

Yes, it had invoked vsnprintf for 3 times in __test()
vsnprintf(buf,256)
vsnprintf(buf,random_bytes,...)
vsnprintf(buf, 0,...);
seems no need to add more test cases

> I don't see why one would need to do anything special for %pD.

Okay, got it, agree


--
Cheers,
Justin (Jia He)


IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.