Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

of: unittest: Check tree matches original after reverting a changeset

Enhance the changeset unittest to ensure after a revert, the tree matches
the original tree before the changeset was applied. Specifically, check an
added node is removed, a removed property is added back, and an updated
property has its original value.

Signed-off-by: Rob Herring <robh@kernel.org>

+13
+13
drivers/of/unittest.c
··· 797 797 static void __init of_unittest_changeset(void) 798 798 { 799 799 #ifdef CONFIG_OF_DYNAMIC 800 + int ret; 800 801 struct property *ppadd, padd = { .name = "prop-add", .length = 1, .value = "" }; 801 802 struct property *ppname_n1, pname_n1 = { .name = "name", .length = 3, .value = "n1" }; 802 803 struct property *ppname_n2, pname_n2 = { .name = "name", .length = 3, .value = "n2" }; ··· 808 807 static const char * const str_array[] = { "str1", "str2", "str3" }; 809 808 const u32 u32_array[] = { 1, 2, 3 }; 810 809 struct of_changeset chgset; 810 + const char *propstr = NULL; 811 811 812 812 n1 = __of_node_dup(NULL, "n1"); 813 813 unittest(n1, "testcase setup failure\n"); ··· 887 885 of_node_put(np); 888 886 889 887 unittest(!of_changeset_revert(&chgset), "revert failed\n"); 888 + 889 + unittest(!of_find_node_by_path("/testcase-data/changeset/n2/n21"), 890 + "'%pOF' still present after revert\n", n21); 891 + 892 + ppremove = of_find_property(parent, "prop-remove", NULL); 893 + unittest(ppremove, "failed to find removed prop after revert\n"); 894 + 895 + ret = of_property_read_string(parent, "prop-update", &propstr); 896 + unittest(!ret, "failed to find updated prop after revert\n"); 897 + if (!ret) 898 + unittest(strcmp(propstr, "hello") == 0, "original value not in updated property after revert"); 890 899 891 900 of_changeset_destroy(&chgset); 892 901