]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UnitTestFrameworkPkg/ReadMe.md
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / UnitTestFrameworkPkg / ReadMe.md
index 9ce04b7f3eb6f0b34065271bfc9a7057580a806d..3fa4e1910f71683954d314442bdf68cc71184d73 100644 (file)
@@ -583,6 +583,47 @@ GTEST_OUTPUT=xml:<absolute or relative path to output file>
 \r
 This mode is used by the test running plugin to aggregate the results for CI test status reporting in the web view.\r
 \r
+### Code Coverage\r
+\r
+Host based Unit Tests will automatically enable coverage data.\r
+\r
+For Windows, This is primarily leverage for pipeline builds, but this can be leveraged locally using the\r
+OpenCppCoverage windows tool to parse coverage data to cobertura xml format.\r
+\r
+- Windows Prerequisite\r
+  ```bash\r
+  Download and install https://github.com/OpenCppCoverage/OpenCppCoverage/releases\r
+  python -m pip install --upgrade -r ./pip-requirements.txt\r
+  stuart_ci_build -c .pytool/CISettings.py  -t NOOPT TOOL_CHAIN_TAG=VS2019 -p MdeModulePkg\r
+  Open Build/coverage.xml\r
+  ```\r
+\r
+  - How to see code coverage data on IDE Visual Studio\r
+    ```\r
+    Open Visual Studio VS2019 or above version\r
+    Click "Tools" -> "OpenCppCoverage Settings"\r
+    Fill your execute file into "Program to run:"\r
+    Click "Tools" -> "Run OpenCppCoverage"\r
+    ```\r
+\r
+\r
+For Linux, This is primarily leveraged for pipeline builds, but this can be leveraged locally using the\r
+lcov linux tool, and parsed using the lcov_cobertura python tool to parse it to cobertura xml format.\r
+\r
+- Linux Prerequisite\r
+  ```bash\r
+  sudo apt-get install -y lcov\r
+  python -m pip install --upgrade -r ./pip-requirements.txt\r
+  stuart_ci_build -c .pytool/CISettings.py  -t NOOPT TOOL_CHAIN_TAG=GCC5 -p MdeModulePkg\r
+  Open Build/coverage.xml\r
+  ```\r
+  - How to see code coverage data on IDE Visual Studio Code\r
+    ```\r
+    Download plugin "Coverage Gutters"\r
+    Press Hot Key "Ctrl + Shift + P" and click option "Coverage Gutters: Display Coverage"\r
+    ```\r
+\r
+\r
 ### Important Note\r
 \r
 This works on both Windows and Linux but is currently limited to x64 architectures. Working on getting others, but we\r