efi_selftest: fix test_hii_string_get_string()
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Tue, 19 Mar 2019 19:08:46 +0000 (20:08 +0100)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Wed, 20 Mar 2019 17:16:53 +0000 (18:16 +0100)
The check testing the string result of get_string() returned the wrong
result. The result was ignored.

Use efi_st_strcmp_16_8() for the string comparison.

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

index 8a0b3bc3536ff3e646250cd9988bc07475784b14..f4b70f795085e8245d61d4c7afdf6c922897980c 100644 (file)
@@ -783,19 +783,10 @@ static int test_hii_string_get_string(void)
                goto out;
        }
 
-#if 1
-       u16 *c1, *c2;
-
-       for (c1 = string, c2 = L"Japanese"; *c1 == *c2; c1++, c2++)
-               ;
-       if (!*c1 && !*c2)
-               result = EFI_ST_SUCCESS;
-       else
-               result = EFI_ST_FAILURE;
-#else
-       /* TODO: %ls */
-       efi_st_printf("got string is %s (can be wrong)\n", string);
-#endif
+       if (efi_st_strcmp_16_8(string, "Japanese")) {
+               efi_st_error("get_string returned incorrect string\n");
+               goto out;
+       }
 
        result = EFI_ST_SUCCESS;