Re: [PATCH RFCv3 3/3] lib/test_printf: add test cases for '%pD'
From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Date: 2021-06-15 07:47:37
Also in:
linux-fsdevel, lkml
From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Date: 2021-06-15 07:47:37
Also in:
linux-fsdevel, lkml
On 15/06/2021 09.07, Justin He wrote:
Hi Petr
quoted
quoted
+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);quoted
+ test(" /bravo/alfa| /bravo/alfa", "%14pD|%*pD", &test_file, 14,&test_file);quoted
+ 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.
*/
I don't see why one would need to do anything special for %pD.
Rasmus