diff mbox series

[3/3] efi_selftest: add tests for QueryVariableInfo at boottime

Message ID 20240424050351.318724-3-ilias.apalodimas@linaro.org
State Superseded
Headers show
Series [1/3] efi_loader: enable QueryVariableInfo at runtime for file backed variables | expand

Commit Message

Ilias Apalodimas April 24, 2024, 5:03 a.m. UTC
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        | 11 ++++-------
 lib/efi_selftest/efi_selftest_variables_common.c |  3 +++
 2 files changed, 7 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/lib/efi_selftest/efi_selftest_variables.c b/lib/efi_selftest/efi_selftest_variables.c
index 39ad03a090d4..3c55938be1ce 100644
--- a/lib/efi_selftest/efi_selftest_variables.c
+++ b/lib/efi_selftest/efi_selftest_variables.c
@@ -52,14 +52,11 @@  static int execute(void)
 	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);
+	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 36bdfe6ff9c3..435ccf4ac13a 100644
--- a/lib/efi_selftest/efi_selftest_variables_common.c
+++ b/lib/efi_selftest/efi_selftest_variables_common.c
@@ -22,6 +22,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_BOOTSERVICE_ACCESS,