From: "Chang, Abner via groups.io" <abner.chang=amd.com@groups.io>
To: Jeff Brasen <jbrasen@nvidia.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "ardb+tianocore@kernel.org" <ardb+tianocore@kernel.org>,
"quic_llindhol@quicinc.com" <quic_llindhol@quicinc.com>
Subject: Re: [edk2-devel] [PATCH] EmbeddedPkg: Add DtPlatformLoaderLib gmock support
Date: Mon, 18 Dec 2023 02:25:01 +0000 [thread overview]
Message-ID: <MN2PR12MB3966AA89D45FCB7CD9A5A8A4EA90A@MN2PR12MB3966.namprd12.prod.outlook.com> (raw)
In-Reply-To: <df120608dd8c51bceaa703f766d7c83246565603.1702309551.git.jbrasen@nvidia.com>
[AMD Official Use Only - General]
Not familiar with gmock and no idea of adding a cpp source file to edk2 (we done this on edk2 before?). May need someone else to review this change.
Thanks
Abner
> -----Original Message-----
> From: Jeff Brasen <jbrasen@nvidia.com>
> Sent: Monday, December 11, 2023 11:47 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; ardb+tianocore@kernel.org;
> quic_llindhol@quicinc.com; Jeff Brasen <jbrasen@nvidia.com>
> Subject: [PATCH] EmbeddedPkg: Add DtPlatformLoaderLib gmock support
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Add Google Mock Library for DtPlatformLoaderDtbLib
>
> Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
> ---
> EmbeddedPkg/EmbeddedPkg.dec | 1 +
> .../Library/MockDtPlatformDtbLoaderLib.h | 31 +++++++++++++++++++
> .../MockDtPlatformDtbLoaderLib.cpp | 13 ++++++++
> .../MockDtPlatformDtbLoaderLib.inf | 29 +++++++++++++++++
> 4 files changed, 74 insertions(+)
> create mode 100644
> EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtbLo
> aderLib.h
> create mode 100644
> EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/
> MockDtPlatformDtbLoaderLib.cpp
> create mode 100644
> EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/
> MockDtPlatformDtbLoaderLib.inf
>
> diff --git a/EmbeddedPkg/EmbeddedPkg.dec
> b/EmbeddedPkg/EmbeddedPkg.dec
> index 94dc3c9b76..b4834e8b4f 100644
> --- a/EmbeddedPkg/EmbeddedPkg.dec
> +++ b/EmbeddedPkg/EmbeddedPkg.dec
> @@ -28,6 +28,7 @@
>
> ###################################################################
> #############
> [Includes.common]
> Include # Root include for the package
> + Test/Mock/Include
>
> [LibraryClasses.common]
> PrePiLib|Include/Library/PrePiLib.h
> diff --git
> a/EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtb
> LoaderLib.h
> b/EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtb
> LoaderLib.h
> new file mode 100644
> index 0000000000..23dab21668
> --- /dev/null
> +++
> b/EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtb
> LoaderLib.h
> @@ -0,0 +1,31 @@
> +/** @file
> + Google Test mocks for DtPlatformDtbLoaderLib
> +
> + Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
> + Copyright (c) 2023, Intel Corporation. All rights reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +**/
> +
> +#ifndef MOCK_DT_PLATFORM_DTB_LOADER_LIB_H_
> +#define MOCK_DT_PLATFORM_DTB_LOADER_LIB_H_
> +
> +#include <Library/GoogleTestLib.h>
> +#include <Library/FunctionMockLib.h>
> +extern "C" {
> +#include <Pi/PiMultiPhase.h>
> +#include <Uefi.h>
> +#include <Library/DtPlatformDtbLoaderLib.h>
> +}
> +
> +struct MockDtPlatformDtbLoaderLib {
> + MOCK_INTERFACE_DECLARATION (MockDtPlatformDtbLoaderLib);
> +
> + MOCK_FUNCTION_DECLARATION (
> + EFI_STATUS,
> + DtPlatformLoadDtb,
> + (OUT VOID **Dtb,
> + OUT UINTN *DtbSize)
> + );
> +};
> +
> +#endif
> diff --git
> a/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLi
> b/MockDtPlatformDtbLoaderLib.cpp
> b/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLi
> b/MockDtPlatformDtbLoaderLib.cpp
> new file mode 100644
> index 0000000000..a5db68e59a
> --- /dev/null
> +++
> b/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLi
> b/MockDtPlatformDtbLoaderLib.cpp
> @@ -0,0 +1,13 @@
> +/** @file
> + Google Test mocks for MockDtPlatformDtbLoaderLib
> +
> + Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
> + Copyright (c) 2023, Intel Corporation. All rights reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +**/
> +
> +#include <GoogleTest/Library/MockDtPlatformDtbLoaderLib.h>
> +
> +MOCK_INTERFACE_DEFINITION (MockDtPlatformDtbLoaderLib);
> +
> +MOCK_FUNCTION_DEFINITION (MockDtPlatformDtbLoaderLib,
> DtPlatformLoadDtb, 2, EFIAPI);
> diff --git
> a/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLi
> b/MockDtPlatformDtbLoaderLib.inf
> b/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLi
> b/MockDtPlatformDtbLoaderLib.inf
> new file mode 100644
> index 0000000000..9618efd864
> --- /dev/null
> +++
> b/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLi
> b/MockDtPlatformDtbLoaderLib.inf
> @@ -0,0 +1,29 @@
> +## @file
> +# Google Test mocks for MockDtPlatformDtbLoaderLib
> +#
> +# Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +# Copyright (c) 2023, Intel Corporation. All rights reserved.
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +##
> +
> +[Defines]
> + INF_VERSION = 0x00010005
> + BASE_NAME = MockDtPlatformDtbLoaderLib
> + FILE_GUID = 34c05e81-3c56-4c78-b4b7-a39be19163a4
> + MODULE_TYPE = HOST_APPLICATION
> + VERSION_STRING = 1.0
> + LIBRARY_CLASS = DtPlatformDtbLoaderLib
> +
> +[Sources]
> +MockDtPlatformDtbLoaderLib.cpp
> +
> +[Packages]
> + EmbeddedPkg/EmbeddedPkg.dec
> + MdePkg/MdePkg.dec
> + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec
> +
> +[LibraryClasses]
> + GoogleTestLib
> +
> +[BuildOptions]
> + MSFT:*_*_*_CC_FLAGS = /EHsc
> --
> 2.34.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112614): https://edk2.groups.io/g/devel/message/112614
Mute This Topic: https://groups.io/mt/103110931/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
prev parent reply other threads:[~2023-12-18 2:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-11 15:46 [edk2-devel] [PATCH] EmbeddedPkg: Add DtPlatformLoaderLib gmock support Jeff Brasen via groups.io
2023-12-18 2:25 ` Chang, Abner via groups.io [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MN2PR12MB3966AA89D45FCB7CD9A5A8A4EA90A@MN2PR12MB3966.namprd12.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox