Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EmbeddedPkg: Add DtPlatformLoaderLib gmock support #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions EmbeddedPkg/EmbeddedPkg.dec
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
################################################################################
[Includes.common]
Include # Root include for the package
Test/Mock/Include

[LibraryClasses.common]
PrePiLib|Include/Library/PrePiLib.h
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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);
Original file line number Diff line number Diff line change
@@ -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