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 57DA3AC1218 for ; Wed, 8 May 2024 15:29:46 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=xXVOttEwtdMbAMmYPiUZbwkqttV2s7mIIkAE4QtQt5o=; 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=1715182184; v=1; b=jhbvGipHd+Zi2z76yIul0n+DRcX5OHrqqIbKvP9rfzNIFRmeNh9iHjLAqgwE2PNIbTfPie2J o2d7w7i9puwlcZ52sqyjlSS+OCNmXNRTAVWTyOy+E7O/WPaNZ/AjlIbon3yeGPDkvF4xq3CJby2 swPWvVNZWGeZ7OVIDG9ltY/V9GQ9I+BKHg480iVnNG7zeyX2u/gSTjlTBs2FzAMm408p7lbo2u0 X/2307dWB2X2+cfjkmiR0pd0Rc0qfqC0UJpAnCPFu7mwG2qm+8JOR2q8cYbcpwQFLDNmnFVHhXM TsnoTpPdt+CnA1ME5kXMOeooUPvAjgxyrpDR7BDDZtloA== X-Received: by 127.0.0.2 with SMTP id WMKuYY7687511xkDyumfnMo2; Wed, 08 May 2024 08:29:44 -0700 X-Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by mx.groups.io with SMTP id smtpd.web10.15718.1715182180203767102 for ; Wed, 08 May 2024 08:29:40 -0700 X-Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1ec4b2400b6so39078465ad.3 for ; Wed, 08 May 2024 08:29:40 -0700 (PDT) X-Gm-Message-State: szPdA96O1oh2yns8DeB2reDBx7686176AA= X-Google-Smtp-Source: AGHT+IHjQKqQNBcoO/B46qU5SMN6tF4G+3DzPD3ulNvpgv2g6Lx2JhVcOhqV0PzO0uUVNabr+I0zmg== X-Received: by 2002:a17:902:ccd2:b0:1e7:b7ea:2d61 with SMTP id d9443c01a7336-1eeb06961cfmr38989165ad.37.1715182179500; Wed, 08 May 2024 08:29:39 -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 kt7-20020a170903088700b001e862f0b319sm12032291plb.264.2024.05.08.08.29.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 08:29:39 -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 v1 13/14] MdePkg: Add MockHash2 Protocol for testing Date: Wed, 8 May 2024 08:29:24 -0700 Message-Id: <20240508152925.741226-14-doug.edk2@gmail.com> In-Reply-To: <20240508152925.741226-1-doug.edk2@gmail.com> References: <20240508152925.741226-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 08:29:40 -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=jhbvGipH; 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 (#118686): https://edk2.groups.io/g/devel/message/118686 Mute This Topic: https://groups.io/mt/105983253/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-