From: Simon Glass <sjg@chromium.org> The 'host load' command calls efi_set_bootdev() which allocates EFI device-path pool memory and logs a free_pool(NULL) entry in the EFI log. If test_source (or another test using 'host load') runs first in the same session, these stale log entries cause bootflow_efi() to fail with EFI_INVALID_PARAMETER when it validates the log. Reset the EFI log at the start of bootflow_efi() so it only checks entries from its own operations. Also move the bloblist_find() call to just before the log-checking loop, since the log may not exist at function entry but may be created during the EFI boot sequence. Signed-off-by: Simon Glass <sjg@chromium.org> --- test/boot/bootflow.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index e1e50319740..9aab3ea807a 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -1393,8 +1393,8 @@ BOOTSTD_TEST(bootflow_android_image_v2, UTF_CONSOLE | UTF_DM | UTF_SCAN_FDT); /* Test EFI bootmeth */ static int bootflow_efi(struct unit_test_state *uts) { - struct efil_hdr *hdr = bloblist_find(BLOBLISTT_EFI_LOG, 0); static const char *order[] = {"mmc1", "usb", NULL}; + struct efil_hdr *hdr; struct efil_rec_hdr *rec_hdr; struct bootstd_priv *std; struct udevice *bootstd; @@ -1402,6 +1402,10 @@ static int bootflow_efi(struct unit_test_state *uts) struct udevice *usb; int i; + /* clear stale entries left by previous tests */ + if (IS_ENABLED(CONFIG_EFI_LOG)) + efi_log_reset(); + ut_assertok(uclass_first_device_err(UCLASS_BOOTSTD, &bootstd)); std = dev_get_priv(bootstd); old_order = std->bootdev_order; @@ -1470,6 +1474,7 @@ static int bootflow_efi(struct unit_test_state *uts) ut_assert(!device_active(usb)); /* check memory allocations are as expected */ + hdr = bloblist_find(BLOBLISTT_EFI_LOG, 0); if (!hdr) return 0; -- 2.43.0