From: Masahiro Yamada Date: Thu, 26 Apr 2018 16:02:02 +0000 (+0900) Subject: test: ofnode: test ofnode_device_is_compatible() X-Git-Tag: v2018.07-rc1~238 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=04ca871459da53930a81509c53724ccfa7101118;p=u-boot test: ofnode: test ofnode_device_is_compatible() Test ofnode_device_is_compatible(), and also ofnode_path(). Requested-by: Simon Glass Signed-off-by: Masahiro Yamada Reviewed-by: Simon Glass --- diff --git a/test/dm/Makefile b/test/dm/Makefile index f500bf1f88..5511a85700 100644 --- a/test/dm/Makefile +++ b/test/dm/Makefile @@ -21,6 +21,7 @@ obj-$(CONFIG_DM_I2C) += i2c.o obj-$(CONFIG_LED) += led.o obj-$(CONFIG_DM_MAILBOX) += mailbox.o obj-$(CONFIG_DM_MMC) += mmc.o +obj-y += ofnode.o obj-$(CONFIG_DM_PCI) += pci.o obj-$(CONFIG_PHY) += phy.o obj-$(CONFIG_POWER_DOMAIN) += power-domain.o diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c new file mode 100644 index 0000000000..8db1f9857f --- /dev/null +++ b/test/dm/ofnode.c @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include +#include +#include +#include + +static int dm_test_ofnode_compatible(struct unit_test_state *uts) +{ + ofnode root_node = ofnode_path("/"); + + ut_assert(ofnode_valid(root_node)); + ut_assert(ofnode_device_is_compatible(root_node, "sandbox")); + + return 0; +} +DM_TEST(dm_test_ofnode_compatible, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);