-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'personal/klautner/add_panic_library' of https://github.…
…com/kenlautner/mu_basecore into personal/klautner/add_panic_library
- Loading branch information
Showing
5 changed files
with
111 additions
and
17 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 |
---|---|---|
@@ -1,21 +1,25 @@ | ||
# Rust Host Unit Test Plugin | ||
|
||
This CI plugin runs all unit tests with coverage enabled, calculating coverage results on a per package basis. It filters results to only calculate coverage on files within the package. | ||
|
||
This CI plugin will also calculate coverage for the entire workspace. | ||
This CI plugin runs all unit tests and requires that they pass. If code coverage is turned on with | ||
`"CalculateCoverage": true`, then coverage percentages will be calculated on a per rust crate basis. | ||
|
||
## Plugin Customizations | ||
|
||
As a default, this plugin requires 75% coverage, though this can be configured within a packages ci.yaml file by adding the entry `RustCoverageCheck`. The required coverage percent can also be customized on a per (rust) package bases. | ||
- `CalculateCoverage`: true / false - Whether or not to calculate coverage results | ||
- `Coverage`: int (0, 1) - The percentage of coverage required to pass the CI check, if `CalculateCoverage` is enabled | ||
- `CoverageOverrides` int (0, 1) - Crate specific override of percentage needed to pass | ||
|
||
As a default, Calculating Coverage is enabled and at least 75% (.75) code coverage is required to pass. | ||
|
||
### Example ci settings | ||
|
||
``` yaml | ||
"RustHostUnitTestPlugin": { | ||
"CalculateCoverage": true, | ||
"Coverage": 1, | ||
"CoverageOverrides": { | ||
"DxeRust": 0.0, | ||
"UefiEventLib": 0.0, | ||
"DxeRust": 0.4, | ||
"UefiEventLib": 0.67, | ||
} | ||
} | ||
``` |
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
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
49 changes: 49 additions & 0 deletions
49
MdePkg/Test/Mock/Include/GoogleTest/Ppi/MockReadOnlyVariable2.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,49 @@ | ||
/** @file MockReadOnlyVariable2.h | ||
This file declares a mock of Read-only Variable Service2 PPI. | ||
This PPI permits read-only access to the UEFI variable store during the PEI phase. | ||
Copyright (c) Microsoft Corporation. | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#ifndef MOCK_PEI_READ_ONLY_VARIABLE2_PPI_H | ||
#define MOCK_PEI_READ_ONLY_VARIABLE2_PPI_H | ||
|
||
#include <Library/GoogleTestLib.h> | ||
#include <Library/FunctionMockLib.h> | ||
extern "C" { | ||
#include <Uefi.h> | ||
#include <Pi/PiPeiCis.h> | ||
#include <Ppi/ReadOnlyVariable2.h> | ||
} | ||
|
||
struct MockReadOnlyVariable2 { | ||
MOCK_INTERFACE_DECLARATION (MockReadOnlyVariable2); | ||
|
||
MOCK_FUNCTION_DECLARATION ( | ||
EFI_STATUS, | ||
GetVariable, | ||
(IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This, | ||
IN CONST CHAR16 *VariableName, | ||
IN CONST EFI_GUID *VariableGuid, | ||
OUT UINT32 *Attributes, | ||
IN OUT UINTN *DataSize, | ||
OUT VOID *Data OPTIONAL) | ||
); | ||
|
||
MOCK_FUNCTION_DECLARATION ( | ||
EFI_STATUS, | ||
NextVariableName, | ||
(IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This, | ||
IN OUT UINTN *VariableNameSize, | ||
IN OUT CHAR16 *VariableName, | ||
IN OUT EFI_GUID *VariableGuid) | ||
); | ||
}; | ||
|
||
extern "C" { | ||
extern EFI_PEI_READ_ONLY_VARIABLE2_PPI *PpiReadOnlyVariableServices; | ||
} | ||
|
||
#endif |
23 changes: 23 additions & 0 deletions
23
MdePkg/Test/Mock/Library/GoogleTest/Ppi/MockReadOnlyVariable2.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,23 @@ | ||
/** @file MockReadOnlyVariable2.cpp | ||
Google Test mock for ReadOnlyVariable2 | ||
Copyright (c) Microsoft Corporation. | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#include <GoogleTest/Ppi/MockReadOnlyVariable2.h> | ||
|
||
MOCK_INTERFACE_DEFINITION (MockReadOnlyVariable2); | ||
MOCK_FUNCTION_DEFINITION (MockReadOnlyVariable2, GetVariable, 6, EFIAPI); | ||
MOCK_FUNCTION_DEFINITION (MockReadOnlyVariable2, NextVariableName, 4, EFIAPI); | ||
|
||
// Normally PpiVariableServices is "found" | ||
// This will be defined INSIDE the test, with its definition pointing to the mock function GetVariable | ||
EFI_PEI_READ_ONLY_VARIABLE2_PPI PeiReadOnlyVariablePpi = { | ||
GetVariable, // EFI_PEI_GET_VARIABLE2 | ||
NextVariableName // EFI_PEI_GET_NEXT_VARIABLE_NAME2 | ||
}; | ||
|
||
extern "C" { | ||
EFI_PEI_READ_ONLY_VARIABLE2_PPI *PpiReadOnlyVariableServices = &PeiReadOnlyVariablePpi; | ||
} |