summaryrefslogtreecommitdiff
path: root/drivers/of/unittest.c
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2023-07-28 10:50:35 +0200
committerRob Herring <robh@kernel.org>2023-08-23 20:04:17 -0500
commiteb38b9529aefa344cbfde25a274c2b6f2931648b (patch)
treeb18e079d8e47b84cd2c5db75b5a5ffcfacad45d3 /drivers/of/unittest.c
parentee32072fd12561b6f5fdf96fef7cf6acc323b564 (diff)
of: overlay: unittest: Add test for unresolved symbol
Add a test to exercise the error paths when trying to apply an overlay with an unresolved symbol and cleaning up the resulting partial state. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/580394587976975770c84411896fce9fbbcf25fa.1690533838.git.geert+renesas@glider.be Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'drivers/of/unittest.c')
-rw-r--r--drivers/of/unittest.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 18ccfdc3dd89..9c0f352cb241 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -3336,6 +3336,7 @@ OVERLAY_INFO_EXTERN(overlay_bad_add_dup_node);
OVERLAY_INFO_EXTERN(overlay_bad_add_dup_prop);
OVERLAY_INFO_EXTERN(overlay_bad_phandle);
OVERLAY_INFO_EXTERN(overlay_bad_symbol);
+OVERLAY_INFO_EXTERN(overlay_bad_unresolved);
/* entries found by name */
static struct overlay_info overlays[] = {
@@ -3372,6 +3373,7 @@ static struct overlay_info overlays[] = {
OVERLAY_INFO(overlay_bad_add_dup_prop, -EINVAL, -ENODEV),
OVERLAY_INFO(overlay_bad_phandle, -EINVAL, 0),
OVERLAY_INFO(overlay_bad_symbol, -EINVAL, -ENODEV),
+ OVERLAY_INFO(overlay_bad_unresolved, -EINVAL, 0),
/* end marker */
{ }
};
@@ -3776,6 +3778,21 @@ static __init void of_unittest_overlay_high_level(void)
EXPECT_END(KERN_ERR,
"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/hvac-medium-2:name");
+ /* --- overlay_bad_unresolved --- */
+
+ EXPECT_BEGIN(KERN_ERR,
+ "OF: resolver: node label 'this_label_does_not_exist' not found in live devicetree symbols table");
+ EXPECT_BEGIN(KERN_ERR,
+ "OF: resolver: overlay phandle fixup failed: -22");
+
+ unittest(overlay_data_apply("overlay_bad_unresolved", NULL),
+ "Adding overlay 'overlay_bad_unresolved' failed\n");
+
+ EXPECT_END(KERN_ERR,
+ "OF: resolver: overlay phandle fixup failed: -22");
+ EXPECT_END(KERN_ERR,
+ "OF: resolver: node label 'this_label_does_not_exist' not found in live devicetree symbols table");
+
return;
err_unlock: