diff --git a/AdvLoggerPkg/Test/Mock/Include/GoogleTest/Library/MockAdvancedLoggerAccessLib.h b/AdvLoggerPkg/Test/Mock/Include/GoogleTest/Library/MockAdvancedLoggerAccessLib.h new file mode 100644 index 0000000000..d2d4eaae30 --- /dev/null +++ b/AdvLoggerPkg/Test/Mock/Include/GoogleTest/Library/MockAdvancedLoggerAccessLib.h @@ -0,0 +1,51 @@ +/** @file + Google Test mocks for AdvancedLoggerAccessLib + + Copyright (c) Microsoft Corporation. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef MOCK_ADVANCED_LOGGER_ACCESS_LIB_H_ +#define MOCK_ADVANCED_LOGGER_ACCESS_LIB_H_ + +#include +#include +extern "C" { + #include + #include + #include + #include + #include + #include +} + +struct MockAdvancedLoggerAccessLib { + MOCK_INTERFACE_DECLARATION (MockAdvancedLoggerAccessLib); + + MOCK_FUNCTION_DECLARATION ( + EFI_STATUS, + AdvancedLoggerAccessLibGetNextMessageBlock, + (IN ADVANCED_LOGGER_ACCESS_MESSAGE_BLOCK_ENTRY *BlockEntry) + ); + + MOCK_FUNCTION_DECLARATION ( + EFI_STATUS, + AdvancedLoggerAccessLibGetNextFormattedLine, + (IN ADVANCED_LOGGER_ACCESS_MESSAGE_LINE_ENTRY *LineEntry) + ); + + MOCK_FUNCTION_DECLARATION ( + EFI_STATUS, + AdvancedLoggerAccessLibReset, + (IN ADVANCED_LOGGER_ACCESS_MESSAGE_LINE_ENTRY *AccessEntry) + ); + + MOCK_FUNCTION_DECLARATION ( + EFI_STATUS, + AdvancedLoggerAccessLibUnitTestInitialize, + (IN ADVANCED_LOGGER_PROTOCOL *TestProtocol OPTIONAL, + IN UINT16 MaxMessageSize) + ); +}; + +#endif diff --git a/AdvLoggerPkg/Test/Mock/Include/GoogleTest/Library/MockAdvancedLoggerHdwPortLib.h b/AdvLoggerPkg/Test/Mock/Include/GoogleTest/Library/MockAdvancedLoggerHdwPortLib.h new file mode 100644 index 0000000000..d2c40cb8aa --- /dev/null +++ b/AdvLoggerPkg/Test/Mock/Include/GoogleTest/Library/MockAdvancedLoggerHdwPortLib.h @@ -0,0 +1,40 @@ +/** @file + 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 +#include +extern "C" { + #include + #include + #include + #include + #include + #include +} + +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 diff --git a/AdvLoggerPkg/Test/Mock/Include/GoogleTest/Library/MockAdvancedLoggerLib.h b/AdvLoggerPkg/Test/Mock/Include/GoogleTest/Library/MockAdvancedLoggerLib.h new file mode 100644 index 0000000000..6b60735df7 --- /dev/null +++ b/AdvLoggerPkg/Test/Mock/Include/GoogleTest/Library/MockAdvancedLoggerLib.h @@ -0,0 +1,34 @@ +/** @file + Google Test mocks for AdvancedLoggerLib + + Copyright (c) Microsoft Corporation. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef MOCK_ADVANCED_LOGGER_LIB_H_ +#define MOCK_ADVANCED_LOGGER_LIB_H_ + +#include +#include +extern "C" { + #include + #include + #include + #include + #include + #include +} + +struct MockAdvancedLoggerLib { + MOCK_INTERFACE_DECLARATION (MockAdvancedLoggerLib); + + MOCK_FUNCTION_DECLARATION ( + VOID, + AdvancedLoggerWrite, + (IN UINTN ErrorLevel, + IN CONST CHAR8 *Buffer, + IN UINTN NumberOfBytes) + ); +}; + +#endif diff --git a/AdvLoggerPkg/Test/Mock/Library/GoogleTest/MockAdvancedLoggerAccessLib/MockAdvancedLoggerAccessLib.cpp b/AdvLoggerPkg/Test/Mock/Library/GoogleTest/MockAdvancedLoggerAccessLib/MockAdvancedLoggerAccessLib.cpp new file mode 100644 index 0000000000..512937ced6 --- /dev/null +++ b/AdvLoggerPkg/Test/Mock/Library/GoogleTest/MockAdvancedLoggerAccessLib/MockAdvancedLoggerAccessLib.cpp @@ -0,0 +1,19 @@ +/** @file + Google Test mocks for AdvancedLoggerAccessLib + + Copyright (c) Microsoft Corporation. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include + +// +// Global Variables that are not const +// + +MOCK_INTERFACE_DEFINITION (MockAdvancedLoggerAccessLib); + +MOCK_FUNCTION_DEFINITION (MockAdvancedLoggerAccessLib, AdvancedLoggerAccessLibGetNextMessageBlock, 1, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockAdvancedLoggerAccessLib, AdvancedLoggerAccessLibGetNextFormattedLine, 1, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockAdvancedLoggerAccessLib, AdvancedLoggerAccessLibReset, 1, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockAdvancedLoggerAccessLib, AdvancedLoggerAccessLibUnitTestInitialize, 2, EFIAPI); diff --git a/AdvLoggerPkg/Test/Mock/Library/GoogleTest/MockAdvancedLoggerAccessLib/MockAdvancedLoggerAccessLib.inf b/AdvLoggerPkg/Test/Mock/Library/GoogleTest/MockAdvancedLoggerAccessLib/MockAdvancedLoggerAccessLib.inf new file mode 100644 index 0000000000..2809be0df6 --- /dev/null +++ b/AdvLoggerPkg/Test/Mock/Library/GoogleTest/MockAdvancedLoggerAccessLib/MockAdvancedLoggerAccessLib.inf @@ -0,0 +1,34 @@ +## @file +# Google Test mocks for AdvancedLoggerAccessLib +# +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MockAdvancedLoggerAccessLib + FILE_GUID = 476554ce-578a-5a9d-87ad-52d1fa226108 + MODULE_TYPE = HOST_APPLICATION + VERSION_STRING = 1.0 + LIBRARY_CLASS = AdvancedLoggerAccessLib + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + MockAdvancedLoggerAccessLib.cpp + +[Packages] + AdvLoggerPkg/AdvLoggerPkg.dec + MdePkg/MdePkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + +[LibraryClasses] + GoogleTestLib + +[BuildOptions] + MSFT:*_*_*_CC_FLAGS = /EHs diff --git a/AdvLoggerPkg/Test/Mock/Library/GoogleTest/MockAdvancedLoggerHdwPortLib/MockAdvancedLoggerHdwPortLib.cpp b/AdvLoggerPkg/Test/Mock/Library/GoogleTest/MockAdvancedLoggerHdwPortLib/MockAdvancedLoggerHdwPortLib.cpp new file mode 100644 index 0000000000..665509f037 --- /dev/null +++ b/AdvLoggerPkg/Test/Mock/Library/GoogleTest/MockAdvancedLoggerHdwPortLib/MockAdvancedLoggerHdwPortLib.cpp @@ -0,0 +1,17 @@ +/** @file + Google Test mocks for AdvancedLoggerHdwPortLib + + Copyright (c) Microsoft Corporation. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include + +// +// Global Variables that are not const +// + +MOCK_INTERFACE_DEFINITION (MockAdvancedLoggerHdwPortLib); + +MOCK_FUNCTION_DEFINITION (MockAdvancedLoggerHdwPortLib, AdvancedLoggerHdwPortInitialize, 0, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockAdvancedLoggerHdwPortLib, AdvancedLoggerHdwPortWrite, 3, EFIAPI); diff --git a/AdvLoggerPkg/Test/Mock/Library/GoogleTest/MockAdvancedLoggerHdwPortLib/MockAdvancedLoggerHdwPortLib.inf b/AdvLoggerPkg/Test/Mock/Library/GoogleTest/MockAdvancedLoggerHdwPortLib/MockAdvancedLoggerHdwPortLib.inf new file mode 100644 index 0000000000..001ba7a9b3 --- /dev/null +++ b/AdvLoggerPkg/Test/Mock/Library/GoogleTest/MockAdvancedLoggerHdwPortLib/MockAdvancedLoggerHdwPortLib.inf @@ -0,0 +1,34 @@ +## @file +# 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 diff --git a/AdvLoggerPkg/Test/Mock/Library/GoogleTest/MockAdvancedLoggerLib/MockAdvancedLoggerLib.cpp b/AdvLoggerPkg/Test/Mock/Library/GoogleTest/MockAdvancedLoggerLib/MockAdvancedLoggerLib.cpp new file mode 100644 index 0000000000..5d2502ce74 --- /dev/null +++ b/AdvLoggerPkg/Test/Mock/Library/GoogleTest/MockAdvancedLoggerLib/MockAdvancedLoggerLib.cpp @@ -0,0 +1,16 @@ +/** @file + Google Test mocks for AdvancedLoggerLib + + Copyright (c) Microsoft Corporation. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include + +// +// Global Variables that are not const +// + +MOCK_INTERFACE_DEFINITION (MockAdvancedLoggerLib); + +MOCK_FUNCTION_DEFINITION (MockAdvancedLoggerLib, AdvancedLoggerWrite, 3, EFIAPI); diff --git a/AdvLoggerPkg/Test/Mock/Library/GoogleTest/MockAdvancedLoggerLib/MockAdvancedLoggerLib.inf b/AdvLoggerPkg/Test/Mock/Library/GoogleTest/MockAdvancedLoggerLib/MockAdvancedLoggerLib.inf new file mode 100644 index 0000000000..0a1d52e30e --- /dev/null +++ b/AdvLoggerPkg/Test/Mock/Library/GoogleTest/MockAdvancedLoggerLib/MockAdvancedLoggerLib.inf @@ -0,0 +1,34 @@ +## @file +# Google Test mocks for AdvancedLoggerLib +# +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MockAdvancedLoggerLib + FILE_GUID = 068a7898-bd23-5155-b794-2343a7309f42 + MODULE_TYPE = HOST_APPLICATION + VERSION_STRING = 1.0 + LIBRARY_CLASS = AdvancedLoggerLib + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + MockAdvancedLoggerLib.cpp + +[Packages] + AdvLoggerPkg/AdvLoggerPkg.dec + MdePkg/MdePkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + +[LibraryClasses] + GoogleTestLib + +[BuildOptions] + MSFT:*_*_*_CC_FLAGS = /EHs