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 ABB98D8026F for ; Thu, 9 May 2024 05:56:50 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Z3aXXegpEPwy7piqox8MIQoDfXU89to1oX+ueN3C8oY=; 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=1715234209; v=1; b=Owpm+LVuoL5gbRQLjMjR8yWMbKlaPnRBevT9L1BGN5uW0Ze5u4bMbfa+d+6eKF7+VcrQRzkK JMIpvjZSxK07TedkDA4munUMpzbibAoK2qIPe9fZ5nl7eQGFekjI61V0AFoe48JIqBD+xHRlt1n +wKfbbWZ66skIga61sjFeO4/keDqYPmmFBlapHDDoAUROCd0bXL057pgl2cboCzRXOrif0X++p5 iSSf3pu6K8O8XGEP6KPTYS11nRTjbbsgFDao4IVpGl2WoezkUoXg4eXm3ek8CQ8iGReLE1roM/n eqMeoyNzGQG598/w0TD6YoyQnqyF/IMZNBMJH0RGPogEA== X-Received: by 127.0.0.2 with SMTP id RYQoYY7687511xozjuZUBOaZ; Wed, 08 May 2024 22:56:49 -0700 X-Received: from mail-oa1-f47.google.com (mail-oa1-f47.google.com [209.85.160.47]) by mx.groups.io with SMTP id smtpd.web10.3658.1715234206392843287 for ; Wed, 08 May 2024 22:56:46 -0700 X-Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-23f29434da2so340033fac.3 for ; Wed, 08 May 2024 22:56:46 -0700 (PDT) X-Gm-Message-State: tPkYUmTIZ93unK5CdEKpmXAox7686176AA= X-Google-Smtp-Source: AGHT+IGGQ/BU211KN1zzZfJk/vXmMrxUJ7iXN7c1zpsbsoPUzz79FPbWPAuYKCU2XyhjxVfCPULX5Q== X-Received: by 2002:a05:6870:2044:b0:239:8e67:6f10 with SMTP id 586e51a60fabf-2409806fcbamr4796431fac.30.1715234205534; Wed, 08 May 2024 22:56:45 -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 11/13] MdePkg: : Adds Protocol for MockRng Date: Wed, 8 May 2024 22:56:31 -0700 Message-Id: <20240509055633.828642-12-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=Owpm+LVu; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=pass (policy=none) header.from=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 (#118726): https://edk2.groups.io/g/devel/message/118726 Mute This Topic: https://groups.io/mt/105996589/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-