-
Notifications
You must be signed in to change notification settings - Fork 162
[Rebase & FF] Revert #1106 Clean up history to match release/202405 #1162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
VivianNK
wants to merge
7
commits into
microsoft:dev/202405
from
VivianNK:personal/vnowkakeane/mocks-revert
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
456eada
Add mock functions under MockUefiLib and Create Mock for AcpiTable, F…
TsunFeng 1b01f83
Revert "Add mock functions under MockUefiLib and Create Mock for Acpi…
VivianNK 3cc0487
Revert "MdeModulePkg: CodeQL Fixes."
apop5 2828739
MdeModulePkg: CodeQL Fixes.
makubacki 0566308
[Cherry-Pick] Support Report Status Code in the UefiPxe driver.
yhsu3 2706963
[CHERRY-PICK] MdePkg: Bring in mocks from 2405
VivianNK 672000f
MdePkg: Add mocks for AcpiTable and more
TsunFeng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
31 changes: 31 additions & 0 deletions
31
MdePkg/Test/Mock/Include/GoogleTest/Library/MockDxeServicesTableLib.h
This file contains hidden or 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,31 @@ | ||
| /** @file MockDxeServicesTableLib.h | ||
| Google Test mocks for DxeServicesTableLib | ||
|
|
||
| Copyright (c) Microsoft Corporation. | ||
| SPDX-License-Identifier: BSD-2-Clause-Patent | ||
| **/ | ||
|
|
||
| #ifndef MOCK_DXE_SERVICES_TABLE_LIB_H_ | ||
| #define MOCK_DXE_SERVICES_TABLE_LIB_H_ | ||
|
|
||
| #include <Library/GoogleTestLib.h> | ||
| #include <Library/FunctionMockLib.h> | ||
| extern "C" { | ||
| #include <Uefi.h> | ||
| #include <Pi/PiDxeCis.h> | ||
| } | ||
|
|
||
| // | ||
| // Declarations to handle usage of the DxeServicesTableLib by creating mock | ||
| // | ||
| struct MockDxeServicesTableLib { | ||
| MOCK_INTERFACE_DECLARATION (MockDxeServicesTableLib); | ||
|
|
||
| MOCK_FUNCTION_DECLARATION ( | ||
| EFI_STATUS, | ||
| gDS_Dispatch, | ||
| () | ||
| ); | ||
| }; | ||
|
|
||
| #endif // MOCK_UEFI_DXE_SERVICES_TABLE_LIB_H_ |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
48 changes: 48 additions & 0 deletions
48
MdePkg/Test/Mock/Include/GoogleTest/Ppi/MockPeiReportStatusCodeHandler.h
This file contains hidden or 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,48 @@ | ||
| /** @file MockPeiReportStatusCodeHandler.h | ||
| This file declares a mock of Report Status Code Handler PPI. | ||
|
|
||
| Copyright (c) Microsoft Corporation. | ||
| SPDX-License-Identifier: BSD-2-Clause-Patent | ||
| **/ | ||
|
|
||
| #ifndef MOCK_PEI_REPORT_STATUS_CODE_HANDLER_PPI_H | ||
| #define MOCK_PEI_REPORT_STATUS_CODE_HANDLER_PPI_H | ||
|
|
||
| #include <Library/GoogleTestLib.h> | ||
| #include <Library/FunctionMockLib.h> | ||
| extern "C" { | ||
| #include <Uefi.h> | ||
| #include <Pi/PiPeiCis.h> | ||
| #include <Ppi/ReportStatusCodeHandler.h> | ||
| } | ||
|
|
||
| struct MockPeiReportStatusCodeHandler { | ||
| MOCK_INTERFACE_DECLARATION (MockPeiReportStatusCodeHandler); | ||
|
|
||
| MOCK_FUNCTION_DECLARATION ( | ||
| EFI_STATUS, | ||
| Register, | ||
| (IN EFI_PEI_RSC_HANDLER_CALLBACK Callback) | ||
| ); | ||
|
|
||
| MOCK_FUNCTION_DECLARATION ( | ||
| EFI_STATUS, | ||
| Unregister, | ||
| (IN EFI_PEI_RSC_HANDLER_CALLBACK Callback) | ||
| ); | ||
| }; | ||
|
|
||
| MOCK_INTERFACE_DEFINITION (MockPeiReportStatusCodeHandler); | ||
| MOCK_FUNCTION_DEFINITION (MockPeiReportStatusCodeHandler, Register, 1, EFIAPI); | ||
| MOCK_FUNCTION_DEFINITION (MockPeiReportStatusCodeHandler, Unregister, 1, EFIAPI); | ||
|
|
||
| EFI_PEI_RSC_HANDLER_PPI PeiRscHandlerPpi = { | ||
| Register, | ||
| Unregister | ||
| }; | ||
|
|
||
| extern "C" { | ||
| EFI_PEI_RSC_HANDLER_PPI *PeiRscHandlerPpiServices = &PeiRscHandlerPpi; | ||
| } | ||
|
|
||
| #endif |
139 changes: 139 additions & 0 deletions
139
MdePkg/Test/Mock/Include/GoogleTest/Protocol/MockAcpiSystemDescriptionTable.h
This file contains hidden or 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,139 @@ | ||
| /** @file MockAcpiSystemDescriptionTable.h | ||
| This file declares a mock of ACPI system description tables protocol. | ||
|
|
||
| Copyright (c) Microsoft Corporation. | ||
| SPDX-License-Identifier: BSD-2-Clause-Patent | ||
| **/ | ||
|
|
||
| #ifndef MOCK_ACPI_SYSTEM_DESCRIPTION_TABLE_H_ | ||
| #define MOCK_ACPI_SYSTEM_DESCRIPTION_TABLE_H_ | ||
|
|
||
| #include <Library/GoogleTestLib.h> | ||
| #include <Library/FunctionMockLib.h> | ||
|
|
||
| extern "C" { | ||
| #include <Uefi.h> | ||
| #include <Protocol/AcpiSystemDescriptionTable.h> | ||
| } | ||
|
|
||
| struct MockAcpiSdtProtocol { | ||
| MOCK_INTERFACE_DECLARATION (MockAcpiSdtProtocol); | ||
|
|
||
| MOCK_FUNCTION_DECLARATION ( | ||
| EFI_STATUS, | ||
| GetAcpiTable, | ||
| ( | ||
| IN UINTN Index, | ||
| OUT EFI_ACPI_SDT_HEADER **Table, | ||
| OUT EFI_ACPI_TABLE_VERSION *Version, | ||
| OUT UINTN *TableKey | ||
| ) | ||
| ); | ||
|
|
||
| MOCK_FUNCTION_DECLARATION ( | ||
| EFI_STATUS, | ||
| RegisterNotify, | ||
| ( | ||
| IN BOOLEAN Register, | ||
| IN EFI_ACPI_NOTIFICATION_FN Notification | ||
| ) | ||
| ); | ||
|
|
||
| MOCK_FUNCTION_DECLARATION ( | ||
| EFI_STATUS, | ||
| Open, | ||
| ( | ||
| IN VOID *Buffer, | ||
| OUT EFI_ACPI_HANDLE *Handle | ||
| ) | ||
| ); | ||
|
|
||
| MOCK_FUNCTION_DECLARATION ( | ||
| EFI_STATUS, | ||
| OpenSdt, | ||
| ( | ||
| IN UINTN TableKey, | ||
| OUT EFI_ACPI_HANDLE *Handle | ||
| ) | ||
| ); | ||
|
|
||
| MOCK_FUNCTION_DECLARATION ( | ||
| EFI_STATUS, | ||
| Close, | ||
| ( | ||
| IN EFI_ACPI_HANDLE Handle | ||
| ) | ||
| ); | ||
|
|
||
| MOCK_FUNCTION_DECLARATION ( | ||
| EFI_STATUS, | ||
| GetChild, | ||
| ( | ||
| IN EFI_ACPI_HANDLE ParentHandle, | ||
| IN OUT EFI_ACPI_HANDLE *Handle | ||
| ) | ||
| ); | ||
|
|
||
| MOCK_FUNCTION_DECLARATION ( | ||
| EFI_STATUS, | ||
| GetOption, | ||
| ( | ||
| IN EFI_ACPI_HANDLE Handle, | ||
| IN UINTN Index, | ||
| OUT EFI_ACPI_DATA_TYPE *DataType, | ||
| OUT CONST VOID **Data, | ||
| OUT UINTN *DataSize | ||
| ) | ||
| ); | ||
|
|
||
| MOCK_FUNCTION_DECLARATION ( | ||
| EFI_STATUS, | ||
| SetOption, | ||
| ( | ||
| IN EFI_ACPI_HANDLE Handle, | ||
| IN UINTN Index, | ||
| IN CONST VOID *Data, | ||
| IN UINTN DataSize | ||
| ) | ||
| ); | ||
|
|
||
| MOCK_FUNCTION_DECLARATION ( | ||
| EFI_STATUS, | ||
| FindPath, | ||
| ( | ||
| IN EFI_ACPI_HANDLE HandleIn, | ||
| IN VOID *AcpiPath, | ||
| OUT EFI_ACPI_HANDLE *HandleOut | ||
| ) | ||
| ); | ||
| }; | ||
|
|
||
| MOCK_INTERFACE_DEFINITION (MockAcpiSdtProtocol); | ||
| MOCK_FUNCTION_DEFINITION (MockAcpiSdtProtocol, GetAcpiTable, 4, EFIAPI); | ||
| MOCK_FUNCTION_DEFINITION (MockAcpiSdtProtocol, RegisterNotify, 2, EFIAPI); | ||
| MOCK_FUNCTION_DEFINITION (MockAcpiSdtProtocol, Open, 2, EFIAPI); | ||
| MOCK_FUNCTION_DEFINITION (MockAcpiSdtProtocol, OpenSdt, 2, EFIAPI); | ||
| MOCK_FUNCTION_DEFINITION (MockAcpiSdtProtocol, Close, 1, EFIAPI); | ||
| MOCK_FUNCTION_DEFINITION (MockAcpiSdtProtocol, GetChild, 2, EFIAPI); | ||
| MOCK_FUNCTION_DEFINITION (MockAcpiSdtProtocol, GetOption, 5, EFIAPI); | ||
| MOCK_FUNCTION_DEFINITION (MockAcpiSdtProtocol, SetOption, 4, EFIAPI); | ||
| MOCK_FUNCTION_DEFINITION (MockAcpiSdtProtocol, FindPath, 3, EFIAPI); | ||
|
|
||
| EFI_ACPI_SDT_PROTOCOL ACPI_SDT_PROTOCOL_INSTANCE = { | ||
| 0, | ||
| GetAcpiTable, // EFI_ACPI_TABLE_INSTALL_ACPI_TABLE | ||
| RegisterNotify, // EFI_ACPI_TABLE_UNINSTALL_ACPI_TABLE | ||
| Open, | ||
| OpenSdt, | ||
| Close, | ||
| GetChild, | ||
| GetOption, | ||
| SetOption, | ||
| FindPath | ||
| }; | ||
|
|
||
| extern "C" { | ||
| EFI_ACPI_SDT_PROTOCOL *gAcpiSdtProtocol = &ACPI_SDT_PROTOCOL_INSTANCE; | ||
| } | ||
|
|
||
| #endif // MOCK_ACPI_SYSTEM_DESCRIPTION_TABLE_H_ |
56 changes: 56 additions & 0 deletions
56
MdePkg/Test/Mock/Include/GoogleTest/Protocol/MockAcpiTable.h
This file contains hidden or 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,56 @@ | ||
| /** @file MockAcpiTable.h | ||
| This file declares a mock of Acpi table protocol. | ||
|
|
||
| Copyright (c) Microsoft Corporation. | ||
| SPDX-License-Identifier: BSD-2-Clause-Patent | ||
| **/ | ||
|
|
||
| #ifndef MOCK_ACPI_TABLE_H_ | ||
| #define MOCK_ACPI_TABLE_H_ | ||
|
|
||
| #include <Library/GoogleTestLib.h> | ||
| #include <Library/FunctionMockLib.h> | ||
|
|
||
| extern "C" { | ||
| #include <Uefi.h> | ||
| #include <Protocol/AcpiTable.h> | ||
| } | ||
|
|
||
| struct MockAcpiTableProtocol { | ||
| MOCK_INTERFACE_DECLARATION (MockAcpiTableProtocol); | ||
|
|
||
| MOCK_FUNCTION_DECLARATION ( | ||
| EFI_STATUS, | ||
| InstallAcpiTable, | ||
| ( | ||
| IN EFI_ACPI_TABLE_PROTOCOL *This, | ||
| IN VOID *AcpiTableBuffer, | ||
| IN UINTN AcpiTableBufferSize, | ||
| OUT UINTN *TableKey | ||
| ) | ||
| ); | ||
|
|
||
| MOCK_FUNCTION_DECLARATION ( | ||
| EFI_STATUS, | ||
| UninstallAcpiTable, | ||
| ( | ||
| IN EFI_ACPI_TABLE_PROTOCOL *This, | ||
| IN UINTN TableKey | ||
| ) | ||
| ); | ||
| }; | ||
|
|
||
| MOCK_INTERFACE_DEFINITION (MockAcpiTableProtocol); | ||
| MOCK_FUNCTION_DEFINITION (MockAcpiTableProtocol, InstallAcpiTable, 4, EFIAPI); | ||
| MOCK_FUNCTION_DEFINITION (MockAcpiTableProtocol, UninstallAcpiTable, 2, EFIAPI); | ||
|
|
||
| EFI_ACPI_TABLE_PROTOCOL ACPI_TABLE_PROTOCOL_INSTANCE = { | ||
| InstallAcpiTable, // EFI_ACPI_TABLE_INSTALL_ACPI_TABLE | ||
| UninstallAcpiTable // EFI_ACPI_TABLE_UNINSTALL_ACPI_TABLE | ||
| }; | ||
|
|
||
| extern "C" { | ||
| EFI_ACPI_TABLE_PROTOCOL *gAcpiTableProtocol = &ACPI_TABLE_PROTOCOL_INSTANCE; | ||
| } | ||
|
|
||
| #endif // MOCK_ACPI_TABLE_H_ |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.