Skip to content

Generating a code coverage report

lenaploetzke edited this page Sep 29, 2025 · 10 revisions

The current report for the main branch can be found here.

One can generate a code coverage report locally to determine if the current changes reduce the code coverage. You can follow these steps:

  1. Make sure that lcov is installed.
  2. Configure in Debug mode and with the test coverage option enabled. If you want to compare the result to the coverage report on github, you should set the test level to 1. You can execute the following command in the build folder:
cmake -DCMAKE_BUILD_TYPE=Debug -DT8CODE_CODE_COVERAGE=ON -DT8CODE_TEST_LEVEL=T8_TEST_LEVEL_BASIC ..
  1. Perform the build step as usual, e.g., with
cmake --build .
  1. To generate the coverage report, use
cmake --build . --target coverage

This step can take a few minutes, depending on the test level.

Attention: If you face some mismatch errors, add the flag --ignore-errors mismatch to the LCOV_ARGS list at the bottom of the file CodeCoverage.cmake. This error is dependent on the gcov version you used.

  1. Find the html coverage report index.html in the folder coverage in the build directory.
Clone this wiki locally