mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-05-05 04:36:13 +02:00
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>
This commit is contained in:
parent
ba1112839a
commit
c7326f9691
@ -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);
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
|
||||
/* Declare a new bootdev test */
|
||||
#define BOOTSTD_TEST(_name, _flags) UNIT_TEST(_name, _flags, bootstd)
|
||||
#define BOOTSTD_TEST_INIT(_name, _flags) UNIT_TEST_INIT(_name, _flags, bootstd)
|
||||
|
||||
#define NVDATA_START_BLK ((0x400 + 0x400) / MMC_MAX_BLOCK_LEN)
|
||||
#define VERSION_START_BLK ((0x400 + 0x800) / MMC_MAX_BLOCK_LEN)
|
||||
@ -35,15 +36,6 @@ struct unit_test_state;
|
||||
*/
|
||||
int bootstd_test_drop_bootdev_order(struct unit_test_state *uts);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
int bootstd_setup_for_tests(void);
|
||||
|
||||
/**
|
||||
* bootstd_test_check_mmc_hunter() - Check that the mmc bootdev hunter was used
|
||||
*
|
||||
|
||||
@ -33,9 +33,6 @@ static int vbe_simple_test_base(struct unit_test_state *uts)
|
||||
ofnode node;
|
||||
u32 vernum;
|
||||
|
||||
/* Set up the VBE info */
|
||||
ut_assertok(bootstd_setup_for_tests());
|
||||
|
||||
/* Read the version back */
|
||||
ut_assertok(vbe_find_by_any("firmware0", &dev));
|
||||
ut_assertok(bootmeth_get_state_desc(dev, info, sizeof(info)));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user