Add a test calling the LoadImage() UEFI function with both its SourceBuffer
and DevicePath input arguments equal to NULL.

This test can be run on the sandbox with the following command:

  ./u-boot -T -c "setenv efi_selftest load image from file; \
                  bootefi selftest"

Signed-off-by: Vincent Stehlé <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Ilias Apalodimas <[email protected]>
Cc: Tom Rini <[email protected]>
---
 lib/efi_selftest/efi_selftest_loadimage.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/efi_selftest/efi_selftest_loadimage.c 
b/lib/efi_selftest/efi_selftest_loadimage.c
index 967eaa58c69..0e8fc6216f0 100644
--- a/lib/efi_selftest/efi_selftest_loadimage.c
+++ b/lib/efi_selftest/efi_selftest_loadimage.c
@@ -562,6 +562,13 @@ static int execute(void)
                return EFI_ST_FAILURE;
        }
 
+       ret = boottime->load_image(false, handle_image, NULL, NULL, 0,
+                                  &handle);
+       if (ret != EFI_NOT_FOUND) {
+               efi_st_error("Unexpected load_image return value\n");
+               return EFI_ST_FAILURE;
+       }
+
        return EFI_ST_SUCCESS;
 }
 
-- 
2.51.0

Reply via email to