1 // SPDX-License-Identifier: GPL-2.0+
8 static int dm_test_ofnode_compatible(struct unit_test_state *uts)
10 ofnode root_node = ofnode_path("/");
12 ut_assert(ofnode_valid(root_node));
13 ut_assert(ofnode_device_is_compatible(root_node, "sandbox"));
17 DM_TEST(dm_test_ofnode_compatible, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
19 static int dm_test_ofnode_by_prop_value(struct unit_test_state *uts)
21 const char propname[] = "compatible";
22 const char propval[] = "denx,u-boot-fdt-test";
24 ofnode node = ofnode_null();
26 /* Find first matching node, there should be at least one */
27 node = ofnode_by_prop_value(node, propname, propval, sizeof(propval));
28 ut_assert(ofnode_valid(node));
29 str = ofnode_read_string(node, propname);
30 ut_assert(str && !strcmp(str, propval));
32 /* Find the rest of the matching nodes */
34 node = ofnode_by_prop_value(node, propname, propval,
36 if (!ofnode_valid(node))
38 str = ofnode_read_string(node, propname);
39 ut_assert(str && !strcmp(str, propval));
44 DM_TEST(dm_test_ofnode_by_prop_value, DM_TESTF_SCAN_FDT);