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 8799A78003C for ; Fri, 24 May 2024 05:45:32 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=sD9DgRhkZBqYtRnVGXl2xc5VQQJhmqdrZp5TG0wMaJQ=; 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=1716529531; v=1; b=2fbcupHEu53qYj3RBRStrLiZ9zKRBOtR948rF3Qx+A6MZJEPcHhZzpAqny2HMvu/iN3epp/D 2O8rCGGhJ1YoFRf4fKk40zh7VDv1DITY/4Xf49PjtImHK1iIeQ3jh3qqB/vhW9A2192buPISHuG WahlLjWg0e0mmuqIi+hGZPQoOZHGtPR6n4Zc48si4a3LmmyJlQzI335rxl+i5XNnnalQwHyCFTj cvjFgFP5cqXekxjZTuQRXv/Bvye+0hF1wHGU4TPK7JQeBzR5xThOB2uOO5B+lguZcKa5zTgRc3c hBvKq+qOShsUj8cbS64Ph4lHP6/1htl3BKpCh6GHFWzBg== X-Received: by 127.0.0.2 with SMTP id vbQlYY7687511xmdMci2gA3C; Thu, 23 May 2024 22:45:31 -0700 X-Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by mx.groups.io with SMTP id smtpd.web10.9220.1716529527781070411 for ; Thu, 23 May 2024 22:45:27 -0700 X-Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-6f8f34cb0beso338184b3a.1 for ; Thu, 23 May 2024 22:45:27 -0700 (PDT) X-Gm-Message-State: c697Zc6GFBNHwUbZa0EqL0C9x7686176AA= X-Google-Smtp-Source: AGHT+IE8kp1aoVr5YWlF7zpPT3swG3KHcZy7P91HkKiWGM1IXAs1w56JLDjgglrDjhtdv7/rT4O7xg== X-Received: by 2002:a05:6a20:2589:b0:1b0:c1:d8be with SMTP id adf61e73a8af0-1b212ca8a78mr2179716637.1.1716529526942; Thu, 23 May 2024 22:45:26 -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-6f8fcfe64a4sm471919b3a.158.2024.05.23.22.45.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 22:45:26 -0700 (PDT) From: "Doug Flick via groups.io" X-Google-Original-From: Flickdm To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao , Zhiguang Liu Subject: [edk2-devel] [PATCH v3 12/20] MdePkg: Add MockHash2 Protocol for testing Date: Thu, 23 May 2024 22:45:04 -0700 Message-Id: <20240524054512.523329-13-douglas.flick@microsoft.com> In-Reply-To: <20240524054512.523329-1-douglas.flick@microsoft.com> References: <20240524054512.523329-1-douglas.flick@microsoft.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: Thu, 23 May 2024 22:45:27 -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=2fbcupHE; 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 allows the unit tests to pick up the new protocol and use it for testing. 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 0000000000..b44d341332 --- /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 0000000000..5cf94c43b4 --- /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 (#119239): https://edk2.groups.io/g/devel/message/119239 Mute This Topic: https://groups.io/mt/106276864/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-