]> git.sur5r.net Git - u-boot/commitdiff
test: ofnode: test ofnode_device_is_compatible()
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Thu, 26 Apr 2018 16:02:02 +0000 (01:02 +0900)
committerTom Rini <trini@konsulko.com>
Mon, 7 May 2018 19:49:52 +0000 (15:49 -0400)
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>
test/dm/Makefile
test/dm/ofnode.c [new file with mode: 0644]

index f500bf1f88a8e7e8d224b6ea8629d36c2f7f3d39..5511a85700c0c24ff95e7cab93523636b22bd24c 100644 (file)
@@ -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 (file)
index 0000000..8db1f98
--- /dev/null
@@ -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);