test: Update fdt_overlay to do init from tests
authorSimon Glass <sjg@chromium.org>
Fri, 7 Feb 2025 18:30:46 +0000 (11:30 -0700)
committerTom Rini <trini@konsulko.com>
Wed, 12 Feb 2025 02:10:59 +0000 (20:10 -0600)
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@chromium.org>
include/test/fdt_overlay.h
test/fdt_overlay/cmd_ut_fdt_overlay.c

index 34e8020..251ad0e 100644 (file)
@@ -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__ */
index ac8a3b2..c716c6b 100644 (file)
@@ -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);