Skip to content

Enable code coverage metric capturing

Dave Moxey requested to merge dmoxey/nektar:feature/coverage into master

Issue/feature addressed

This MR enables code coverage metric capturing, at least for C++ code, within Nektar++. It gives:

  • a general code coverage percentage, which is picked up by GitLab and is viewable in merge requests;
  • code coverage reports in GitLab's diff directly, as shown in the image below, where the green and orange bars indicate regions of the code that are tested and not tested, respectively.


Proposed solution

To enable code coverage, as well as code coverage reports, we use:

  • appropriate code coverage flags during compilation
  • fastcov to much more quickly generate coverage statistics than vanilla lcov (which can take 20-30 minutes to run otherwise)
  • lcov to print out general statistics (line coverage %) that are captured by gitlab
  • a third-party script called converts the .info file produced by fastcov into a Cobertura XML, the format used by Gitlab for code coverage reports;
  • a second script called splits this into multiple XML files in order to overcome processing limitations of gitlab on XML output larger than 10MB;
  • this is all built into a code coverage job run through the CI.


Suggested reviewers



Please add any other information that could be useful for reviewers.


  • [ ] Functions and classes, or changes to them, are documented.
  • [ ] User guide/documentation is updated.
  • Changelog is updated.
  • Suitable tests added for new functionality.
  • Contributed code is correctly formatted. (See the contributing guidelines).
  • License added to any new files.
  • No extraneous files have been added (e.g. compiler output or test data files).
Edited by Dave Moxey

Merge request reports