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 <sjg@chromium.org>
diff --git a/test/boot/bootstd_common.c b/test/boot/bootstd_common.c
index 724e3d9..e28cae7 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 @@
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 @@
{
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);