-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description Added mock IpmiSelLib for use in GoogleTests For details on how to complete these options and their meaning refer to [CONTRIBUTING.md](https://github.com/microsoft/mu/blob/HEAD/CONTRIBUTING.md). - [ ] Impacts functionality? - [ ] Impacts security? - [ ] Breaking change? - [ ] Includes tests? - [ ] Includes documentation? ## How This Was Tested Added to a GoogleTest and verified functionality ## Integration Instructions N/A
- Loading branch information
1 parent
62ed307
commit 1e925a3
Showing
5 changed files
with
167 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
|
||
[Includes] | ||
Include | ||
Test/Mock/Include | ||
|
||
[LibraryClasses] | ||
IpmiBaseLib|Include/Library/IpmiBaseLib.h | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
IpmiFeaturePkg/Test/Mock/Include/GoogleTest/Library/MockIpmiSelLib.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/** @file MockIpmiSelLib.h | ||
Google Test mocks for IpmiSelLib | ||
Copyright (c) Microsoft Corporation | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#ifndef MOCK_IPMI_SEL_LIB_H_ | ||
#define MOCK_IPMI_SEL_LIB_H_ | ||
|
||
#include <Library/GoogleTestLib.h> | ||
#include <Library/FunctionMockLib.h> | ||
extern "C" { | ||
#include <Uefi.h> | ||
#include <Library/IpmiSelLib.h> | ||
} | ||
|
||
struct MockIpmiSelLib { | ||
MOCK_INTERFACE_DECLARATION (MockIpmiSelLib); | ||
|
||
MOCK_FUNCTION_DECLARATION ( | ||
EFI_STATUS, | ||
SelAddSystemEntry, | ||
( | ||
IN OUT UINT16 *RecordId OPTIONAL, | ||
IN UINT8 SensorType, | ||
IN UINT8 SensorNumber, | ||
IN UINT8 EventDirType, | ||
IN UINT8 Data0, | ||
IN UINT8 Data1, | ||
IN UINT8 Data2 | ||
) | ||
); | ||
|
||
MOCK_FUNCTION_DECLARATION ( | ||
EFI_STATUS, | ||
SelAddOemEntry, | ||
( | ||
IN OUT UINT16 *RecordId OPTIONAL, | ||
IN UINT8 RecordType, | ||
IN UINT8 Data[6] | ||
) | ||
); | ||
|
||
MOCK_FUNCTION_DECLARATION ( | ||
EFI_STATUS, | ||
SelAddOemEntryEx, | ||
( | ||
IN OUT UINT16 *RecordId OPTIONAL, | ||
IN UINT8 RecordType, | ||
IN UINT8 ManufacturerId[3], | ||
IN UINT8 Data[6] | ||
) | ||
); | ||
|
||
MOCK_FUNCTION_DECLARATION ( | ||
EFI_STATUS, | ||
SelAddOemEntryNoTimestamp, | ||
( | ||
IN OUT UINT16 *RecordId OPTIONAL, | ||
IN UINT8 RecordType, | ||
IN UINT8 Data[13] | ||
) | ||
); | ||
|
||
MOCK_FUNCTION_DECLARATION ( | ||
EFI_STATUS, | ||
SelClear, | ||
( | ||
BOOLEAN AwaitClear | ||
) | ||
); | ||
|
||
MOCK_FUNCTION_DECLARATION ( | ||
EFI_STATUS, | ||
SelGetTime, | ||
( | ||
OUT UINT32 *Time | ||
) | ||
); | ||
|
||
MOCK_FUNCTION_DECLARATION ( | ||
EFI_STATUS, | ||
SelSetTime, | ||
( | ||
IN UINT32 Time | ||
) | ||
); | ||
|
||
MOCK_FUNCTION_DECLARATION ( | ||
EFI_STATUS, | ||
SelGetInfo, | ||
( | ||
OUT SEL_INFO *SelInfo | ||
) | ||
); | ||
|
||
MOCK_FUNCTION_DECLARATION ( | ||
EFI_STATUS, | ||
SelGetEntry, | ||
( | ||
IN UINT16 RecordId, | ||
OUT SEL_RECORD *Record, | ||
OUT UINT16 *NextRecordId OPTIONAL | ||
) | ||
); | ||
}; | ||
|
||
#endif |
19 changes: 19 additions & 0 deletions
19
IpmiFeaturePkg/Test/Mock/Library/GoogleTest/MockIpmiSelLib/MockIpmiSelLib.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** @file MockIpmiSelLib.cpp | ||
Google Test mocks for IpmiSelLib | ||
Copyright (c) Microsoft Corporation | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#include <GoogleTest/Library/MockIpmiSelLib.h> | ||
|
||
MOCK_INTERFACE_DEFINITION (MockIpmiSelLib); | ||
MOCK_FUNCTION_DEFINITION (MockIpmiSelLib, SelAddSystemEntry, 7, EFIAPI); | ||
MOCK_FUNCTION_DEFINITION (MockIpmiSelLib, SelAddOemEntry, 3, EFIAPI); | ||
MOCK_FUNCTION_DEFINITION (MockIpmiSelLib, SelAddOemEntryEx, 4, EFIAPI); | ||
MOCK_FUNCTION_DEFINITION (MockIpmiSelLib, SelAddOemEntryNoTimestamp, 3, EFIAPI); | ||
MOCK_FUNCTION_DEFINITION (MockIpmiSelLib, SelClear, 1, EFIAPI); | ||
MOCK_FUNCTION_DEFINITION (MockIpmiSelLib, SelGetTime, 1, EFIAPI); | ||
MOCK_FUNCTION_DEFINITION (MockIpmiSelLib, SelSetTime, 1, EFIAPI); | ||
MOCK_FUNCTION_DEFINITION (MockIpmiSelLib, SelGetInfo, 1, EFIAPI); | ||
MOCK_FUNCTION_DEFINITION (MockIpmiSelLib, SelGetEntry, 3, EFIAPI); |
33 changes: 33 additions & 0 deletions
33
IpmiFeaturePkg/Test/Mock/Library/GoogleTest/MockIpmiSelLib/MockIpmiSelLib.inf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
## @file MockIpmiSelLib.inf | ||
# Google Test mocks for IpmiSelLib | ||
# | ||
# Copyright (c) Microsoft Corporation | ||
# SPDX-License-Identifier: BSD-2-Clause-Patent | ||
## | ||
|
||
[Defines] | ||
INF_VERSION = 0x00010005 | ||
BASE_NAME = MockIpmiSelLib | ||
FILE_GUID = DA4D1EA2-79FE-459A-94A5-1F4750C50BD7 | ||
MODULE_TYPE = HOST_APPLICATION | ||
VERSION_STRING = 1.0 | ||
LIBRARY_CLASS = IpmiSelLib | ||
PI_SPECIFICATION_VERSION = 0x0001000A | ||
|
||
# | ||
# VALID_ARCHITECTURES = IA32 X64 | ||
# | ||
|
||
[Sources] | ||
MockIpmiSelLib.cpp | ||
|
||
[Packages] | ||
MdePkg/MdePkg.dec | ||
UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec | ||
IpmiFeaturePkg/IpmiFeaturePkg.dec | ||
|
||
[LibraryClasses] | ||
GoogleTestLib | ||
|
||
[BuildOptions] | ||
MSFT:*_*_*_CC_FLAGS = /EHsc |