mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-02 09:46:37 +03:00
test: dm: fwu_mdata: add test for fwu_mdata_get_image_guid
Add a new unit test for the fwu_mdata_get_image_guid() function. Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
committed by
Patrice Chotard
parent
97cdde6dfa
commit
63fc73ff31
@@ -143,3 +143,51 @@ static int dm_test_fwu_mdata_write(struct unit_test_state *uts)
|
||||
return 0;
|
||||
}
|
||||
DM_TEST(dm_test_fwu_mdata_write, UTF_SCAN_FDT);
|
||||
|
||||
static int dm_test_fwu_mdata_get_image_guid(struct unit_test_state *uts)
|
||||
{
|
||||
efi_guid_t image_type_guid =
|
||||
EFI_GUID(0x09d7cf52, 0x0720, 0x4710, \
|
||||
0x91, 0xd1, 0x08, 0x46, 0x9b, 0x7f, 0xe9, 0xc8);
|
||||
efi_guid_t bank_0_image_guid =
|
||||
EFI_GUID(0x10057a86, 0xdaf1, 0x4f93, \
|
||||
0xba, 0x7f, 0xb1, 0x95, 0xf7, 0xfa, 0x41, 0x70);
|
||||
efi_guid_t bank_1_image_guid =
|
||||
EFI_GUID(0xdb62ed3e, 0x6237, 0x4fb4, \
|
||||
0x80, 0xc4, 0x1b, 0x74, 0xd8, 0x46, 0xa8, 0xe7);
|
||||
efi_guid_t wrong_image_type_guid =
|
||||
EFI_GUID(0x12345678, 0x1302, 0x133f, \
|
||||
0x18, 0x0a, 0x14, 0x05, 0x18, 0x05, 0x14, 0x0b);
|
||||
struct udevice *dev;
|
||||
efi_guid_t image_guid;
|
||||
|
||||
ut_assertok(setup_blk_device(uts));
|
||||
ut_assertok(populate_mmc_disk_image(uts));
|
||||
ut_assertok(write_mmc_blk_device(uts));
|
||||
|
||||
/*
|
||||
* Trigger lib/fwu_updates/fwu.c fwu_boottime_checks()
|
||||
* to populate g_dev global pointer in that library.
|
||||
*/
|
||||
ut_assertok(event_notify_null(EVT_POST_PREBOOT));
|
||||
|
||||
ut_assertok(uclass_first_device_err(UCLASS_FWU_MDATA, &dev));
|
||||
|
||||
ut_assertok(fwu_init());
|
||||
|
||||
ut_assertok(fwu_mdata_get_image_guid(&image_guid, &image_type_guid, 0));
|
||||
ut_assertok(guidcmp(&image_guid, &bank_0_image_guid));
|
||||
|
||||
ut_assertok(fwu_mdata_get_image_guid(&image_guid, &image_type_guid, 1));
|
||||
ut_assertok(guidcmp(&image_guid, &bank_1_image_guid));
|
||||
|
||||
ut_asserteq(-EINVAL, fwu_mdata_get_image_guid(&image_guid,
|
||||
&image_type_guid, 2));
|
||||
|
||||
ut_asserteq(-ENOENT, fwu_mdata_get_image_guid(&image_guid,
|
||||
&wrong_image_type_guid,
|
||||
0));
|
||||
|
||||
return 0;
|
||||
}
|
||||
DM_TEST(dm_test_fwu_mdata_get_image_guid, UTF_SCAN_FDT);
|
||||
|
||||
Reference in New Issue
Block a user