[PATCH 2/2] test: dm: Add test case for devfdt_get_addr_ptr
Ovidiu Panait
ovidiu.panait at windriver.com
Mon Aug 3 21:17:36 CEST 2020
Add flat tree test case to cover devfdt_get_addr_ptr function.
Signed-off-by: Ovidiu Panait <ovidiu.panait at windriver.com>
---
test/dm/test-fdt.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index 8ef7c7a88e..fc089684ac 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -618,6 +618,24 @@ static int dm_test_fdt_translation(struct unit_test_state *uts)
}
DM_TEST(dm_test_fdt_translation, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+static int dm_test_fdt_get_addr_ptr_flat(struct unit_test_state *uts)
+{
+ struct udevice *gpio, *dev;
+ void *ptr;
+
+ /* Test for missing reg property */
+ ut_assertok(uclass_first_device_err(UCLASS_GPIO, &gpio));
+ ut_assertnull(devfdt_get_addr_ptr(gpio));
+
+ ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev));
+ ptr = devfdt_get_addr_ptr(dev);
+ ut_asserteq_ptr((void *)0x8000, ptr);
+
+ return 0;
+}
+DM_TEST(dm_test_fdt_get_addr_ptr_flat,
+ DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT | DM_TESTF_FLAT_TREE);
+
static int dm_test_fdt_remap_addr_flat(struct unit_test_state *uts)
{
struct udevice *dev;
--
2.17.1
More information about the U-Boot
mailing list