]> git.sur5r.net Git - u-boot/blobdiff - test/dm/ofnode.c
test: ofnode: test ofnode_device_is_compatible()
[u-boot] / test / dm / ofnode.c
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);