summaryrefslogtreecommitdiff
path: root/test/dm/ofnode.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-06-01 10:22:42 -0600
committerTom Rini <trini@konsulko.com>2023-07-14 12:54:51 -0400
commita8f2ac2ae6f15b675a55bcf3a20181f3bb223562 (patch)
tree022b4468cec581d4b7457507dd787d656a709eb1 /test/dm/ofnode.c
parentc8a4e293863348c27d0119cbbe425b91d500cec1 (diff)
downloadu-boot-a8f2ac2ae6f15b675a55bcf3a20181f3bb223562.tar.gz
u-boot-a8f2ac2ae6f15b675a55bcf3a20181f3bb223562.tar.bz2
u-boot-a8f2ac2ae6f15b675a55bcf3a20181f3bb223562.zip
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 <sjg@chromium.org>
Diffstat (limited to 'test/dm/ofnode.c')
-rw-r--r--test/dm/ofnode.c19
1 files changed, 19 insertions, 0 deletions
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);