summaryrefslogtreecommitdiffstats
path: root/MdePkg
diff options
context:
space:
mode:
authorTsunFeng <v-tshuang@microsoft.com>2024-10-17 22:45:25 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-10-30 16:47:32 +0000
commitb72d3495ee52de1ba3b9da4c17aa80bffd7a8a22 (patch)
tree8e5a90b45546c9bb38694080663ccb1bf636cc31 /MdePkg
parentfc6a8bb131e10961d4b8b4387c9221af89784d6c (diff)
downloadedk2-b72d3495ee52de1ba3b9da4c17aa80bffd7a8a22.tar.gz
edk2-b72d3495ee52de1ba3b9da4c17aa80bffd7a8a22.tar.bz2
edk2-b72d3495ee52de1ba3b9da4c17aa80bffd7a8a22.zip
MdePkg: Add Google Mock Library for PostCodeLib
Signed-off-by: TsunFeng <v-tshuang@microsoft.com>
Diffstat (limited to 'MdePkg')
-rw-r--r--MdePkg/Test/MdePkgHostTest.dsc1
-rw-r--r--MdePkg/Test/Mock/Include/GoogleTest/Library/MockPostCodeLib.h56
-rw-r--r--MdePkg/Test/Mock/Library/GoogleTest/MockPostCodeLib/MockPostCodeLib.cpp14
-rw-r--r--MdePkg/Test/Mock/Library/GoogleTest/MockPostCodeLib/MockPostCodeLib.inf33
4 files changed, 104 insertions, 0 deletions
diff --git a/MdePkg/Test/MdePkgHostTest.dsc b/MdePkg/Test/MdePkgHostTest.dsc
index db99b0a3a3..0f9daa4bac 100644
--- a/MdePkg/Test/MdePkgHostTest.dsc
+++ b/MdePkg/Test/MdePkgHostTest.dsc
@@ -47,6 +47,7 @@
MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.inf
MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.inf
MdePkg/Test/Mock/Library/GoogleTest/MockFdtLib/MockFdtLib.inf
+ MdePkg/Test/Mock/Library/GoogleTest/MockPostCodeLib/MockPostCodeLib.inf
MdePkg/Test/Mock/Library/GoogleTest/MockSmmServicesTableLib/MockSmmServicesTableLib.inf
MdePkg/Test/Mock/Library/GoogleTest/MockCpuLib/MockCpuLib.inf
MdePkg/Test/Mock/Library/GoogleTest/MockPciSegmentLib/MockPciSegmentLib.inf
diff --git a/MdePkg/Test/Mock/Include/GoogleTest/Library/MockPostCodeLib.h b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockPostCodeLib.h
new file mode 100644
index 0000000000..6ff36b576a
--- /dev/null
+++ b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockPostCodeLib.h
@@ -0,0 +1,56 @@
+/** @file MockPostCodeLib.h
+ Google Test mocks for PostCodeLib
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) Microsoft Corporation.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef MOCK_POST_CODE_LIB_H_
+#define MOCK_POST_CODE_LIB_H_
+
+#include <Library/GoogleTestLib.h>
+#include <Library/FunctionMockLib.h>
+extern "C" {
+ #include <Uefi.h>
+ #include <Library/PostCodeLib.h>
+}
+
+struct MockPostCodeLib {
+ MOCK_INTERFACE_DECLARATION (MockPostCodeLib);
+
+ MOCK_FUNCTION_DECLARATION (
+ UINT32,
+ PostCode,
+ (
+ IN UINT32 Value
+ )
+ );
+
+ MOCK_FUNCTION_DECLARATION (
+ UINT32,
+ PostCodeWithDescription,
+ (
+ IN UINT32 Value,
+ IN CONST CHAR8 *Description OPTIONAL
+ )
+ );
+
+ MOCK_FUNCTION_DECLARATION (
+ BOOLEAN,
+ PostCodeEnabled,
+ (
+
+ )
+ );
+
+ MOCK_FUNCTION_DECLARATION (
+ BOOLEAN,
+ PostCodeDescriptionEnabled,
+ (
+
+ )
+ );
+};
+
+#endif //MOCK_PCI_EXPRESS_LIB_H_
diff --git a/MdePkg/Test/Mock/Library/GoogleTest/MockPostCodeLib/MockPostCodeLib.cpp b/MdePkg/Test/Mock/Library/GoogleTest/MockPostCodeLib/MockPostCodeLib.cpp
new file mode 100644
index 0000000000..b10009a3de
--- /dev/null
+++ b/MdePkg/Test/Mock/Library/GoogleTest/MockPostCodeLib/MockPostCodeLib.cpp
@@ -0,0 +1,14 @@
+/** @file MockPostCodeLib.cpp
+ Google Test mocks for PostCodeLib
+
+ Copyright (c) Microsoft Corporation.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include <GoogleTest/Library/MockPostCodeLib.h>
+
+MOCK_INTERFACE_DEFINITION (MockPostCodeLib);
+MOCK_FUNCTION_DEFINITION (MockPostCodeLib, PostCode, 1, EFIAPI);
+MOCK_FUNCTION_DEFINITION (MockPostCodeLib, PostCodeWithDescription, 2, EFIAPI);
+MOCK_FUNCTION_DEFINITION (MockPostCodeLib, PostCodeEnabled, 0, EFIAPI);
+MOCK_FUNCTION_DEFINITION (MockPostCodeLib, PostCodeDescriptionEnabled, 0, EFIAPI);
diff --git a/MdePkg/Test/Mock/Library/GoogleTest/MockPostCodeLib/MockPostCodeLib.inf b/MdePkg/Test/Mock/Library/GoogleTest/MockPostCodeLib/MockPostCodeLib.inf
new file mode 100644
index 0000000000..236dfe3022
--- /dev/null
+++ b/MdePkg/Test/Mock/Library/GoogleTest/MockPostCodeLib/MockPostCodeLib.inf
@@ -0,0 +1,33 @@
+## @file MockPostCodeLib.inf
+# Google Test mocks for PostCodeLib
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = MockPostCodeLib
+ FILE_GUID = 25BF192B-A519-4997-823A-AFEC2C953627
+ MODULE_TYPE = HOST_APPLICATION
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = PostCodeLib
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64
+#
+
+[Sources]
+ MockPostCodeLib.cpp
+
+[Packages]
+ MdePkg/MdePkg.dec
+ UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec
+
+[LibraryClasses]
+ GoogleTestLib
+
+[BuildOptions]
+ MSFT:*_*_*_CC_FLAGS = /EHsc