diff options
author | Jeff Brasen via groups.io <jbrasen=nvidia.com@groups.io> | 2023-12-28 12:47:08 -0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-01-03 13:43:18 +0000 |
commit | 7a5823f85be99b9a92751fcf4141f7982fa5cc80 (patch) | |
tree | 2bb836535d87f899ad55d2a3e9dc2cb799d5d710 /EmbeddedPkg | |
parent | 5804e94886ea3ccb0b0346c40a929f5e3fd2c508 (diff) | |
download | edk2-7a5823f85be99b9a92751fcf4141f7982fa5cc80.zip edk2-7a5823f85be99b9a92751fcf4141f7982fa5cc80.tar.gz edk2-7a5823f85be99b9a92751fcf4141f7982fa5cc80.tar.bz2 |
EmbeddedPkg: Add DtPlatformLoaderLib gmock support
Add Google Mock Library for DtPlatformLoaderDtbLib
Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
Diffstat (limited to 'EmbeddedPkg')
4 files changed, 74 insertions, 0 deletions
diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec index 94dc3c9..b4834e8 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 0000000..ce0fca2 --- /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 0000000..a5db68e --- /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 0000000..9618efd --- /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
|