From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A469DC001E0 for ; Thu, 27 Jul 2023 16:08:52 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E0E5E86213; Thu, 27 Jul 2023 18:08:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 670DB8686B; Thu, 27 Jul 2023 18:07:38 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 5CC8286865 for ; Thu, 27 Jul 2023 18:07:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=abdellatif.elkhlifi@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D3DE7D75; Thu, 27 Jul 2023 09:08:12 -0700 (PDT) Received: from e130802.cambridge.arm.com (e130802.arm.com [10.1.31.58]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 347D43F5A1; Thu, 27 Jul 2023 09:07:28 -0700 (PDT) From: Abdellatif El Khlifi To: trini@konsulko.com Cc: abdellatif.elkhlifi@arm.com, ilias.apalodimas@linaro.org, jens.wiklander@linaro.org, nd@arm.com, sjg@chromium.org, u-boot@lists.denx.de Subject: [PATCH v17 03/10] lib: uuid: introduce testcase for uuid_str_to_le_bin Date: Thu, 27 Jul 2023 17:07:05 +0100 Message-Id: <20230727160712.81477-4-abdellatif.elkhlifi@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230727160712.81477-1-abdellatif.elkhlifi@arm.com> References: <20230726160635.GS3630934@bill-the-cat> <20230727160712.81477-1-abdellatif.elkhlifi@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean provide a test case Signed-off-by: Abdellatif El Khlifi Reviewed-by: Simon Glass Cc: Tom Rini --- Changelog: =============== v16: * MAINTAINERS: place the UUID part in an alphabetical order v11: * use ut_asserteq_mem() MAINTAINERS | 5 +++++ test/lib/Makefile | 1 + test/lib/uuid.c | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 test/lib/uuid.c diff --git a/MAINTAINERS b/MAINTAINERS index d724b64673..4324965d26 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1555,6 +1555,11 @@ T: git https://source.denx.de/u-boot/custodians/u-boot-usb.git topic-xhci F: drivers/usb/host/xhci* F: include/usb/xhci.h +UUID testing +M: Abdellatif El Khlifi +S: Maintained +F: test/lib/uuid.c + VIDEO M: Anatolij Gustschin S: Maintained diff --git a/test/lib/Makefile b/test/lib/Makefile index e0bd9e04e8..e75a263e6a 100644 --- a/test/lib/Makefile +++ b/test/lib/Makefile @@ -22,6 +22,7 @@ obj-$(CONFIG_AES) += test_aes.o obj-$(CONFIG_GETOPT) += getopt.o obj-$(CONFIG_CRC8) += test_crc8.o obj-$(CONFIG_UT_LIB_CRYPT) += test_crypt.o +obj-$(CONFIG_LIB_UUID) += uuid.o else obj-$(CONFIG_SANDBOX) += kconfig_spl.o endif diff --git a/test/lib/uuid.c b/test/lib/uuid.c new file mode 100644 index 0000000000..e24331a136 --- /dev/null +++ b/test/lib/uuid.c @@ -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 + * + * Authors: + * Abdellatif El Khlifi + */ + +#include +#include +#include +#include +#include + +/* 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); -- 2.25.1