diff options
author | Ilias Apalodimas <ilias.apalodimas@linaro.org> | 2024-04-25 08:18:21 +0300 |
---|---|---|
committer | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2024-05-01 08:39:18 +0200 |
commit | 7b8fad51715ea77785b772ae6a62e08ac5c0027e (patch) | |
tree | 3fc4e0578b15fec7c8e6206e5f95ea2f68f78140 /lib | |
parent | 6b2aaf8d031a364ea35b3e4e89a55ac9a7c5dc01 (diff) | |
download | u-boot-7b8fad51715ea77785b772ae6a62e08ac5c0027e.zip u-boot-7b8fad51715ea77785b772ae6a62e08ac5c0027e.tar.gz u-boot-7b8fad51715ea77785b772ae6a62e08ac5c0027e.tar.bz2 |
efi_selftest: add tests for QueryVariableInfo at boottime
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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/efi_selftest/efi_selftest_variables.c | 13 | ||||
-rw-r--r-- | lib/efi_selftest/efi_selftest_variables_common.c | 3 |
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/efi_selftest/efi_selftest_variables.c b/lib/efi_selftest/efi_selftest_variables.c index 39ad03a0..3d5f38c 100644 --- a/lib/efi_selftest/efi_selftest_variables.c +++ b/lib/efi_selftest/efi_selftest_variables.c @@ -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 */ diff --git a/lib/efi_selftest/efi_selftest_variables_common.c b/lib/efi_selftest/efi_selftest_variables_common.c index e29a4be..453bc87 100644 --- a/lib/efi_selftest/efi_selftest_variables_common.c +++ b/lib/efi_selftest/efi_selftest_variables_common.c @@ -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, |