[PATCH 14/28] test: Update fdt_overlay to do init from tests

Simon Glass sjg at chromium.org
Mon Jan 20 22:53:14 CET 2025


Rather than having an init function and then running the tests, create a
test-init function to do it. This will allow us to get rid of the
command function.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 include/test/fdt_overlay.h            | 4 ++++
 test/fdt_overlay/cmd_ut_fdt_overlay.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/test/fdt_overlay.h b/include/test/fdt_overlay.h
index 34e8020a496..251ad0ec97a 100644
--- a/include/test/fdt_overlay.h
+++ b/include/test/fdt_overlay.h
@@ -12,4 +12,8 @@
 /* Declare a new FDT-overlay test */
 #define FDT_OVERLAY_TEST(_name, _flags)	UNIT_TEST(_name, _flags, fdt_overlay)
 
+/* Declare init for FDT-overlay test */
+#define FDT_OVERLAY_TEST_INIT(_name, _flags)		\
+	UNIT_TEST_INIT(_name, _flags, fdt_overlay)
+
 #endif /* __TEST_OVERLAY_H__ */
diff --git a/test/fdt_overlay/cmd_ut_fdt_overlay.c b/test/fdt_overlay/cmd_ut_fdt_overlay.c
index ac8a3b2be23..c716c6bd6b0 100644
--- a/test/fdt_overlay/cmd_ut_fdt_overlay.c
+++ b/test/fdt_overlay/cmd_ut_fdt_overlay.c
@@ -81,6 +81,7 @@ static int fdt_overlay_init(struct unit_test_state *uts)
 
 	return 0;
 }
+FDT_OVERLAY_TEST_INIT(fdt_overlay_init, 0);
 
 static int fdt_getprop_str(void *fdt, const char *path, const char *name,
 			   const char **out)
@@ -243,7 +244,6 @@ int do_ut_fdt_overlay(struct unit_test_state *uts, struct cmd_tbl *cmdtp,
 	const int n_ents = UNIT_TEST_SUITE_COUNT(fdt_overlay);
 	int ret = -ENOMEM;
 
-	ut_assertok(fdt_overlay_init(uts));
 	ret = cmd_ut_category(uts, "fdt_overlay", "fdt_overlay_test_", tests,
 			      n_ents, argc, argv);
 
-- 
2.43.0



More information about the U-Boot mailing list