diff options
Diffstat (limited to 'test/self/of_manipulation.c')
-rw-r--r-- | test/self/of_manipulation.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/test/self/of_manipulation.c b/test/self/of_manipulation.c index 1bcd593c86..8d645b1137 100644 --- a/test/self/of_manipulation.c +++ b/test/self/of_manipulation.c @@ -57,16 +57,27 @@ static void test_of_basics(struct device_node *root) of_property_write_bool(node1, "property1", true); assert_equal(node1, node2); + + of_property_write_bool(node2, "property1", false); + of_property_write_u32(node2, "property1", 1); + of_property_write_u32(node2, "property2", 2); + + of_property_write_u32(node1, "property3", 1); + of_copy_property(node2, "property2", node1); + of_rename_property(node1, "property3", "property1"); + + assert_equal(node1, node2); } static void test_of_property_strings(struct device_node *root) { - struct device_node *np1, *np2, *np3; + struct device_node *np1, *np2, *np3, *np4; char properties[] = "ayy\0bee\0sea"; np1 = of_new_node(root, "np1"); np2 = of_new_node(root, "np2"); np3 = of_new_node(root, "np3"); + np4 = of_new_node(root, "np4"); of_property_sprintf(np1, "property-single", "%c%c%c", 'a', 'y', 'y'); @@ -89,6 +100,14 @@ static void test_of_property_strings(struct device_node *root) of_set_property(np1, "property-multi", properties, sizeof(properties) - 1, 0); assert_different(np1, np2, 1); + + of_append_property(np4, "property-single", "ayy", 4); + + of_append_property(np4, "property-multi", "bee", 4); + of_append_property(np4, "property-multi", "sea", 4); + of_prepend_property(np4, "property-multi", "ayy", 4); + + assert_equal(np3, np4); } static void __init test_of_manipulation(void) @@ -102,6 +121,8 @@ static void __init test_of_manipulation(void) expected = of_unflatten_dtb(__dtb_of_manipulation_start, __dtb_of_manipulation_end - __dtb_of_manipulation_start); + if (WARN_ON(IS_ERR(expected))) + return; assert_equal(root, expected); |