[PATCH 4/4] lib/test_printf: Explicitly add components number to %pD and %pd

From: Jia He
Date: Wed Apr 28 2021 - 10:00:07 EST


After changing the default components number from 1 to 4 for %pD
and %pd, it would be better to explicitly add the number in test_printf
cases.

Add a test case of %pd5 to verify if it can be capped by 4 components.

Signed-off-by: Jia He <justin.he@xxxxxxx>
---
lib/test_printf.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/test_printf.c b/lib/test_printf.c
index 27b964ec723d..899cd55d1c90 100644
--- a/lib/test_printf.c
+++ b/lib/test_printf.c
@@ -478,18 +478,20 @@ static struct dentry test_dentry[4] __initdata = {
static void __init
dentry(void)
{
- test("foo", "%pd", &test_dentry[0]);
+ test("foo", "%pd1", &test_dentry[0]);
test("foo", "%pd2", &test_dentry[0]);

- test("(null)", "%pd", NULL);
- test("(efault)", "%pd", PTR_INVALID);
- test("(null)", "%pD", NULL);
- test("(efault)", "%pD", PTR_INVALID);
+ test("(null)", "%pd1", NULL);
+ test("(efault)", "%pd1", PTR_INVALID);
+ test("(null)", "%pD1", NULL);
+ test("(efault)", "%pD1", PTR_INVALID);

- test("romeo", "%pd", &test_dentry[3]);
+ test("romeo", "%pd1", &test_dentry[3]);
test("alfa/romeo", "%pd2", &test_dentry[3]);
test("bravo/alfa/romeo", "%pd3", &test_dentry[3]);
test("/bravo/alfa/romeo", "%pd4", &test_dentry[3]);
+ test("/bravo/alfa/romeo", "%pd", &test_dentry[3]);
+ test("/bravo/alfa/romeo", "%pd5", &test_dentry[3]);
test("/bravo/alfa", "%pd4", &test_dentry[2]);

test("bravo/alfa |bravo/alfa ", "%-12pd2|%*pd2", &test_dentry[2], -12, &test_dentry[2]);
--
2.17.1