EmbeddedPkg/EmbeddedPkg.dec | 1 + .../Library/MockDtPlatformDtbLoaderLib.h | 31 +++++++++++++++++++ .../MockDtPlatformDtbLoaderLib.cpp | 13 ++++++++ .../MockDtPlatformDtbLoaderLib.inf | 29 +++++++++++++++++ 4 files changed, 74 insertions(+) create mode 100644 EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtbLoaderLib.h create mode 100644 EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.cpp create mode 100644 EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.inf
Add Google Mock Library for DtPlatformLoaderDtbLib
Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
---
EmbeddedPkg/EmbeddedPkg.dec | 1 +
.../Library/MockDtPlatformDtbLoaderLib.h | 31 +++++++++++++++++++
.../MockDtPlatformDtbLoaderLib.cpp | 13 ++++++++
.../MockDtPlatformDtbLoaderLib.inf | 29 +++++++++++++++++
4 files changed, 74 insertions(+)
create mode 100644 EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtbLoaderLib.h
create mode 100644 EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.cpp
create mode 100644 EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/MockDtPlatformDtbLoaderLib.inf
diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec
index 94dc3c9b76..b4834e8b4f 100644
--- a/EmbeddedPkg/EmbeddedPkg.dec
+++ b/EmbeddedPkg/EmbeddedPkg.dec
@@ -28,6 +28,7 @@
################################################################################
[Includes.common]
Include # Root include for the package
+ Test/Mock/Include
[LibraryClasses.common]
PrePiLib|Include/Library/PrePiLib.h
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 0000000000..23dab21668
--- /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 0000000000..a5db68e59a
--- /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);
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 0000000000..9618efd864
--- /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
--
2.34.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112311): https://edk2.groups.io/g/devel/message/112311
Mute This Topic: https://groups.io/mt/103110931/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
[AMD Official Use Only - General] Not familiar with gmock and no idea of adding a cpp source file to edk2 (we done this on edk2 before?). May need someone else to review this change. Thanks Abner > -----Original Message----- > From: Jeff Brasen <jbrasen@nvidia.com> > Sent: Monday, December 11, 2023 11:47 PM > To: devel@edk2.groups.io > Cc: Chang, Abner <Abner.Chang@amd.com>; ardb+tianocore@kernel.org; > quic_llindhol@quicinc.com; Jeff Brasen <jbrasen@nvidia.com> > Subject: [PATCH] EmbeddedPkg: Add DtPlatformLoaderLib gmock support > > Caution: This message originated from an External Source. Use proper caution > when opening attachments, clicking links, or responding. > > > Add Google Mock Library for DtPlatformLoaderDtbLib > > Signed-off-by: Jeff Brasen <jbrasen@nvidia.com> > --- > EmbeddedPkg/EmbeddedPkg.dec | 1 + > .../Library/MockDtPlatformDtbLoaderLib.h | 31 +++++++++++++++++++ > .../MockDtPlatformDtbLoaderLib.cpp | 13 ++++++++ > .../MockDtPlatformDtbLoaderLib.inf | 29 +++++++++++++++++ > 4 files changed, 74 insertions(+) > create mode 100644 > EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtbLo > aderLib.h > create mode 100644 > EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/ > MockDtPlatformDtbLoaderLib.cpp > create mode 100644 > EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLib/ > MockDtPlatformDtbLoaderLib.inf > > diff --git a/EmbeddedPkg/EmbeddedPkg.dec > b/EmbeddedPkg/EmbeddedPkg.dec > index 94dc3c9b76..b4834e8b4f 100644 > --- a/EmbeddedPkg/EmbeddedPkg.dec > +++ b/EmbeddedPkg/EmbeddedPkg.dec > @@ -28,6 +28,7 @@ > > ################################################################### > ############# > [Includes.common] > Include # Root include for the package > + Test/Mock/Include > > [LibraryClasses.common] > PrePiLib|Include/Library/PrePiLib.h > diff --git > a/EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtb > LoaderLib.h > b/EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtb > LoaderLib.h > new file mode 100644 > index 0000000000..23dab21668 > --- /dev/null > +++ > b/EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtb > LoaderLib.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/MockDtPlatformDtbLoaderLi > b/MockDtPlatformDtbLoaderLib.cpp > b/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLi > b/MockDtPlatformDtbLoaderLib.cpp > new file mode 100644 > index 0000000000..a5db68e59a > --- /dev/null > +++ > b/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLi > b/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); > diff --git > a/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLi > b/MockDtPlatformDtbLoaderLib.inf > b/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLi > b/MockDtPlatformDtbLoaderLib.inf > new file mode 100644 > index 0000000000..9618efd864 > --- /dev/null > +++ > b/EmbeddedPkg/Test/Mock/Library/GoogleTest/MockDtPlatformDtbLoaderLi > b/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 > -- > 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112614): https://edk2.groups.io/g/devel/message/112614 Mute This Topic: https://groups.io/mt/103110931/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2024 Red Hat, Inc.