Skip to content

Commit

Permalink
AdvLoggerPkg: Remove MockAdvancedLogger.cpp
Browse files Browse the repository at this point in the history
Delete MockAdvancedLogger.cpp and move mock function definitions
to MockAdvancedLogger.h.
  • Loading branch information
VivianNK committed Aug 20, 2024
1 parent 0f242a9 commit 8e7f35e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ VERSION_STRING = 1.0
[Sources]
../AdvancedLoggerLib.c # Source for extern mInitialized
AdvancedLoggerDxeLibGoogleTest.cpp
../../../../Test/Mock/Library/GoogleTest/Protocol/MockAdvancedLogger.cpp
# MdePkg/Test/Mock/Library/GoogleTest/Protocol/MockDebugPort.cpp # Waiting on MockDebugPort

[Packages]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,23 @@ extern "C" {
extern ADVANCED_LOGGER_PROTOCOL *gALProtocol;
}

//
// Mock function definitions in header file to prevent need of cpp file and
// make it easier to consume in tests.
// This is only suitable for protocol mocks.
//

MOCK_INTERFACE_DEFINITION (MockAdvancedLogger);
MOCK_FUNCTION_DEFINITION (MockAdvancedLogger, gAL_AdvancedLoggerWriteProtocol, 4, EFIAPI);

static ADVANCED_LOGGER_PROTOCOL advancedLoggerInstance = {
ADVANCED_LOGGER_PROTOCOL_SIGNATURE, // UINT32
ADVANCED_LOGGER_PROTOCOL_VERSION, // UINT32
gAL_AdvancedLoggerWriteProtocol // ADVANCED_LOGGER_WRITE_PROTOCOL
};

extern "C" {
ADVANCED_LOGGER_PROTOCOL *gALProtocol = &advancedLoggerInstance;
}

#endif // MOCK_ADVANCED_LOGGER_LIB_H_

This file was deleted.

0 comments on commit 8e7f35e

Please sign in to comment.