]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_selftest: correct SetVariable() test
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Thu, 26 Sep 2019 19:35:20 +0000 (21:35 +0200)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Sun, 6 Oct 2019 14:02:37 +0000 (16:02 +0200)
Errors should not only be announced as text but should also result in
EFI_ST_FAILURE being returned.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
lib/efi_selftest/efi_selftest_variables.c

index a6b41d1f008d84bf5f591af335b15abe7364e20f..02c9d30a3d40d56de690e2d0d1bf32ff3024ee08 100644 (file)
@@ -120,27 +120,29 @@ static int execute(void)
                                    7, v + 8);
        if (ret != EFI_SUCCESS) {
                efi_st_error("SetVariable(APPEND_WRITE) failed\n");
-       } else {
-               len = EFI_ST_MAX_DATA_SIZE;
-               ret = runtime->get_variable(L"efi_st_var1", &guid_vendor1,
-                                           &attr, &len, data);
-               if (ret != EFI_SUCCESS) {
-                       efi_st_error("GetVariable failed\n");
-                       return EFI_ST_FAILURE;
-               }
-               if (len != 15)
-                       efi_st_todo("GetVariable returned wrong length %u\n",
-                                   (unsigned int)len);
-               if (memcmp(data, v, len))
-                       efi_st_todo("GetVariable returned wrong value\n");
+               return EFI_ST_FAILURE;
+       }
+       len = EFI_ST_MAX_DATA_SIZE;
+       ret = runtime->get_variable(L"efi_st_var1", &guid_vendor1,
+                                   &attr, &len, data);
+       if (ret != EFI_SUCCESS) {
+               efi_st_error("GetVariable failed\n");
+               return EFI_ST_FAILURE;
        }
+       if (len != 15)
+               efi_st_todo("GetVariable returned wrong length %u\n",
+                           (unsigned int)len);
+       if (memcmp(data, v, len))
+               efi_st_todo("GetVariable returned wrong value\n");
        /* Append variable 2 */
        ret = runtime->set_variable(L"efi_none", &guid_vendor1,
                                    EFI_VARIABLE_BOOTSERVICE_ACCESS |
                                    EFI_VARIABLE_APPEND_WRITE,
                                    15, v);
-       if (ret != EFI_NOT_FOUND)
+       if (ret != EFI_NOT_FOUND) {
                efi_st_error("SetVariable(APPEND_WRITE) with size 0 to non-existent variable returns wrong code\n");
+               return EFI_ST_FAILURE;
+       }
        /* Append variable 3 */
        ret = runtime->set_variable(L"PlatformLangCodes", &guid_global,
                                    EFI_VARIABLE_BOOTSERVICE_ACCESS |