mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-20 11:55:03 +00:00
lib: uuid: introduce testcase for uuid_str_to_le_bin
provide a test case Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> Reviewed-by: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com>
This commit is contained in:
parent
7048f26ccb
commit
b83dc8df64
3 changed files with 47 additions and 0 deletions
|
@ -1605,6 +1605,11 @@ T: git https://source.denx.de/u-boot/custodians/u-boot-usb.git topic-xhci
|
||||||
F: drivers/usb/host/xhci*
|
F: drivers/usb/host/xhci*
|
||||||
F: include/usb/xhci.h
|
F: include/usb/xhci.h
|
||||||
|
|
||||||
|
UUID testing
|
||||||
|
M: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||||
|
S: Maintained
|
||||||
|
F: test/lib/uuid.c
|
||||||
|
|
||||||
VIDEO
|
VIDEO
|
||||||
M: Anatolij Gustschin <agust@denx.de>
|
M: Anatolij Gustschin <agust@denx.de>
|
||||||
S: Maintained
|
S: Maintained
|
||||||
|
|
|
@ -22,6 +22,7 @@ obj-$(CONFIG_AES) += test_aes.o
|
||||||
obj-$(CONFIG_GETOPT) += getopt.o
|
obj-$(CONFIG_GETOPT) += getopt.o
|
||||||
obj-$(CONFIG_CRC8) += test_crc8.o
|
obj-$(CONFIG_CRC8) += test_crc8.o
|
||||||
obj-$(CONFIG_UT_LIB_CRYPT) += test_crypt.o
|
obj-$(CONFIG_UT_LIB_CRYPT) += test_crypt.o
|
||||||
|
obj-$(CONFIG_LIB_UUID) += uuid.o
|
||||||
else
|
else
|
||||||
obj-$(CONFIG_SANDBOX) += kconfig_spl.o
|
obj-$(CONFIG_SANDBOX) += kconfig_spl.o
|
||||||
endif
|
endif
|
||||||
|
|
41
test/lib/uuid.c
Normal file
41
test/lib/uuid.c
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0+
|
||||||
|
/*
|
||||||
|
* Functional tests for UCLASS_FFA class
|
||||||
|
*
|
||||||
|
* Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <common.h>
|
||||||
|
#include <uuid.h>
|
||||||
|
#include <test/lib.h>
|
||||||
|
#include <test/test.h>
|
||||||
|
#include <test/ut.h>
|
||||||
|
|
||||||
|
/* test UUID */
|
||||||
|
#define TEST_SVC_UUID "ed32d533-4209-99e6-2d72-cdd998a79cc0"
|
||||||
|
|
||||||
|
#define UUID_SIZE 16
|
||||||
|
|
||||||
|
/* The UUID binary data (little-endian format) */
|
||||||
|
static const u8 ref_uuid_bin[UUID_SIZE] = {
|
||||||
|
0x33, 0xd5, 0x32, 0xed,
|
||||||
|
0x09, 0x42, 0xe6, 0x99,
|
||||||
|
0x72, 0x2d, 0xc0, 0x9c,
|
||||||
|
0xa7, 0x98, 0xd9, 0xcd
|
||||||
|
};
|
||||||
|
|
||||||
|
static int lib_test_uuid_to_le(struct unit_test_state *uts)
|
||||||
|
{
|
||||||
|
const char *uuid_str = TEST_SVC_UUID;
|
||||||
|
u8 ret_uuid_bin[UUID_SIZE] = {0};
|
||||||
|
|
||||||
|
ut_assertok(uuid_str_to_le_bin(uuid_str, ret_uuid_bin));
|
||||||
|
ut_asserteq_mem(ref_uuid_bin, ret_uuid_bin, UUID_SIZE);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
LIB_TEST(lib_test_uuid_to_le, 0);
|
Loading…
Add table
Reference in a new issue