diff mbox series

test: ofnode: test ofnode_device_is_compatible()

Message ID 1524758522-21595-1-git-send-email-yamada.masahiro@socionext.com
State Accepted
Commit 04ca871459da53930a81509c53724ccfa7101118
Headers show
Series test: ofnode: test ofnode_device_is_compatible() | expand

Commit Message

Masahiro Yamada April 26, 2018, 4:02 p.m. UTC
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>
---

 test/dm/Makefile |  1 +
 test/dm/ofnode.c | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+)
 create mode 100644 test/dm/ofnode.c

Comments

Simon Glass April 30, 2018, 11:12 p.m. UTC | #1
On 26 April 2018 at 10:02, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> 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>
> ---
>
>  test/dm/Makefile |  1 +
>  test/dm/ofnode.c | 19 +++++++++++++++++++
>  2 files changed, 20 insertions(+)
>  create mode 100644 test/dm/ofnode.c

Thanks Masahiro, much appreciated.

Reviewed-by: Simon Glass <sjg@chromium.org>
Tom Rini May 8, 2018, 12:45 a.m. UTC | #2
On Fri, Apr 27, 2018 at 01:02:02AM +0900, Masahiro Yamada wrote:

> 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>


Applied to u-boot/master, thanks!

-- 
Tom
diff mbox series

Patch

diff --git a/test/dm/Makefile b/test/dm/Makefile
index 513c456..97c978a 100644
--- a/test/dm/Makefile
+++ b/test/dm/Makefile
@@ -23,6 +23,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..7dd6d88
--- /dev/null
+++ b/test/dm/ofnode.c
@@ -0,0 +1,19 @@ 
+/*
+ * 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);