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 EAC0D7803D1 for ; Fri, 24 May 2024 05:45:31 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=ORQXhjOeRFsADpoQO0MrILBbV+PHCE7o7Pg0gEhUwEY=; 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=1716529530; v=1; b=rfthNJGyjIutY9EjyEjtE+QTqy8k6ve7M66HK2CZCGDOFELY8VUVffvfHYfyAZRynqugcI/W XQMhTHT6okVQzpjN6PHjPfCm4LH94Orok4SaGjGZBjtN08uh/FD3GEmc8S49CjLt6LEJyX7P0WE oZbE/ycLLNPcaVxers1QlIIxxbUvoM0wtTsjUExg+uVbPod7KTRgyKu3QLmonBynV1q0C65n5qM 8/cP1vCEJ5BPffygI1ds7WAN1fthMhxk51IAqB39JiRcs5KxEcPhwdrRFHhPA/PNlOfmpysXumN uObJVqW9d3emnuNUuNsGW1Ut68iwrpNjElqG3jhWca7Fw== X-Received: by 127.0.0.2 with SMTP id 8SvLYY7687511xkTcjsXjGIW; Thu, 23 May 2024 22:45:30 -0700 X-Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by mx.groups.io with SMTP id smtpd.web10.9219.1716529526945960366 for ; Thu, 23 May 2024 22:45:27 -0700 X-Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6f8f34cb0beso338175b3a.1 for ; Thu, 23 May 2024 22:45:26 -0700 (PDT) X-Gm-Message-State: EC29qDAPiPjb9eE4i1zkooGax7686176AA= X-Google-Smtp-Source: AGHT+IF/JqikHQstosHCuyq8W2rp3Xa+vOfelBoUBrJReclNtrIrRJltg0hh0E7tCJAs8/LusprP6g== X-Received: by 2002:a05:6a20:8404:b0:1af:8106:e046 with SMTP id adf61e73a8af0-1b212dd11fdmr1810772637.20.1716529526078; 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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 22:45:25 -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 11/20] MdePkg: : Adds Protocol for MockRng Date: Thu, 23 May 2024 22:45:03 -0700 Message-Id: <20240524054512.523329-12-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=rfthNJGy; 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 0000000000..b54f8a234b --- /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 0000000000..7d8b69cc86 --- /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 (#119238): https://edk2.groups.io/g/devel/message/119238 Mute This Topic: https://groups.io/mt/106276863/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-