Skip to content

Commit

Permalink
UnitTestFrameworkPkg: Fix markdownlint issues
Browse files Browse the repository at this point in the history
Fixes markdownlint issues introduced from edk2 cherry-picks.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
  • Loading branch information
makubacki authored and kenlautner committed May 9, 2023
1 parent 338e5ce commit 8e79367
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@

# Ignore external dependencies
*_extdep/
UnitTestFrameworkPkg/Library/SubhookLib/
23 changes: 13 additions & 10 deletions UnitTestFrameworkPkg/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ section so that the unit tests will be built.

See this example in `UnitTestFrameworkPkg.dsc`...

```
```inf
[Components]
UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTest/SampleUnitTestUefiShell.inf
```
Expand All @@ -160,7 +160,7 @@ Also, based on the type of tests that are being created, the associated DSC incl
UnitTestFrameworkPkg for Host or Target based tests should also be included at the top of the DSC
file.

```
```inf
!include UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
```

Expand All @@ -170,7 +170,7 @@ they should be added in the \<LibraryClasses\> sub-section for the INF file in t

See this example in `SecurityPkgHostTest.dsc`...

```
```inf
[Components]
SecurityPkg/Library/SecureBootVariableLib/UnitTest/SecureBootVariableLibUnitTest.inf {
<LibraryClasses>
Expand Down Expand Up @@ -325,8 +325,7 @@ To write more advanced tests, first look at all the Assertion and Logging macros
Beyond that, if you're writing host-based tests and want to take a dependency on the UnitTestFrameworkPkg, you can
leverage the `cmocka.h` interface and write tests with all the features of the Cmocka framework.
Documentation for Cmocka can be found here:
https://api.cmocka.org/
Documentation for Cmocka can be found [here](https://api.cmocka.org/).
## GoogleTest Samples
Expand Down Expand Up @@ -389,7 +388,7 @@ section so that the unit tests will be built.

See this example in `UnitTestFrameworkPkgHostTest.dsc`...

```
```inf
#include <gtest/gtest.h>
extern "C" {
#include <Uefi.h>
Expand Down Expand Up @@ -445,6 +444,7 @@ int main(int argc, char* argv[]) {
return RUN_ALL_TESTS();
}
```
However, while GoogleTest does not require test suites or test cases to be
registered, there is still one rule within EDK II that currently needs to be
followed. This rule is that all tests for a given GoogleTest application must
Expand Down Expand Up @@ -499,6 +499,7 @@ while the `EXPECT` version continues running the `TEST`.

There is no return status from a GooglTest unit test. If no assertions (or expectations) are
triggered then the unit test has a passing status.

### GoogleTest - A gMock Test Case

Below is a sample test case from `SecureBootVariableLibGoogleTest`. Although
Expand Down Expand Up @@ -858,16 +859,18 @@ Host based Unit Tests will automatically enable coverage data.
For Windows, this is primarily leverage for pipeline builds, but this can be leveraged locally using the
OpenCppCoverage windows tool to parse coverage data to cobertura xml format.

- Windows Prerequisite
```bash
* Windows Prerequisite

```text
Download and install https://github.com/OpenCppCoverage/OpenCppCoverage/releases
python -m pip install --upgrade -r ./pip-requirements.txt
stuart_ci_build -c .pytool/CISettings.py -t NOOPT TOOL_CHAIN_TAG=VS2019 -p MdeModulePkg
Open Build/coverage.xml
```

- How to see code coverage data on IDE Visual Studio
```
* How to see code coverage data on IDE Visual Studio

```text
Open Visual Studio VS2019 or above version
Click "Tools" -> "OpenCppCoverage Settings"
Fill your execute file into "Program to run:"
Expand Down

0 comments on commit 8e79367

Please sign in to comment.