]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_selftest: add tests for QueryVariableInfo at boottime
authorIlias Apalodimas <ilias.apalodimas@linaro.org>
Thu, 25 Apr 2024 05:18:21 +0000 (08:18 +0300)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Wed, 1 May 2024 06:39:18 +0000 (08:39 +0200)
Previous patches added QueryVariableInfo at runtime tests and
split a common function that can be used at boottime. Weire it
up and run a similar set of tets. While at it move a test which is
checiking for 0 available storage in the common code

Add tests for
- Test QueryVariableInfo returns EFI_SUCCESS
- Test null pointers for the function arguments
- Test invalid combination of attributes

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
lib/efi_selftest/efi_selftest_variables.c
lib/efi_selftest/efi_selftest_variables_common.c

index 39ad03a090d477cb7b5b1fece8606e3d9e33400e..3d5f38c689784f79a7d99f0b8881750525c20a08 100644 (file)
@@ -51,15 +51,12 @@ static int execute(void)
        u16 varname[EFI_ST_MAX_VARNAME_SIZE];
        int flag;
        efi_guid_t guid;
-       u64 max_storage, rem_storage, max_size;
+       int test_ret;
 
-       ret = runtime->query_variable_info(EFI_VARIABLE_BOOTSERVICE_ACCESS,
-                                          &max_storage, &rem_storage,
-                                          &max_size);
-       if (ret != EFI_SUCCESS) {
-               efi_st_todo("QueryVariableInfo failed\n");
-       } else if (!max_storage || !rem_storage || !max_size) {
-               efi_st_error("QueryVariableInfo: wrong info\n");
+       test_ret = efi_st_query_variable_common(runtime,
+                                               EFI_VARIABLE_BOOTSERVICE_ACCESS);
+       if (test_ret != EFI_ST_SUCCESS) {
+               efi_st_error("QueryVariableInfo failed\n");
                return EFI_ST_FAILURE;
        }
        /* Set variable 0 */
index e29a4be74a57aa174ce645748bcba95e3771ef08..453bc8709a6faf69ee70884dfea71da563a9dadb 100644 (file)
@@ -23,6 +23,9 @@ int efi_st_query_variable_common(struct efi_runtime_services *runtime,
        if (ret != EFI_SUCCESS) {
                efi_st_error("QueryVariableInfo failed\n");
                return EFI_ST_FAILURE;
+       } else if (!max_storage || !rem_storage || !max_size) {
+               efi_st_error("QueryVariableInfo: wrong info\n");
+               return EFI_ST_FAILURE;
        }
 
        ret = runtime->query_variable_info(EFI_VARIABLE_RUNTIME_ACCESS,