mirror of
https://github.com/u-boot/u-boot.git
synced 2024-11-27 14:14:37 +08:00
fwu: Initialize global fwu library state during CI test
The current CI test worked by sheer luck, the g_dev global pointer in the fwu library was never initialized and the test equally well failed on sandbox64. Trigger the main loop in sandbox tests too to initialize that global state, and move the sandbox specific exit from fwu_boottime_checks after g_dev is initialized. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Acked-by: Sughosh Ganu <sughosh.ganu@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
fa03568e46
commit
95311f7a19
@ -623,18 +623,18 @@ static int fwu_boottime_checks(void *ctx, struct event *event)
|
|||||||
int ret;
|
int ret;
|
||||||
u32 boot_idx, active_idx;
|
u32 boot_idx, active_idx;
|
||||||
|
|
||||||
/* Don't have boot time checks on sandbox */
|
|
||||||
if (IS_ENABLED(CONFIG_SANDBOX)) {
|
|
||||||
boottime_check = 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = uclass_first_device_err(UCLASS_FWU_MDATA, &g_dev);
|
ret = uclass_first_device_err(UCLASS_FWU_MDATA, &g_dev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
log_debug("Cannot find fwu device\n");
|
log_debug("Cannot find fwu device\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Don't have boot time checks on sandbox */
|
||||||
|
if (IS_ENABLED(CONFIG_SANDBOX)) {
|
||||||
|
boottime_check = 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ret = fwu_get_mdata(NULL);
|
ret = fwu_get_mdata(NULL);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
log_debug("Unable to read meta-data\n");
|
log_debug("Unable to read meta-data\n");
|
||||||
|
@ -93,6 +93,12 @@ static int dm_test_fwu_mdata_read(struct unit_test_state *uts)
|
|||||||
struct udevice *dev;
|
struct udevice *dev;
|
||||||
struct fwu_mdata mdata = { 0 };
|
struct fwu_mdata mdata = { 0 };
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Trigger lib/fwu_updates/fwu.c fwu_boottime_checks()
|
||||||
|
* to populate g_dev global pointer in that library.
|
||||||
|
*/
|
||||||
|
event_notify_null(EVT_MAIN_LOOP);
|
||||||
|
|
||||||
ut_assertok(uclass_first_device_err(UCLASS_FWU_MDATA, &dev));
|
ut_assertok(uclass_first_device_err(UCLASS_FWU_MDATA, &dev));
|
||||||
ut_assertok(setup_blk_device(uts));
|
ut_assertok(setup_blk_device(uts));
|
||||||
ut_assertok(populate_mmc_disk_image(uts));
|
ut_assertok(populate_mmc_disk_image(uts));
|
||||||
@ -112,6 +118,12 @@ static int dm_test_fwu_mdata_write(struct unit_test_state *uts)
|
|||||||
struct udevice *dev;
|
struct udevice *dev;
|
||||||
struct fwu_mdata mdata = { 0 };
|
struct fwu_mdata mdata = { 0 };
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Trigger lib/fwu_updates/fwu.c fwu_boottime_checks()
|
||||||
|
* to populate g_dev global pointer in that library.
|
||||||
|
*/
|
||||||
|
event_notify_null(EVT_MAIN_LOOP);
|
||||||
|
|
||||||
ut_assertok(setup_blk_device(uts));
|
ut_assertok(setup_blk_device(uts));
|
||||||
ut_assertok(populate_mmc_disk_image(uts));
|
ut_assertok(populate_mmc_disk_image(uts));
|
||||||
ut_assertok(write_mmc_blk_device(uts));
|
ut_assertok(write_mmc_blk_device(uts));
|
||||||
|
Loading…
Reference in New Issue
Block a user