From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 420E97803CC for ; Thu, 9 May 2024 05:56:52 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=tNnrcW0p1S+YuzQCK/lU9sbI5KMKkGjXeAJSXpsXh9Y=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1715234210; v=1; b=C2mdUCyTyNu6n1ZoWbkCpfsoT6gT6mkVTaeIgYTS1WRtRWUpNWkgzvalDmPJUvhjyCvD2IMY S+hgKQ4S++IAWhk0Xnnmw1iy8zcJnyI0qYyfbUJtRFOig+WkxvXWO1pdz98QjVWZCHVdfyqfBaA Xrid6lvOZ6pg32oXI3tgrZy2XxVKK9YjQiXl81X7gECfF+58nHLN9Uz/wmTDlpLMQdi96GvCOmc 05xVlYl6+41+qZKS/dGB+b0GuRKcat+5UHMoof9H+Fz9i5ryaFQDqDoch+fcm93fOwm2R/sqjAQ YeKlLnQY7qgBAK/0LWcDNI+zzXPjVj9X35LJE3tlhStDQ== X-Received: by 127.0.0.2 with SMTP id iD0UYY7687511xjT0p7ji50T; Wed, 08 May 2024 22:56:50 -0700 X-Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by mx.groups.io with SMTP id smtpd.web10.3659.1715234206790566677 for ; Wed, 08 May 2024 22:56:46 -0700 X-Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-6f449ea8e37so465899b3a.3 for ; Wed, 08 May 2024 22:56:46 -0700 (PDT) X-Gm-Message-State: ZiXjjVCYz5LfEfLBw7rN6oRHx7686176AA= X-Google-Smtp-Source: AGHT+IH83aruUNruparElQriHYHA7NQEvxDCDVJl3jrF9bmgo+0GXHT6lT+6SC1aYd6+31fDdMFQUw== X-Received: by 2002:aa7:8102:0:b0:6f4:bbba:1155 with SMTP id d2e1a72fcca58-6f4bbba1259mr3439524b3a.3.1715234206108; Wed, 08 May 2024 22:56:46 -0700 (PDT) X-Received: from localhost.localdomain (c-67-160-15-86.hsd1.wa.comcast.net. [67.160.15.86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2b26cf5sm525611b3a.195.2024.05.08.22.56.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 22:56:45 -0700 (PDT) From: "Doug Flick via groups.io" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao , Zhiguang Liu Subject: [edk2-devel] [PATCH v2 12/13] MdePkg: Add MockHash2 Protocol for testing Date: Wed, 8 May 2024 22:56:32 -0700 Message-Id: <20240509055633.828642-13-doug.edk2@gmail.com> In-Reply-To: <20240509055633.828642-1-doug.edk2@gmail.com> References: <20240509055633.828642-1-doug.edk2@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Wed, 08 May 2024 22:56:46 -0700 Resent-From: dougflick@microsoft.com Reply-To: devel@edk2.groups.io,dougflick@microsoft.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=C2mdUCyT; dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io From: Doug Flick This commit adds a new MockHash2 protocol to the MdePkg. This protocol is used to test Hash2 protocol consumers. Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Signed-off-by: Doug Flick [MSFT] --- MdePkg/Test/Mock/Include/GoogleTest/Protocol/MockHash2.h | 67 ++++++++++= ++++++++++ MdePkg/Test/Mock/Library/GoogleTest/Protocol/MockHash2.cpp | 27 ++++++++ 2 files changed, 94 insertions(+) diff --git a/MdePkg/Test/Mock/Include/GoogleTest/Protocol/MockHash2.h b/Mde= Pkg/Test/Mock/Include/GoogleTest/Protocol/MockHash2.h new file mode 100644 index 000000000000..b44d341332dc --- /dev/null +++ b/MdePkg/Test/Mock/Include/GoogleTest/Protocol/MockHash2.h @@ -0,0 +1,67 @@ +/** @file=0D + This file declares a mock of Hash2 Protocol.=0D +=0D + Copyright (c) Microsoft Corporation.=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +**/=0D +=0D +#ifndef MOCK_HASH2_H_=0D +#define MOCK_HASH2_H_=0D +=0D +#include =0D +#include =0D +=0D +extern "C" {=0D + #include =0D + #include =0D +}=0D +=0D +struct MockHash2 {=0D + MOCK_INTERFACE_DECLARATION (MockHash2);=0D +=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + GetHashSize,=0D + (IN CONST EFI_HASH2_PROTOCOL *This,=0D + IN CONST EFI_GUID *HashAlgorithm,=0D + OUT UINTN *HashSize)=0D + );=0D +=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + Hash,=0D + (IN CONST EFI_HASH2_PROTOCOL *This,=0D + IN CONST EFI_GUID *HashAlgorithm,=0D + IN CONST UINT8 *Message,=0D + IN UINTN MessageSize,=0D + IN OUT EFI_HASH2_OUTPUT *Hash)=0D + );=0D +=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + HashInit,=0D + (IN CONST EFI_HASH2_PROTOCOL *This,=0D + IN CONST EFI_GUID *HashAlgorithm)=0D + );=0D +=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + HashUpdate,=0D + (IN CONST EFI_HASH2_PROTOCOL *This,=0D + IN CONST UINT8 *Message,=0D + IN UINTN MessageSize)=0D + );=0D +=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + HashFinal,=0D + (IN CONST EFI_HASH2_PROTOCOL *This,=0D + IN OUT EFI_HASH2_OUTPUT *Hash)=0D + );=0D +};=0D +=0D +extern "C" {=0D + extern EFI_HASH2_PROTOCOL *gHash2Protocol;=0D +}=0D +=0D +#endif // MOCK_HASH2_H_=0D diff --git a/MdePkg/Test/Mock/Library/GoogleTest/Protocol/MockHash2.cpp b/M= dePkg/Test/Mock/Library/GoogleTest/Protocol/MockHash2.cpp new file mode 100644 index 000000000000..5cf94c43b4a5 --- /dev/null +++ b/MdePkg/Test/Mock/Library/GoogleTest/Protocol/MockHash2.cpp @@ -0,0 +1,27 @@ +/** @file MockHash2.cpp=0D + Google Test mock for Hash2 Protocol=0D +=0D + Copyright (c) Microsoft Corporation.=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +**/=0D +=0D +#include =0D +=0D +MOCK_INTERFACE_DEFINITION (MockHash2);=0D +MOCK_FUNCTION_DEFINITION (MockHash2, GetHashSize, 3, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION (MockHash2, Hash, 5, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION (MockHash2, HashInit, 2, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION (MockHash2, HashUpdate, 3, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION (MockHash2, HashFinal, 2, EFIAPI);=0D +=0D +EFI_HASH2_PROTOCOL HASH2_PROTOCOL_INSTANCE =3D {=0D + GetHashSize, // EFI_HASH2_GET_HASH_SIZE=0D + Hash, // EFI_HASH2_HASH=0D + HashInit, // EFI_HASH2_HASH_INIT=0D + HashUpdate, // EFI_HASH2_HASH_UPDATE=0D + HashFinal // EFI_HASH2_HASH_FINAL=0D +};=0D +=0D +extern "C" {=0D + EFI_HASH2_PROTOCOL *gHash2Protocol =3D &HASH2_PROTOCOL_INSTANCE;=0D +}=0D --=20 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118727): https://edk2.groups.io/g/devel/message/118727 Mute This Topic: https://groups.io/mt/105996590/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-