On 12/13/22 22:39, Vincent Stehlé wrote:
Add a test for the case when the HII database protocol
get_package_list_handle() function is called with an invalid package list
handle.

Signed-off-by: Vincent Stehlé <vincent.ste...@arm.com>
Cc: Heinrich Schuchardt <xypron.g...@gmx.de>
Cc: Ilias Apalodimas <ilias.apalodi...@linaro.org>
---
  lib/efi_selftest/efi_selftest_hii.c | 10 ++++++++++
  1 file changed, 10 insertions(+)

diff --git a/lib/efi_selftest/efi_selftest_hii.c 
b/lib/efi_selftest/efi_selftest_hii.c
index eaf3b0995d4..8a038d9f534 100644
--- a/lib/efi_selftest/efi_selftest_hii.c
+++ b/lib/efi_selftest/efi_selftest_hii.c
@@ -605,6 +605,16 @@ static int test_hii_database_get_package_list_handle(void)
                goto out;
        }

+       /* Invalid package list handle. */
+       driver_handle = NULL;
+       ret = hii_database_protocol->get_package_list_handle(
+                       hii_database_protocol, NULL, &driver_handle);
+       if (ret != EFI_INVALID_PARAMETER) {

Here it is unclear, if you get EFI_INVALID_PARAMETER because the
PackageListHandle is invalid or DriverHandle is NULL.

We should test both cases separately.

Best regards

Heinrich

+               efi_st_error("get_package_list_handle returned %u not 
invalid\n",
+                            (unsigned int)ret);
+               goto out;
+       }
+
        result = EFI_ST_SUCCESS;

  out:

Reply via email to