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 496E6740034 for ; Wed, 8 May 2024 15:29:44 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=FYixJTOb4L1EZxi+e9CuVCQBWhEzyGxRvjZvfl57Dlw=; 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=1715182182; v=1; b=Rx52pzC2SP1lxQJ9aBC9YAJt1Q7Zyo+EwVw4qFPoByqjMrdGRhf8Tj5zrSI8ObakCgtybOId Ed6I+8qCTZSFKZ42MD8VW/v3nhxOFfobLzpVTCI2H+r+vMHBEDuwLbOtiNxDOKsn4BeVsjUou11 wxYjpUhPBJ3X9+62vgvFMAYUPjWXXKrEYq7i8WhvHX6XXSxuoQle0WSbCH6j1AC0m0fJMsyLm+2 VZrBzm13FflXpK7JuH8LB9XG0nA1CNHfyCvYUoX9bEwTVLLxV/lajz9eQloPupmMgPqs7/ubsDX xLjfw5F6ntrAhM8ITQXzxBKULRMx4WWofg6uX+LzDFa+w== X-Received: by 127.0.0.2 with SMTP id MrbtYY7687511xKxdhTDYWCb; Wed, 08 May 2024 08:29:42 -0700 X-Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by mx.groups.io with SMTP id smtpd.web10.15717.1715182179579235125 for ; Wed, 08 May 2024 08:29:39 -0700 X-Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1e83a2a4f2cso24192685ad.1 for ; Wed, 08 May 2024 08:29:39 -0700 (PDT) X-Gm-Message-State: NucFW6pHRj094ROUfkej82Jsx7686176AA= X-Google-Smtp-Source: AGHT+IFhOhKwR9TIHL6GRxD9nBoB2i4HTCHkTGiydXAi9kGMfXTn/kJCkUn77JkDC99joLPPiApg2g== X-Received: by 2002:a17:902:dacf:b0:1e8:26e4:d089 with SMTP id d9443c01a7336-1eeb09ae5f4mr40143545ad.54.1715182178838; Wed, 08 May 2024 08:29:38 -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.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 08:29:38 -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 12/14] MdePkg: : Adds Protocol for MockRng Date: Wed, 8 May 2024 08:29:23 -0700 Message-Id: <20240508152925.741226-13-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:39 -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=Rx52pzC2; 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 patch adds a protocol for MockRng. This protocol is used to mock the Rng protocol for testing purposes. Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Signed-off-by: Doug Flick [MSFT] --- MdePkg/Test/Mock/Include/GoogleTest/Protocol/MockRng.h | 48 ++++++++++++= ++++++++ MdePkg/Test/Mock/Library/GoogleTest/Protocol/MockRng.cpp | 21 +++++++++ 2 files changed, 69 insertions(+) diff --git a/MdePkg/Test/Mock/Include/GoogleTest/Protocol/MockRng.h b/MdePk= g/Test/Mock/Include/GoogleTest/Protocol/MockRng.h new file mode 100644 index 000000000000..b54f8a234b2f --- /dev/null +++ b/MdePkg/Test/Mock/Include/GoogleTest/Protocol/MockRng.h @@ -0,0 +1,48 @@ +/** @file=0D + This file declares a mock of Rng Protocol.=0D +=0D + Copyright (c) Microsoft Corporation.=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +**/=0D +=0D +#ifndef MOCK_RNG_H_=0D +#define MOCK_RNG_H_=0D +=0D +#include =0D +#include =0D +=0D +extern "C" {=0D + #include =0D + #include =0D +}=0D +=0D +struct MockRng {=0D + MOCK_INTERFACE_DECLARATION (MockRng);=0D +=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + GetInfo,=0D + (=0D + IN EFI_RNG_PROTOCOL *This,=0D + IN OUT UINTN *RNGAlgorithmListSize,=0D + OUT EFI_RNG_ALGORITHM *RNGAlgorithmList=0D + )=0D + );=0D +=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + GetRng,=0D + (=0D + IN EFI_RNG_PROTOCOL *This,=0D + IN EFI_RNG_ALGORITHM *RNGAlgorithm,=0D + IN UINTN RNGValueLength,=0D + OUT UINT8 *RNGValue=0D + )=0D + );=0D +};=0D +=0D +extern "C" {=0D + extern EFI_RNG_PROTOCOL *gRngProtocol;=0D +}=0D +=0D +#endif // MOCK_RNG_H_=0D diff --git a/MdePkg/Test/Mock/Library/GoogleTest/Protocol/MockRng.cpp b/Mde= Pkg/Test/Mock/Library/GoogleTest/Protocol/MockRng.cpp new file mode 100644 index 000000000000..7d8b69cc8673 --- /dev/null +++ b/MdePkg/Test/Mock/Library/GoogleTest/Protocol/MockRng.cpp @@ -0,0 +1,21 @@ +/** @file MockRng.cpp=0D + Google Test mock for Rng Protocol=0D +=0D + Copyright (c) Microsoft Corporation.=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +**/=0D +=0D +#include =0D +=0D +MOCK_INTERFACE_DEFINITION (MockRng);=0D +MOCK_FUNCTION_DEFINITION (MockRng, GetInfo, 3, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION (MockRng, GetRng, 4, EFIAPI);=0D +=0D +EFI_RNG_PROTOCOL RNG_PROTOCOL_INSTANCE =3D {=0D + GetInfo, // EFI_RNG_GET_INFO=0D + GetRng // EFI_RNG_GET_RNG=0D +};=0D +=0D +extern "C" {=0D + EFI_RNG_PROTOCOL *gRngProtocol =3D &RNG_PROTOCOL_INSTANCE;=0D +}=0D --=20 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118685): https://edk2.groups.io/g/devel/message/118685 Mute This Topic: https://groups.io/mt/105983252/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-