diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-04-27 01:02:02 +0900 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-05-07 15:49:52 -0400 |
commit | 04ca871459da53930a81509c53724ccfa7101118 (patch) | |
tree | 3752b90ec08b52e53c2691a7c75bd793703509c7 /test/dm | |
parent | 99552c343576051c9edcf5c9f3fe4186d5c76029 (diff) | |
download | u-boot-04ca871459da53930a81509c53724ccfa7101118.zip u-boot-04ca871459da53930a81509c53724ccfa7101118.tar.gz u-boot-04ca871459da53930a81509c53724ccfa7101118.tar.bz2 |
test: ofnode: test ofnode_device_is_compatible()
Test ofnode_device_is_compatible(), and also ofnode_path().
Requested-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/dm')
-rw-r--r-- | test/dm/Makefile | 1 | ||||
-rw-r--r-- | test/dm/ofnode.c | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/test/dm/Makefile b/test/dm/Makefile index f500bf1..5511a85 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 0000000..8db1f98 --- /dev/null +++ b/test/dm/ofnode.c @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include <common.h> +#include <dm.h> +#include <dm/test.h> +#include <test/ut.h> + +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); |