summaryrefslogtreecommitdiff
path: root/test/boot/bootstd_common.c
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2025-02-07 11:30:48 -0700
committerTom Rini <[email protected]>2025-02-11 20:10:59 -0600
commitc7326f969178ab2a231944f09d9bfec52f053f44 (patch)
treefecc23322866d60827d8cad69d65e7fd10cced20 /test/boot/bootstd_common.c
parentba1112839ace31b4aed85506cf5fe74256c597df (diff)
test: Update bootstd to do init from tests
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 <[email protected]>
Diffstat (limited to 'test/boot/bootstd_common.c')
-rw-r--r--test/boot/bootstd_common.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/boot/bootstd_common.c b/test/boot/bootstd_common.c
index 724e3d9bdd2..e28cae7f374 100644
--- a/test/boot/bootstd_common.c
+++ b/test/boot/bootstd_common.c
@@ -21,8 +21,14 @@
/* tracks whether bootstd_setup_for_tests() has been run yet */
bool vbe_setup_done;
-/* set up MMC for VBE tests */
-int bootstd_setup_for_tests(void)
+/**
+ * bootstd_setup_for_tests() - Set up MMC data for VBE tests
+ *
+ * Some data is needed for VBE tests to work. This function sets that up.
+ *
+ * @return 0 if OK, -ve on error
+ */
+static int bootstd_setup_for_tests(struct unit_test_state *uts)
{
ALLOC_CACHE_ALIGN_BUFFER(u8, buf, MMC_MAX_BLOCK_LEN);
struct udevice *mmc;
@@ -55,6 +61,7 @@ int bootstd_setup_for_tests(void)
return 0;
}
+BOOTSTD_TEST_INIT(bootstd_setup_for_tests, 0);
int bootstd_test_drop_bootdev_order(struct unit_test_state *uts)
{
@@ -99,13 +106,6 @@ int do_ut_bootstd(struct unit_test_state *uts, struct cmd_tbl *cmdtp, int flag,
{
struct unit_test *tests = UNIT_TEST_SUITE_START(bootstd);
const int n_ents = UNIT_TEST_SUITE_COUNT(bootstd);
- int ret;
-
- ret = bootstd_setup_for_tests();
- if (ret) {
- printf("Failed to set up for bootstd tests (err=%d)\n", ret);
- return CMD_RET_FAILURE;
- }
return cmd_ut_category(uts, "bootstd", "bootstd_",
tests, n_ents, argc, argv);