[PATCH 2/2] efi_selftest: conformance test for GetNextVariableName

Ilias Apalodimas ilias.apalodimas at linaro.org
Mon Dec 19 07:55:11 CET 2022


Hi Heinrich

On Sun, 18 Dec 2022 at 08:09, Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
> Test that GetNextVariableName() checks the parameters.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> ---
>  lib/efi_selftest/efi_selftest_variables.c | 35 +++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
>
> diff --git a/lib/efi_selftest/efi_selftest_variables.c b/lib/efi_selftest/efi_selftest_variables.c
> index dc1d5c8f43..c7a3fdbaa6 100644
> --- a/lib/efi_selftest/efi_selftest_variables.c
> +++ b/lib/efi_selftest/efi_selftest_variables.c
> @@ -141,6 +141,41 @@ static int execute(void)
>                 return EFI_ST_FAILURE;
>         }
>         /* Enumerate variables */
> +
> +       ret = runtime->get_next_variable_name(NULL, u"efi_st_var1", &guid);
> +       if (ret != EFI_INVALID_PARAMETER) {
> +               efi_st_error("GetNextVariableName missing parameter check\n");
> +               return EFI_ST_FAILURE;
> +       }
> +
> +       len = 24;
> +       ret = runtime->get_next_variable_name(&len, NULL, &guid);
> +       if (ret != EFI_INVALID_PARAMETER) {
> +               efi_st_error("GetNextVariableName missing parameter check\n");
> +               return EFI_ST_FAILURE;
> +       }
> +
> +       len = 24;
> +       ret = runtime->get_next_variable_name(&len, u"efi_st_var1", NULL);
> +       if (ret != EFI_INVALID_PARAMETER) {
> +               efi_st_error("GetNextVariableName missing parameter check\n");
> +               return EFI_ST_FAILURE;
> +       }
> +
> +       len = 1;
> +       ret = runtime->get_next_variable_name(&len, u"", &guid);
> +       if (ret != EFI_INVALID_PARAMETER) {
> +               efi_st_error("GetNextVariableName missing parameter check\n");
> +               return EFI_ST_FAILURE;
> +       }
> +
> +       len = 16;
> +       ret = runtime->get_next_variable_name(&len, u"efi_st_var1", &guid);
> +       if (ret != EFI_INVALID_PARAMETER) {
> +               efi_st_error("GetNextVariableName missing parameter check\n");
> +               return EFI_ST_FAILURE;
> +       }

I am assuming the name or guid don't exist for this test?

Regards
/Ilias
> +
>         boottime->set_mem(&guid, 16, 0);
>         *varname = 0;
>         flag = 0;
> --
> 2.37.2
>


More information about the U-Boot mailing list