From a8f2ac2ae6f15b675a55bcf3a20181f3bb223562 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 1 Jun 2023 10:22:42 -0600 Subject: fdt: Allow more general use of livetree At present livetree can only be used for the control FDT. It is useful to be able to use the ofnode API for other FDTs, e.g. those used by the upcoming configuration editor. We already have most of the support present, and tests can be marked with the UT_TESTF_OTHER_FDT flag to use another FDT as a special case. But with this change, the functionality becomes more generally available. Plumb in the require support. Signed-off-by: Simon Glass --- test/dm/ofnode.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test') diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c index 64baaf68db..6fbebc7da0 100644 --- a/test/dm/ofnode.c +++ b/test/dm/ofnode.c @@ -1266,3 +1266,22 @@ static int dm_test_livetree_align(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_livetree_align, UT_TESTF_LIVE_TREE); + +/* check that it is possible to load an arbitrary livetree */ +static int dm_test_livetree_ensure(struct unit_test_state *uts) +{ + oftree tree; + ofnode node; + + /* read from other.dtb */ + ut_assertok(test_load_other_fdt(uts)); + tree = oftree_from_fdt(uts->other_fdt); + ut_assert(oftree_valid(tree)); + node = oftree_path(tree, "/node/subnode"); + ut_assert(ofnode_valid(node)); + ut_asserteq_str("sandbox-other2", + ofnode_read_string(node, "compatible")); + + return 0; +} +DM_TEST(dm_test_livetree_ensure, 0); -- cgit v1.2.3