]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_selftest: conformance test for GetNextVariableName
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sun, 18 Dec 2022 06:08:58 +0000 (06:08 +0000)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tue, 20 Dec 2022 15:06:48 +0000 (16:06 +0100)
Test that GetNextVariableName() checks the parameters.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
lib/efi_selftest/efi_selftest_variables.c

index dc1d5c8f43e4461e88623fd1bdbc6cf10c81fc32..c7a3fdbaa67d71ff6b6fbd6a72937758af00a094 100644 (file)
@@ -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;
+       }
+
        boottime->set_mem(&guid, 16, 0);
        *varname = 0;
        flag = 0;