Skip to content

Commit

Permalink
of: Allow overlay kunit tests to run CONFIG_OF_OVERLAY=n
Browse files Browse the repository at this point in the history
Some configurations want to enable CONFIG_KUNIT without enabling
CONFIG_OF_OVERLAY. The kunit overlay code already skips if
CONFIG_OF_OVERLAY isn't enabled, so this select here isn't really doing
anything besides making it easier to run the tests without them
skipping. Remove the select and move the config setting to the
drivers/of/.kunitconfig file so that the overlay tests can be run with
or without CONFIG_OF_OVERLAY set to test either behavior.

Fixes: 5c9dd72 ("of: Add a KUnit test for overlays and test managed APIs")
Signed-off-by: Stephen Boyd <[email protected]>
Acked-by: Geert Uytterhoeven <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rob Herring (Arm) <[email protected]>
  • Loading branch information
bebarino authored and robherring committed Nov 15, 2024
1 parent 6e0391e commit 332857f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions drivers/of/.kunitconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
CONFIG_KUNIT=y
CONFIG_OF=y
CONFIG_OF_KUNIT_TEST=y
CONFIG_OF_OVERLAY=y
CONFIG_OF_OVERLAY_KUNIT_TEST=y
2 changes: 1 addition & 1 deletion drivers/of/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ config OF_OVERLAY_KUNIT_TEST
tristate "Device Tree overlay KUnit tests" if !KUNIT_ALL_TESTS
depends on KUNIT
default KUNIT_ALL_TESTS
select OF_OVERLAY
select DTC
help
This option builds KUnit unit tests for the device tree overlay code.

Expand Down
2 changes: 2 additions & 0 deletions drivers/of/overlay_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ static void of_overlay_apply_kunit_cleanup(struct kunit *test)
struct device_node *np;

of_root_kunit_skip(test);
if (!IS_ENABLED(CONFIG_OF_OVERLAY))
kunit_skip(test, "requires CONFIG_OF_OVERLAY to apply overlay");
if (!IS_ENABLED(CONFIG_OF_EARLY_FLATTREE))
kunit_skip(test, "requires CONFIG_OF_EARLY_FLATTREE for root node");

Expand Down

0 comments on commit 332857f

Please sign in to comment.