Add Google Mock Library for DtPlatformLoaderDtbLib

Signed-off-by: Jeff Brasen <jbra...@nvidia.com>
---
 EmbeddedPkg/EmbeddedPkg.dec                   |  1 +
 .../MockDtPlatformDtbLoaderLib.inf            | 29 +++++++++++++++++
 .../Library/MockDtPlatformDtbLoaderLib.h      | 31 +++++++++++++++++++
 .../MockDtPlatformDtbLoaderLib.cpp            | 13 ++++++++
 4 files changed, 74 insertions(+)
 create mode 100644 
EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.inf
 create mode 100644 
EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtbLoaderLib.h
 create mode 100644 
EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.cpp

diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec
index 94dc3c9b76ca..b4834e8b4f88 100644
--- a/EmbeddedPkg/EmbeddedPkg.dec
+++ b/EmbeddedPkg/EmbeddedPkg.dec
@@ -28,6 +28,7 @@ [Defines]
 
################################################################################
 [Includes.common]
   Include                        # Root include for the package
+  Test/Mock/Include
 
 [LibraryClasses.common]
   PrePiLib|Include/Library/PrePiLib.h
diff --git 
a/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.inf
 
b/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.inf
new file mode 100644
index 000000000000..9618efd86470
--- /dev/null
+++ 
b/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/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
diff --git 
a/EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtbLoaderLib.h 
b/EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtbLoaderLib.h
new file mode 100644
index 000000000000..ce0fca2c3293
--- /dev/null
+++ 
b/EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtbLoaderLib.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/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.cpp
 
b/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.cpp
new file mode 100644
index 000000000000..a5db68e59a09
--- /dev/null
+++ 
b/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/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);
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112992): https://edk2.groups.io/g/devel/message/112992
Mute This Topic: https://groups.io/mt/103407486/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to