diff options
author | Chunfeng Yun <chunfeng.yun@mediatek.com> | 2020-05-02 11:35:10 +0200 |
---|---|---|
committer | Marek Vasut <marek.vasut+renesas@gmail.com> | 2020-05-02 12:32:28 +0200 |
commit | bf6ad91629d05c58c99d0cd763f865ae0670102a (patch) | |
tree | 6419c319235bc671e6a871f9c4cb40b84c1d5fa2 /test/dm | |
parent | 89b84b85e9c5d80e1b5eb5b52cc6596ba32135c7 (diff) | |
download | u-boot-bf6ad91629d05c58c99d0cd763f865ae0670102a.tar.gz |
test: dm: add test item for ofnode_get_child_count()
Add a test item for ofnode_get_child_count()
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Weijie Gao <weijie.gao@mediatek.com>
Diffstat (limited to 'test/dm')
-rw-r--r-- | test/dm/ofnode.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c index 1c49eaf38b..07d5c7d7a6 100644 --- a/test/dm/ofnode.c +++ b/test/dm/ofnode.c @@ -113,3 +113,24 @@ static int dm_test_ofnode_read_chosen(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_ofnode_read_chosen, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + +static int dm_test_ofnode_get_child_count(struct unit_test_state *uts) +{ + ofnode node, child_node; + u32 val; + + node = ofnode_path("/i-test"); + ut_assert(ofnode_valid(node)); + + val = ofnode_get_child_count(node); + ut_asserteq(3, val); + + child_node = ofnode_first_subnode(node); + ut_assert(ofnode_valid(child_node)); + val = ofnode_get_child_count(child_node); + ut_asserteq(0, val); + + return 0; +} +DM_TEST(dm_test_ofnode_get_child_count, + DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); |