mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 09:12:08 +02:00
test: unit test for efi_create_indexed_name()
Provide a unit test for function efi_create_indexed_name(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <charset.h>
|
#include <charset.h>
|
||||||
#include <command.h>
|
#include <command.h>
|
||||||
|
#include <efi_loader.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <log.h>
|
#include <log.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
@@ -594,6 +595,24 @@ static int unicode_test_u16_strsize(struct unit_test_state *uts)
|
|||||||
}
|
}
|
||||||
UNICODE_TEST(unicode_test_u16_strsize);
|
UNICODE_TEST(unicode_test_u16_strsize);
|
||||||
|
|
||||||
|
#ifdef CONFIG_EFI_LOADER
|
||||||
|
static int unicode_test_efi_create_indexed_name(struct unit_test_state *uts)
|
||||||
|
{
|
||||||
|
u16 buf[16];
|
||||||
|
u16 const expected[] = L"Capsule0AF9";
|
||||||
|
u16 *pos;
|
||||||
|
|
||||||
|
memset(buf, 0xeb, sizeof(buf));
|
||||||
|
pos = efi_create_indexed_name(buf, "Capsule", 0x0af9);
|
||||||
|
|
||||||
|
ut_asserteq_mem(expected, buf, sizeof(expected));
|
||||||
|
ut_asserteq(pos - buf, u16_strnlen(buf, SIZE_MAX));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
UNICODE_TEST(unicode_test_efi_create_indexed_name);
|
||||||
|
#endif
|
||||||
|
|
||||||
int do_ut_unicode(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
|
int do_ut_unicode(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
|
||||||
{
|
{
|
||||||
struct unit_test *tests = ll_entry_start(struct unit_test, unicode_test);
|
struct unit_test *tests = ll_entry_start(struct unit_test, unicode_test);
|
||||||
|
Reference in New Issue
Block a user