-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added mock functions for PciExpressLib
- Loading branch information
1 parent
c321f8c
commit 0182bec
Showing
4 changed files
with
92 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
45 changes: 45 additions & 0 deletions
45
MdePkg/Test/Mock/Include/GoogleTest/Library/MockPciExpressLib.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,45 @@ | ||
/** @file MockPciExpressLib.h | ||
Google Test mocks for PciExpressLib | ||
Copyright (c) Microsoft Corporation. | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#ifndef MOCK_PCI_EXPRESS_LIB_H_ | ||
#define MOCK_PCI_EXPRESS_LIB_H_ | ||
|
||
#include <Library/GoogleTestLib.h> | ||
#include <Library/FunctionMockLib.h> | ||
extern "C" { | ||
#include <Uefi.h> | ||
#include <Library/PciExpressLib.h> | ||
} | ||
|
||
struct MockPciExpressLib { | ||
MOCK_INTERFACE_DECLARATION (MockPciExpressLib); | ||
|
||
MOCK_FUNCTION_DECLARATION ( | ||
UINT8, | ||
PciExpressRead8, | ||
( | ||
IN UINTN Address | ||
) | ||
); | ||
MOCK_FUNCTION_DECLARATION ( | ||
UINT16, | ||
PciExpressRead16, | ||
( | ||
IN UINTN Address | ||
) | ||
); | ||
|
||
MOCK_FUNCTION_DECLARATION ( | ||
UINT32, | ||
PciExpressRead32, | ||
( | ||
IN UINTN Address | ||
) | ||
); | ||
}; | ||
|
||
#endif //MOCK_PCI_EXPRESS_LIB_H_ |
13 changes: 13 additions & 0 deletions
13
MdePkg/Test/Mock/Library/GoogleTest/MockPciExpressLib/MockPciExpressLib.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,13 @@ | ||
/** @file MockPciExpressLib.cpp | ||
Google Test mocks for PciExpressLib | ||
Copyright (c) Microsoft Corporation. | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#include <GoogleTest/Library/MockPciExpressLib.h> | ||
|
||
MOCK_INTERFACE_DEFINITION (MockPciExpressLib); | ||
MOCK_FUNCTION_DEFINITION (MockPciExpressLib, PciExpressRead8, 1, EFIAPI); | ||
MOCK_FUNCTION_DEFINITION (MockPciExpressLib, PciExpressRead16, 1, EFIAPI); | ||
MOCK_FUNCTION_DEFINITION (MockPciExpressLib, PciExpressRead32, 1, EFIAPI); |
33 changes: 33 additions & 0 deletions
33
MdePkg/Test/Mock/Library/GoogleTest/MockPciExpressLib/MockPciExpressLib.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 MockPciExpressLib.inf | ||
# Google Test mocks for PciExpressLib | ||
# | ||
# Copyright (c) Microsoft Corporation. | ||
# SPDX-License-Identifier: BSD-2-Clause-Patent | ||
## | ||
|
||
[Defines] | ||
INF_VERSION = 0x00010005 | ||
BASE_NAME = MockPciExpressLib | ||
FILE_GUID = EB17BE3C-2B3E-4B40-8C71-0EA4EF294EFA | ||
MODULE_TYPE = HOST_APPLICATION | ||
VERSION_STRING = 1.0 | ||
LIBRARY_CLASS = PciExpressLib | ||
|
||
# | ||
# The following information is for reference only and not required by the build tools. | ||
# | ||
# VALID_ARCHITECTURES = IA32 X64 | ||
# | ||
|
||
[Sources] | ||
MockPciExpressLib.cpp | ||
|
||
[Packages] | ||
MdePkg/MdePkg.dec | ||
UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec | ||
|
||
[LibraryClasses] | ||
GoogleTestLib | ||
|
||
[BuildOptions] | ||
MSFT:*_*_*_CC_FLAGS = /EHsc |