summaryrefslogtreecommitdiff
path: root/lib/efi_selftest/efi_selftest.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2017-10-13 09:53:58 -0400
committerTom Rini <trini@konsulko.com>2017-10-13 09:53:58 -0400
commitf855a7bc12dc3bdf83905b4c72a6d795ee8d8ee5 (patch)
tree91c1ba0f537f66cf3f5b5c50f5399541bfe1fa85 /lib/efi_selftest/efi_selftest.c
parent26f9184e094541b672f83f23652e2e737d5d0729 (diff)
parentabe994633b2ad56c5eea87c9253873f41dab477d (diff)
Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot
Patch queue for efi - 2017-10-13 This is the second batch of amazing improvements for efi_loader in 2017.11: - New self tests to verify our own code - A few bug fixes - colored text support - event and SNP improvements, should get us close to iPXE working
Diffstat (limited to 'lib/efi_selftest/efi_selftest.c')
-rw-r--r--lib/efi_selftest/efi_selftest.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/lib/efi_selftest/efi_selftest.c b/lib/efi_selftest/efi_selftest.c
index efec832e98..45d8d3d384 100644
--- a/lib/efi_selftest/efi_selftest.c
+++ b/lib/efi_selftest/efi_selftest.c
@@ -35,8 +35,8 @@ void efi_st_exit_boot_services(void)
ret = boottime->get_memory_map(&map_size, NULL, &map_key, &desc_size,
&desc_version);
if (ret != EFI_BUFFER_TOO_SMALL) {
- efi_st_printf("ERROR: GetMemoryMap did not return "
- "EFI_BUFFER_TOO_SMALL\n");
+ efi_st_error(
+ "GetMemoryMap did not return EFI_BUFFER_TOO_SMALL\n");
return;
}
/* Allocate extra space for newly allocated memory */
@@ -44,21 +44,18 @@ void efi_st_exit_boot_services(void)
ret = boottime->allocate_pool(EFI_BOOT_SERVICES_DATA, map_size,
(void **)&memory_map);
if (ret != EFI_SUCCESS) {
- efi_st_printf("ERROR: AllocatePool did not return "
- "EFI_SUCCESS\n");
+ efi_st_error("AllocatePool did not return EFI_SUCCESS\n");
return;
}
ret = boottime->get_memory_map(&map_size, memory_map, &map_key,
&desc_size, &desc_version);
if (ret != EFI_SUCCESS) {
- efi_st_printf("ERROR: GetMemoryMap did not return "
- "EFI_SUCCESS\n");
+ efi_st_error("GetMemoryMap did not return EFI_SUCCESS\n");
return;
}
ret = boottime->exit_boot_services(handle, map_key);
if (ret != EFI_SUCCESS) {
- efi_st_printf("ERROR: ExitBootServices did not return "
- "EFI_SUCCESS\n");
+ efi_st_error("ExitBootServices did not return EFI_SUCCESS\n");
return;
}
efi_st_printf("\nBoot services terminated\n");
@@ -69,17 +66,18 @@ void efi_st_exit_boot_services(void)
*
* @test the test to be executed
* @failures counter that will be incremented if a failure occurs
+ * @return EFI_ST_SUCCESS for success
*/
static int setup(struct efi_unit_test *test, unsigned int *failures)
{
int ret;
if (!test->setup)
- return 0;
+ return EFI_ST_SUCCESS;
efi_st_printf("\nSetting up '%s'\n", test->name);
ret = test->setup(handle, systable);
- if (ret) {
- efi_st_printf("ERROR: Setting up '%s' failed\n", test->name);
+ if (ret != EFI_ST_SUCCESS) {
+ efi_st_error("Setting up '%s' failed\n", test->name);
++*failures;
} else {
efi_st_printf("Setting up '%s' succeeded\n", test->name);
@@ -92,17 +90,18 @@ static int setup(struct efi_unit_test *test, unsigned int *failures)
*
* @test the test to be executed
* @failures counter that will be incremented if a failure occurs
+ * @return EFI_ST_SUCCESS for success
*/
static int execute(struct efi_unit_test *test, unsigned int *failures)
{
int ret;
if (!test->execute)
- return 0;
+ return EFI_ST_SUCCESS;
efi_st_printf("\nExecuting '%s'\n", test->name);
ret = test->execute();
- if (ret) {
- efi_st_printf("ERROR: Executing '%s' failed\n", test->name);
+ if (ret != EFI_ST_SUCCESS) {
+ efi_st_error("Executing '%s' failed\n", test->name);
++*failures;
} else {
efi_st_printf("Executing '%s' succeeded\n", test->name);
@@ -115,17 +114,18 @@ static int execute(struct efi_unit_test *test, unsigned int *failures)
*
* @test the test to be torn down
* @failures counter that will be incremented if a failure occurs
+ * @return EFI_ST_SUCCESS for success
*/
static int teardown(struct efi_unit_test *test, unsigned int *failures)
{
int ret;
if (!test->teardown)
- return 0;
+ return EFI_ST_SUCCESS;
efi_st_printf("\nTearing down '%s'\n", test->name);
ret = test->teardown();
- if (ret) {
- efi_st_printf("ERROR: Tearing down '%s' failed\n", test->name);
+ if (ret != EFI_ST_SUCCESS) {
+ efi_st_error("Tearing down '%s' failed\n", test->name);
++*failures;
} else {
efi_st_printf("Tearing down '%s' succeeded\n", test->name);
@@ -213,7 +213,8 @@ efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle,
efi_st_get_key();
runtime->reset_system(EFI_RESET_WARM, EFI_NOT_READY,
sizeof(reset_message), reset_message);
- efi_st_printf("\nERROR: reset failed.\n");
+ efi_st_printf("\n");
+ efi_st_error("Reset failed.\n");
return EFI_UNSUPPORTED;
}