Hi Vivian, Please see feedback below inline. The # MU_CHANGE comment seems unnecessary.
Thanks, Nate > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of VivianNK > Sent: Wednesday, May 8, 2024 1:32 PM > To: devel@edk2.groups.io > Cc: Dong, Eric <eric.d...@intel.com>; Liming Gao > <gaolim...@byosoft.com.cn> > Subject: [edk2-devel] [PATCH v1 1/1] BoardModulePkg: Added Mock library > for BiosIdLib > > From: Bhavani Subramanian <v-bhavan...@microsoft.com> > > Added a gmock for GoogleTests that pull in BiosIdLib. > > Cc: Eric Dong <eric.d...@intel.com> > Cc: Liming Gao <gaolim...@byosoft.com.cn> > > Signed-off-by: Vivian Nowka-Keane <vnowkake...@linux.microsoft.com> > --- > Platform/Intel/BoardModulePkg/BoardModulePkg.dec > | 1 + > Platform/Intel/BoardModulePkg/Test/BoardModulePkgHostTest.dsc > | 32 +++++++++++++++++++ > > Platform/Intel/BoardModulePkg/Test/Mock/Include/GoogleTest/Library/MockBiosIdLib.h > | 31 ++++++++++++++++++ > > Platform/Intel/BoardModulePkg/Test/Mock/Library/GoogleTest/MockBiosIdLib/MockBiosIdLib.cpp > | 11 +++++++ > > Platform/Intel/BoardModulePkg/Test/Mock/Library/GoogleTest/MockBiosIdLib/MockBiosIdLib.inf > | 33 ++++++++++++++++++++ > 5 files changed, 108 insertions(+) > > diff --git a/Platform/Intel/BoardModulePkg/BoardModulePkg.dec > b/Platform/Intel/BoardModulePkg/BoardModulePkg.dec > index 26e662f711d1..5efb1a0348ff 100644 > --- a/Platform/Intel/BoardModulePkg/BoardModulePkg.dec > +++ b/Platform/Intel/BoardModulePkg/BoardModulePkg.dec > @@ -22,6 +22,7 @@ > > [Includes] > Include > + Test/Mock/Include # MU_CHANGE Please remove the # MU_CHANGE comment > > [LibraryClasses] > ## @libraryclass Provide services to access CMOS area. > diff --git a/Platform/Intel/BoardModulePkg/Test/BoardModulePkgHostTest.dsc > b/Platform/Intel/BoardModulePkg/Test/BoardModulePkgHostTest.dsc > new file mode 100644 > index 000000000000..846a1e9f8b33 > --- /dev/null > +++ b/Platform/Intel/BoardModulePkg/Test/BoardModulePkgHostTest.dsc > @@ -0,0 +1,32 @@ > +## @file BoardModulePkgHostTest.dsc > +# > +# Copyright (c) Microsoft Corporation. > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +# Description > +# > +## > + > +[Defines] > +PLATFORM_NAME = BoardModulePkgHostTest > +PLATFORM_GUID = 67275336-A324-4F69-BD38-70A4C7898F06 > +PLATFORM_VERSION = 0.1 > +DSC_SPECIFICATION = 0x00010005 > +OUTPUT_DIRECTORY = Build/BoardModulePkg/HostTest > +SUPPORTED_ARCHITECTURES = IA32|X64|AARCH64 > +BUILD_TARGETS = NOOPT > +SKUID_IDENTIFIER = DEFAULT > + > +!include UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc > + > +[LibraryClasses] > + > +[Components] > + # > + # List of Unit test packages > + # > + > + # > + # Build HOST_APPLICATION Libraries With GoogleTest > + # > + BoardModulePkg/Test/Mock/Library/GoogleTest/MockBiosIdLib/MockBiosIdLib.inf > diff --git > a/Platform/Intel/BoardModulePkg/Test/Mock/Include/GoogleTest/Library/MockBiosIdLib.h > > b/Platform/Intel/BoardModulePkg/Test/Mock/Include/GoogleTest/Library/MockBiosIdLib.h > new file mode 100644 > index 000000000000..8f8a82da2807 > --- /dev/null > +++ > b/Platform/Intel/BoardModulePkg/Test/Mock/Include/GoogleTest/Library/MockBiosIdLib.h > @@ -0,0 +1,31 @@ > +/** @file MockBiosIdLib.h > + Google Test mocks for BiosIdLib > + > + Copyright (c) Microsoft Corporation. > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > + > +#ifndef MOCK_BIOS_ID_LIB_H_ > +#define MOCK_BIOS_ID_LIB_H_ > + > +#include <Library/GoogleTestLib.h> > +#include <Library/FunctionMockLib.h> > +extern "C" { > + #include <Uefi.h> > + #include <Pi/PiBootMode.h> > + #include <Library/BiosIdLib.h> > +} > + > +struct MockBiosIdLib { > + MOCK_INTERFACE_DECLARATION (MockBiosIdLib); > + > + MOCK_FUNCTION_DECLARATION ( > + EFI_STATUS, > + GetBiosId, > + ( > + OUT BIOS_ID_IMAGE *BiosIdImage OPTIONAL > + ) > + ); > +}; > + > +#endif > diff --git > a/Platform/Intel/BoardModulePkg/Test/Mock/Library/GoogleTest/MockBiosIdLib/MockBiosIdLib.cpp > > b/Platform/Intel/BoardModulePkg/Test/Mock/Library/GoogleTest/MockBiosIdLib/MockBiosIdLib.cpp > new file mode 100644 > index 000000000000..8b64e8a66acd > --- /dev/null > +++ > b/Platform/Intel/BoardModulePkg/Test/Mock/Library/GoogleTest/MockBiosIdLib/MockBiosIdLib.cpp > @@ -0,0 +1,11 @@ > +/** @file MockBiosIdLib.cpp > + Google Test mocks for BiosIdLib > + > + Copyright (c) Microsoft Corporation. > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > + > +#include <GoogleTest/Library/MockBiosIdLib.h> > + > +MOCK_INTERFACE_DEFINITION (MockBiosIdLib); > +MOCK_FUNCTION_DEFINITION (MockBiosIdLib, GetBiosId, 1, EFIAPI); > diff --git > a/Platform/Intel/BoardModulePkg/Test/Mock/Library/GoogleTest/MockBiosIdLib/MockBiosIdLib.inf > > b/Platform/Intel/BoardModulePkg/Test/Mock/Library/GoogleTest/MockBiosIdLib/MockBiosIdLib.inf > new file mode 100644 > index 000000000000..f60bc3724f6a > --- /dev/null > +++ > b/Platform/Intel/BoardModulePkg/Test/Mock/Library/GoogleTest/MockBiosIdLib/MockBiosIdLib.inf > @@ -0,0 +1,33 @@ > +## @file MockBiosIdLib.inf > +# Google Test mocks for BiosIdLib > +# > +# Copyright (c) Microsoft Corporation. > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +## > + > +[Defines] > + INF_VERSION = 0x00010005 > + BASE_NAME = MockBiosIdLib > + FILE_GUID = FD03FA6D-7447-499C-B3AF-D89450F7739A > + MODULE_TYPE = HOST_APPLICATION > + VERSION_STRING = 1.0 > + LIBRARY_CLASS = BiosIdLib > + PI_SPECIFICATION_VERSION = 0x0001000A > + > +# > +# VALID_ARCHITECTURES = IA32 X64 > +# > + > +[Sources] > + MockBiosIdLib.cpp > + > +[Packages] > + MdePkg/MdePkg.dec > + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec > + BoardModulePkg/BoardModulePkg.dec > + > +[LibraryClasses] > + GoogleTestLib > + > +[BuildOptions] > + MSFT:*_*_*_CC_FLAGS = /EHsc > -- > 2.43.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118896): https://edk2.groups.io/g/devel/message/118896 Mute This Topic: https://groups.io/mt/105989325/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-