Skip to content

Commit 8e7f07e

Browse files
weiny2davejiang
authored andcommitted
test printf: Add very basic struct resource tests
The printf tests for struct resource were stubbed out. struct range printing will leverage the struct resource implementation. To prevent regression add some basic sanity tests for struct resource. Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Fan Ni <fan.ni@samsung.com> Tested-by: Fan Ni <fan.ni@samsung.com> Acked-by: Petr Mladek <pmladek@suse.com> Link: https://patch.msgid.link/20241007-dcd-type2-upstream-v4-1-c261ee6eeded@intel.com Tested-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Ira Weiny <ira.weiny@intel.com> Link: https://patch.msgid.link/20241025-cxl-pra-v2-1-123a825daba2@intel.com Signed-off-by: Dave Jiang <dave.jiang@intel.com>
1 parent 8198375 commit 8e7f07e

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

lib/test_printf.c

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,50 @@ kernel_ptr(void)
386386
static void __init
387387
struct_resource(void)
388388
{
389+
struct resource test_resource = {
390+
.start = 0xc0ffee00,
391+
.end = 0xc0ffee00,
392+
.flags = IORESOURCE_MEM,
393+
};
394+
395+
test("[mem 0xc0ffee00 flags 0x200]",
396+
"%pr", &test_resource);
397+
398+
test_resource = (struct resource) {
399+
.start = 0xc0ffee,
400+
.end = 0xba5eba11,
401+
.flags = IORESOURCE_MEM,
402+
};
403+
test("[mem 0x00c0ffee-0xba5eba11 flags 0x200]",
404+
"%pr", &test_resource);
405+
406+
test_resource = (struct resource) {
407+
.start = 0xba5eba11,
408+
.end = 0xc0ffee,
409+
.flags = IORESOURCE_MEM,
410+
};
411+
test("[mem 0xba5eba11-0x00c0ffee flags 0x200]",
412+
"%pr", &test_resource);
413+
414+
test_resource = (struct resource) {
415+
.start = 0xba5eba11,
416+
.end = 0xba5eca11,
417+
.flags = IORESOURCE_MEM,
418+
};
419+
420+
test("[mem 0xba5eba11-0xba5eca11 flags 0x200]",
421+
"%pr", &test_resource);
422+
423+
test_resource = (struct resource) {
424+
.start = 0xba11,
425+
.end = 0xca10,
426+
.flags = IORESOURCE_IO |
427+
IORESOURCE_DISABLED |
428+
IORESOURCE_UNSET,
429+
};
430+
431+
test("[io size 0x1000 disabled]",
432+
"%pR", &test_resource);
389433
}
390434

391435
static void __init

0 commit comments

Comments
 (0)