MdePkg: Add more HobLib/PeiServicesLib gmock support
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4443 Add Google Mock Library for HobLib Add Google Mock Library for PeiServicesLib Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Chris Johnson <chris.n.johnson@intel.com> Signed-off-by: Gua Guo <gua.guo@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
/** @file
|
||||
Google Test mocks for HobLib
|
||||
|
||||
Copyright (c) 2023, Intel Corporation. All rights reserved.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
|
||||
#include <GoogleTest/Library/MockHobLib.h>
|
||||
|
||||
MOCK_INTERFACE_DEFINITION(MockHobLib);
|
||||
|
||||
MOCK_FUNCTION_DEFINITION(MockHobLib, GetHobList, 0, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockHobLib, GetNextHob, 2, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockHobLib, GetFirstHob, 1, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockHobLib, GetNextGuidHob, 2, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockHobLib, GetFirstGuidHob, 1, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockHobLib, GetBootModeHob, 0, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockHobLib, BuildModuleHob, 4, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockHobLib, BuildResourceDescriptorWithOwnerHob, 5, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockHobLib, BuildResourceDescriptorHob, 4, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockHobLib, BuildGuidHob, 2, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockHobLib, BuildGuidDataHob, 3, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockHobLib, BuildFvHob, 2, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockHobLib, BuildFv2Hob, 4, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockHobLib, BuildFv3Hob, 6, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockHobLib, BuildCvHob, 2, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockHobLib, BuildCpuHob, 2, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockHobLib, BuildStackHob, 2, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockHobLib, BuildBspStoreHob, 3, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockHobLib, BuildMemoryAllocationHob, 3, EFIAPI);
|
@@ -0,0 +1,33 @@
|
||||
## @file
|
||||
# Google Test mocks for HobLib
|
||||
#
|
||||
# Copyright (c) 2023, Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = MockHobLib
|
||||
FILE_GUID = 44E3D5AA-7225-4A70-B1B7-0D02C44F0690
|
||||
MODULE_TYPE = HOST_APPLICATION
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = HobLib
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64
|
||||
#
|
||||
|
||||
[Sources]
|
||||
MockHobLib.cpp
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
GoogleTestLib
|
||||
|
||||
[BuildOptions]
|
||||
MSFT:*_*_*_CC_FLAGS = /EHsc
|
@@ -0,0 +1,36 @@
|
||||
/** @file
|
||||
Google Test mocks for PeiServicesLib
|
||||
|
||||
Copyright (c) 2023, Intel Corporation. All rights reserved.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
|
||||
#include <GoogleTest/Library/MockPeiServicesLib.h>
|
||||
|
||||
MOCK_INTERFACE_DEFINITION(MockPeiServicesLib);
|
||||
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesInstallPpi, 1, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesReInstallPpi, 2, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesLocatePpi, 4, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesNotifyPpi, 1, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesGetBootMode, 1, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesSetBootMode, 1, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesGetHobList, 1, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesCreateHob, 3, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesFfsFindNextVolume, 2, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesFfsFindNextFile, 3, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesFfsFindSectionData, 3, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesFfsFindSectionData3, 5, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesInstallPeiMemory, 2, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesAllocatePages, 3, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesFreePages, 2, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesAllocatePool, 2, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesResetSystem, 0, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesFfsFindFileByName, 3, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesFfsGetFileInfo, 2, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesFfsGetFileInfo2, 2, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesFfsGetVolumeInfo, 2, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesRegisterForShadow, 1, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesInstallFvInfoPpi, 5, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesInstallFvInfo2Ppi, 6, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION(MockPeiServicesLib, PeiServicesResetSystem2, 4, EFIAPI);
|
@@ -0,0 +1,32 @@
|
||||
## @file
|
||||
# Mock PEI Services Library implementation.
|
||||
#
|
||||
# Copyright (c) 2023, Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = MockPeiServicesLib
|
||||
FILE_GUID = FC944493-C0C0-482D-A1CC-72CE12C4BEEA
|
||||
MODULE_TYPE = HOST_APPLICATION
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = PeiServicesLib
|
||||
PI_SPECIFICATION_VERSION = 0x0001000A
|
||||
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64
|
||||
#
|
||||
|
||||
[Sources]
|
||||
MockPeiServicesLib.cpp
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
GoogleTestLib
|
||||
|
||||
[BuildOptions]
|
||||
MSFT:*_*_*_CC_FLAGS = /EHsc
|
Reference in New Issue
Block a user