From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web10.19470.1683258793845446976 for ; Thu, 04 May 2023 20:53:15 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=YYGJh+/j; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: gua.guo@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683258795; x=1714794795; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PP615rTFTwXQhSV9SQy6J5edJ6Tb65amGhRvQ0QWrZ4=; b=YYGJh+/jebeC/ZGIiSDV4xlt241JefKwYbQB5W+1Xu2Mf18oXf+2zsk2 9fsmPYXlSlRUKfZbIR7nX22ZWR5FZukQ/n6xxEWxeo6dspG0AOBMhMrw1 vxf4687mRzEmhU7kpt8edYMBEmK3YVf0kprrxSjSPgaui9/JY44pRT2D9 0Oaj043J1nrRbLxAIcN+tVkCTfTCE9k4oJdz4W2s9tlcPuJYG/arzUnkD zouC6THTaTahv7uRi2pDI9eIpQtSZBBg66JCQxj5xLOdQULcQkcz0uIZB 0e/yn1XUp2EQiIdZMIOYllHVNATRHGjsSbNXJq3zqv9ZwxP5pRsExTLxh w==; X-IronPort-AV: E=McAfee;i="6600,9927,10700"; a="352155723" X-IronPort-AV: E=Sophos;i="5.99,250,1677571200"; d="scan'208";a="352155723" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 May 2023 20:53:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10700"; a="674848057" X-IronPort-AV: E=Sophos;i="5.99,250,1677571200"; d="scan'208";a="674848057" Received: from gguo-desk.gar.corp.intel.com ([10.5.215.23]) by orsmga006.jf.intel.com with ESMTP; 04 May 2023 20:52:47 -0700 From: "Guo, Gua" To: devel@edk2.groups.io Cc: gua.guo@intel.com, Michael D Kinney , Liming Gao , Zhiguang Liu , Chris Johnson Subject: [PATCH v2 2/2] MdePkg: Add more HobLib/PeiServicesLib gmock support Date: Fri, 5 May 2023 11:52:39 +0800 Message-Id: <20230505035239.381-3-gua.guo@intel.com> X-Mailer: git-send-email 2.39.2.windows.1 In-Reply-To: <20230505035239.381-1-gua.guo@intel.com> References: <20230505035239.381-1-gua.guo@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Gua Guo REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4443 Add Google Mock Library for HobLib Add Google Mock Library for PeiServicesLib Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Cc: Chris Johnson Signed-off-by: Gua Guo --- MdePkg/Test/MdePkgHostTest.dsc | 2 + .../Include/GoogleTest/Library/MockHobLib.h | 150 ++++++++++++++ .../GoogleTest/Library/MockPeiServicesLib.h | 189 ++++++++++++++++++ .../GoogleTest/MockHobLib/MockHobLib.cpp | 30 +++ .../GoogleTest/MockHobLib/MockHobLib.inf | 33 +++ .../MockPeiServicesLib/MockPeiServicesLib.cpp | 36 ++++ .../MockPeiServicesLib/MockPeiServicesLib.inf | 33 +++ 7 files changed, 473 insertions(+) create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockPeiServ= icesLib.h create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobL= ib.cpp create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobL= ib.inf create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/= MockPeiServicesLib.cpp create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/= MockPeiServicesLib.inf diff --git a/MdePkg/Test/MdePkgHostTest.dsc b/MdePkg/Test/MdePkgHostTest.dsc index 35e3ef6d97..529ea69024 100644 --- a/MdePkg/Test/MdePkgHostTest.dsc +++ b/MdePkg/Test/MdePkgHostTest.dsc @@ -36,3 +36,5 @@ MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf=0D MdePkg/Test/Mock/Library/GoogleTest/MockUefiLib/MockUefiLib.inf=0D MdePkg/Test/Mock/Library/GoogleTest/MockUefiRuntimeServicesTableLib/Mock= UefiRuntimeServicesTableLib.inf=0D + MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLi= b.inf=0D + MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.inf=0D diff --git a/MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h b/Mde= Pkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h new file mode 100644 index 0000000000..994b8133e5 --- /dev/null +++ b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h @@ -0,0 +1,150 @@ +/** @file=0D + Google Test mocks for HobLib=0D +=0D + Copyright (c) 2023, Intel Corporation. All rights reserved.=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +**/=0D +=0D +#ifndef MOCK_HOB_LIB_H_=0D +#define MOCK_HOB_LIB_H_=0D +=0D +#include =0D +#include =0D +extern "C" {=0D +#include =0D +#include =0D +#include =0D +}=0D +=0D +struct MockHobLib {=0D + MOCK_INTERFACE_DECLARATION (MockHobLib);=0D +=0D + MOCK_FUNCTION_DECLARATION (=0D + VOID *,=0D + GetHobList,=0D + ()=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + VOID *,=0D + GetNextHob,=0D + (IN UINT16 Type,=0D + IN CONST VOID *HobStart)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + VOID *,=0D + GetFirstHob,=0D + (IN UINT16 Type)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + VOID *,=0D + GetNextGuidHob,=0D + (IN CONST EFI_GUID *Guid,=0D + IN CONST VOID *HobStart)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + VOID *,=0D + GetFirstGuidHob,=0D + (IN CONST EFI_GUID *Guid)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_BOOT_MODE,=0D + GetBootModeHob,=0D + ()=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + VOID,=0D + BuildModuleHob,=0D + (IN CONST EFI_GUID *ModuleName,=0D + IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,=0D + IN UINT64 ModuleLength,=0D + IN EFI_PHYSICAL_ADDRESS EntryPoint)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + VOID,=0D + BuildResourceDescriptorWithOwnerHob,=0D + (IN EFI_RESOURCE_TYPE ResourceType,=0D + IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,=0D + IN EFI_PHYSICAL_ADDRESS PhysicalStart,=0D + IN UINT64 NumberOfBytes,=0D + IN EFI_GUID *OwnerGUID)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + VOID,=0D + BuildResourceDescriptorHob,=0D + (IN EFI_RESOURCE_TYPE ResourceType,=0D + IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,=0D + IN EFI_PHYSICAL_ADDRESS PhysicalStart,=0D + IN UINT64 NumberOfBytes)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + VOID *,=0D + BuildGuidHob,=0D + (IN CONST EFI_GUID *Guid,=0D + IN UINTN DataLength)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + VOID *,=0D + BuildGuidDataHob,=0D + (IN CONST EFI_GUID *Guid,=0D + IN VOID *Data,=0D + IN UINTN DataLength)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + VOID,=0D + BuildFvHob,=0D + (IN EFI_PHYSICAL_ADDRESS BaseAddress,=0D + IN UINT64 Length)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + VOID,=0D + BuildFv2Hob,=0D + (IN EFI_PHYSICAL_ADDRESS BaseAddress,=0D + IN UINT64 Length,=0D + IN CONST EFI_GUID *FvName,=0D + IN CONST EFI_GUID *FileName)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + VOID,=0D + BuildFv3Hob,=0D + (IN EFI_PHYSICAL_ADDRESS BaseAddress,=0D + IN UINT64 Length,=0D + IN UINT32 AuthenticationStatus,=0D + IN BOOLEAN ExtractedFv,=0D + IN CONST EFI_GUID *FvName OPTIONAL,=0D + IN CONST EFI_GUID *FileName OPTIONAL)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + VOID,=0D + BuildCvHob,=0D + (IN EFI_PHYSICAL_ADDRESS BaseAddress,=0D + IN UINT64 Length)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + VOID,=0D + BuildCpuHob,=0D + (IN UINT8 SizeOfMemorySpace,=0D + IN UINT8 SizeOfIoSpace)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + VOID,=0D + BuildStackHob,=0D + (IN EFI_PHYSICAL_ADDRESS BaseAddress,=0D + IN UINT64 Length)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + VOID,=0D + BuildBspStoreHob,=0D + (IN EFI_PHYSICAL_ADDRESS BaseAddress,=0D + IN UINT64 Length,=0D + IN EFI_MEMORY_TYPE MemoryType)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + VOID,=0D + BuildMemoryAllocationHob,=0D + (IN EFI_PHYSICAL_ADDRESS BaseAddress,=0D + IN UINT64 Length,=0D + IN EFI_MEMORY_TYPE MemoryType)=0D + );=0D +};=0D +=0D +#endif=0D diff --git a/MdePkg/Test/Mock/Include/GoogleTest/Library/MockPeiServicesLib= .h b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockPeiServicesLib.h new file mode 100644 index 0000000000..4a99fec539 --- /dev/null +++ b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockPeiServicesLib.h @@ -0,0 +1,189 @@ +/** @file=0D + Google Test mocks for PeiServicesLib=0D +=0D + Copyright (c) 2023, Intel Corporation. All rights reserved.=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +**/=0D +=0D +#ifndef MOCK_PEI_SERVICES_LIB_H_=0D +#define MOCK_PEI_SERVICES_LIB_H_=0D +=0D +#include =0D +#include =0D +extern "C" {=0D +#include =0D +#include =0D +#include =0D +}=0D +=0D +struct MockPeiServicesLib {=0D + MOCK_INTERFACE_DECLARATION (MockPeiServicesLib);=0D +=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + PeiServicesInstallPpi,=0D + (IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + PeiServicesReInstallPpi,=0D + (IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,=0D + IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + PeiServicesLocatePpi,=0D + (IN CONST EFI_GUID *Guid,=0D + IN UINTN Instance,=0D + IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor OPTIONAL,=0D + IN OUT VOID **Ppi)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + PeiServicesNotifyPpi,=0D + (IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + PeiServicesGetBootMode,=0D + (OUT EFI_BOOT_MODE *BootMode)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + PeiServicesSetBootMode,=0D + (IN EFI_BOOT_MODE BootMode)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + PeiServicesGetHobList,=0D + (OUT VOID **HobList)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + PeiServicesCreateHob,=0D + (IN UINT16 Type,=0D + IN UINT16 Length,=0D + OUT VOID **Hob)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + PeiServicesFfsFindNextVolume,=0D + (IN UINTN Instance,=0D + IN OUT EFI_PEI_FV_HANDLE *VolumeHandle)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + PeiServicesFfsFindNextFile,=0D + (IN EFI_FV_FILETYPE SearchType,=0D + IN EFI_PEI_FV_HANDLE VolumeHandle,=0D + IN OUT EFI_PEI_FILE_HANDLE *FileHandle)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + PeiServicesFfsFindSectionData,=0D + (IN EFI_SECTION_TYPE SectionType,=0D + IN EFI_PEI_FILE_HANDLE FileHandle,=0D + OUT VOID **SectionData)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + PeiServicesFfsFindSectionData3,=0D + (IN EFI_SECTION_TYPE SectionType,=0D + IN UINTN SectionInstance,=0D + IN EFI_PEI_FILE_HANDLE FileHandle,=0D + OUT VOID **SectionData,=0D + OUT UINT32 *AuthenticationStatus)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + PeiServicesInstallPeiMemory,=0D + (IN EFI_PHYSICAL_ADDRESS MemoryBegin,=0D + IN UINT64 MemoryLength)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + PeiServicesAllocatePages,=0D + (IN EFI_MEMORY_TYPE MemoryType,=0D + IN UINTN Pages,=0D + OUT EFI_PHYSICAL_ADDRESS *Memory)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + PeiServicesFreePages,=0D + (IN EFI_PHYSICAL_ADDRESS Memory,=0D + IN UINTN Pages)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + PeiServicesAllocatePool,=0D + (IN UINTN Size,=0D + OUT VOID **Buffer)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + PeiServicesResetSystem,=0D + ()=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + PeiServicesFfsFindFileByName,=0D + (IN CONST EFI_GUID *FileName,=0D + IN CONST EFI_PEI_FV_HANDLE VolumeHandle,=0D + OUT EFI_PEI_FILE_HANDLE *FileHandle)=0D + );=0D +=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + PeiServicesFfsGetFileInfo,=0D + (IN CONST EFI_PEI_FILE_HANDLE FileHandle,=0D + OUT EFI_FV_FILE_INFO *FileInfo)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + PeiServicesFfsGetFileInfo2,=0D + (IN CONST EFI_PEI_FILE_HANDLE FileHandle,=0D + OUT EFI_FV_FILE_INFO2 *FileInfo)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + PeiServicesFfsGetVolumeInfo,=0D + (IN EFI_PEI_FV_HANDLE VolumeHandle,=0D + OUT EFI_FV_INFO *VolumeInfo)=0D + );=0D +=0D + MOCK_FUNCTION_DECLARATION (=0D + EFI_STATUS,=0D + PeiServicesRegisterForShadow,=0D + (IN EFI_PEI_FILE_HANDLE FileHandle)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + VOID,=0D + PeiServicesInstallFvInfoPpi,=0D + (IN CONST EFI_GUID *FvFormat OPTIONAL,=0D + IN CONST VOID *FvInfo,=0D + IN UINT32 FvInfoSize,=0D + IN CONST EFI_GUID *ParentFvName OPTIONAL,=0D + IN CONST EFI_GUID *ParentFileName OPTIONAL)=0D + );=0D +=0D + MOCK_FUNCTION_DECLARATION (=0D + VOID,=0D + PeiServicesInstallFvInfo2Ppi,=0D + (IN CONST EFI_GUID *FvFormat OPTIONAL,=0D + IN CONST VOID *FvInfo,=0D + IN UINT32 FvInfoSize,=0D + IN CONST EFI_GUID *ParentFvName OPTIONAL,=0D + IN CONST EFI_GUID *ParentFileName OPTIONAL,=0D + IN UINT32 AuthenticationStatus)=0D + );=0D + MOCK_FUNCTION_DECLARATION (=0D + VOID,=0D + PeiServicesResetSystem2,=0D + (IN EFI_RESET_TYPE ResetType,=0D + IN EFI_STATUS ResetStatus,=0D + IN UINTN DataSize,=0D + IN VOID *ResetData OPTIONAL)=0D + );=0D +};=0D +=0D +#endif=0D diff --git a/MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.cpp = b/MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.cpp new file mode 100644 index 0000000000..5a5a9159fc --- /dev/null +++ b/MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.cpp @@ -0,0 +1,30 @@ +/** @file=0D + Google Test mocks for HobLib=0D +=0D + Copyright (c) 2023, Intel Corporation. All rights reserved.=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +**/=0D +=0D +#include =0D +=0D +MOCK_INTERFACE_DEFINITION(MockHobLib);=0D +=0D +MOCK_FUNCTION_DEFINITION(MockHobLib, GetHobList, 0, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockHobLib, GetNextHob, 2, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockHobLib, GetFirstHob, 1, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockHobLib, GetNextGuidHob, 2, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockHobLib, GetFirstGuidHob, 1, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockHobLib, GetBootModeHob, 0, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockHobLib, BuildModuleHob, 4, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockHobLib, BuildResourceDescriptorWithOwnerHob, = 5, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockHobLib, BuildResourceDescriptorHob, 4, EFIAPI= );=0D +MOCK_FUNCTION_DEFINITION(MockHobLib, BuildGuidHob, 2, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockHobLib, BuildGuidDataHob, 3, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockHobLib, BuildFvHob, 2, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockHobLib, BuildFv2Hob, 4, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockHobLib, BuildFv3Hob, 6, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockHobLib, BuildCvHob, 2, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockHobLib, BuildCpuHob, 2, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockHobLib, BuildStackHob, 2, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockHobLib, BuildBspStoreHob, 3, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockHobLib, BuildMemoryAllocationHob, 3, EFIAPI);= =0D diff --git a/MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.inf = b/MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.inf new file mode 100644 index 0000000000..79e6c8a042 --- /dev/null +++ b/MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.inf @@ -0,0 +1,33 @@ +## @file=0D +# Google Test mocks for HobLib=0D +#=0D +# Copyright (c) 2023, Intel Corporation. All rights reserved.=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010005=0D + BASE_NAME =3D MockHobLib=0D + FILE_GUID =3D 44E3D5AA-7225-4A70-B1B7-0D02C44F0690= =0D + MODULE_TYPE =3D HOST_APPLICATION=0D + VERSION_STRING =3D 1.0=0D + LIBRARY_CLASS =3D HobLib=0D +=0D +#=0D +# The following information is for reference only and not required by the = build tools.=0D +#=0D +# VALID_ARCHITECTURES =3D IA32 X64=0D +#=0D +=0D +[Sources]=0D + MockHobLib.cpp=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec=0D +=0D +[LibraryClasses]=0D + GoogleTestLib=0D +=0D +[BuildOptions]=0D + MSFT:*_*_*_CC_FLAGS =3D /EHsc=0D diff --git a/MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPei= ServicesLib.cpp b/MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/Mo= ckPeiServicesLib.cpp new file mode 100644 index 0000000000..9a7ff4bd8f --- /dev/null +++ b/MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiService= sLib.cpp @@ -0,0 +1,36 @@ +/** @file=0D + Google Test mocks for PeiServicesLib=0D +=0D + Copyright (c) 2023, Intel Corporation. All rights reserved.=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +**/=0D +=0D +#include =0D +=0D +MOCK_INTERFACE_DEFINITION(MockPeiServicesLib);=0D +=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesInstallPpi, 1, EFI= API);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesReInstallPpi, 2, E= FIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesLocatePpi, 4, EFIA= PI);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesNotifyPpi, 1, EFIA= PI);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesGetBootMode, 1, EF= IAPI);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesSetBootMode, 1, EF= IAPI);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesGetHobList, 1, EFI= API);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesCreateHob, 3, EFIA= PI);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesFfsFindNextVolume,= 2, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesFfsFindNextFile, 3= , EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesFfsFindSectionData= , 3, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesFfsFindSectionData= 3, 5, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesInstallPeiMemory, = 2, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesAllocatePages, 3, = EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesFreePages, 2, EFIA= PI);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesAllocatePool, 2, E= FIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesResetSystem, 0, EF= IAPI);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesFfsFindFileByName,= 3, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesFfsGetFileInfo, 2,= EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesFfsGetFileInfo2, 2= , EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesFfsGetVolumeInfo, = 2, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesRegisterForShadow,= 1, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesInstallFvInfoPpi, = 5, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesInstallFvInfo2Ppi,= 6, EFIAPI);=0D +MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesResetSystem2, 4, E= FIAPI);=0D diff --git a/MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPei= ServicesLib.inf b/MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/Mo= ckPeiServicesLib.inf new file mode 100644 index 0000000000..7cbcc71456 --- /dev/null +++ b/MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiService= sLib.inf @@ -0,0 +1,33 @@ +## @file=0D +# Mock PEI Services Library implementation.=0D +#=0D +# Copyright (c) 2023, Intel Corporation. All rights reserved.=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010005=0D + BASE_NAME =3D MockPeiServicesLib=0D + FILE_GUID =3D FC944493-C0C0-482D-A1CC-72CE12C4BEEA= =0D + MODULE_TYPE =3D HOST_APPLICATION=0D + VERSION_STRING =3D 1.0=0D + LIBRARY_CLASS =3D PeiServicesLib=0D + PI_SPECIFICATION_VERSION =3D 0x0001000A=0D +=0D +#=0D +# VALID_ARCHITECTURES =3D IA32 X64 EBC (EBC is for build only)= =0D +#=0D +=0D +[Sources]=0D + MockPeiServicesLib.cpp=0D +=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec=0D +=0D +[LibraryClasses]=0D + GoogleTestLib=0D +=0D +[BuildOptions]=0D + MSFT:*_*_*_CC_FLAGS =3D /EHsc=0D --=20 2.39.2.windows.1