Skip to content

Commit

Permalink
AdvLoggerPkg: Add mock for AdvancedLoggerHdwPortLib
Browse files Browse the repository at this point in the history
  • Loading branch information
VivianNK committed Sep 9, 2024
1 parent fd8fbdb commit 28cf0ad
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/** @file MockAdvancedLoggerHdwPortLib.h
Google Test mocks for AdvancedLoggerHdwPortLib
Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#ifndef MOCK_ADVANCED_LOGGER_HDW_PORT_LIB_H_
#define MOCK_ADVANCED_LOGGER_HDW_PORT_LIB_H_

#include <Library/GoogleTestLib.h>
#include <Library/FunctionMockLib.h>
extern "C" {
#include <Uefi/UefiBaseType.h>
#include <Uefi.h>
#include <Library/AdvancedLoggerHdwPortLib.h>
}

struct MockAdvancedLoggerHdwPortLib {
MOCK_INTERFACE_DECLARATION (MockAdvancedLoggerHdwPortLib);

MOCK_FUNCTION_DECLARATION (
EFI_STATUS,
AdvancedLoggerHdwPortInitialize,
()
);

MOCK_FUNCTION_DECLARATION (
UINTN,
AdvancedLoggerHdwPortWrite,
(IN UINTN DebugLevel,
IN UINT8 *Buffer,
IN UINTN NumberOfBytes)
);
};

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** @file MockAdvancedLoggerHdwPortLib.cpp
Google Test mocks for AdvancedLoggerHdwPortLib
Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#include <GoogleTest/Library/MockAdvancedLoggerHdwPortLib.h>

MOCK_INTERFACE_DEFINITION (MockAdvancedLoggerHdwPortLib);

MOCK_FUNCTION_DEFINITION (MockAdvancedLoggerHdwPortLib, AdvancedLoggerHdwPortInitialize, 0, EFIAPI);
MOCK_FUNCTION_DEFINITION (MockAdvancedLoggerHdwPortLib, AdvancedLoggerHdwPortWrite, 3, EFIAPI);
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## @file MockAdvancedLoggerHdwPortLib.inf
# Google Test mocks for AdvancedLoggerHdwPortLib
#
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: BSD-2-Clause-Patent
##

[Defines]
INF_VERSION = 0x00010005
BASE_NAME = MockAdvancedLoggerHdwPortLib
FILE_GUID = 88069e60-ae8b-5d10-a654-9aa6ce8b328c
MODULE_TYPE = HOST_APPLICATION
VERSION_STRING = 1.0
LIBRARY_CLASS = AdvancedLoggerHdwPortLib

#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64
#

[Sources]
MockAdvancedLoggerHdwPortLib.cpp

[Packages]
AdvLoggerPkg/AdvLoggerPkg.dec
MdePkg/MdePkg.dec
UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec

[LibraryClasses]
GoogleTestLib

[BuildOptions]
MSFT:*_*_*_CC_FLAGS = /EHs /bigobj

0 comments on commit 28cf0ad

Please sign in to comment.