Closed romangg closed 8 months ago
With !89 I decided to go for a more low-tech approach with the GCC compilation flags directly and using GitLab's provided functionality of CI pipelines and GitLab pages instead of any external services as this reduces complexity and should be good enough for our purposes. See the MR for more information.
In the future one could still think about also pushing the coverage information to an external service like Codecov if this promises strong advantages over the report we'll have via GitLab pages.
mentioned in commit 9d17ccb2ddc034cb228c4a729ce70d21dc3e47bd
What is code coverage
A code coverage report describes how much percentage of a given code base is tested through autotests. Such reports can be generated by GCC and Clang.
For increased stability add a code coverage job to Wrapland CI (and later to the other KWinFT projects).
Setup
GCC directly
Set
-fprofile-arcs
and-ftest-coverage
compilation flags. Report is generated with gcov afterwards and and viewed with lcov. See following tutorial for that.In CMake
Directly: The CMake Wiki describes here with example code how to enable coverage for GCC.
ECM: Provides the module ECMCoverageOption to enable GCC coverage in a CMake project. Looking at the code it just sets the GCC flags and (according to Stack Overflow unnecessarily) links against gcov.
bilke/cmake-modules: CMake module with tutorial on Stack Overflow.
StableCoder/cmake-scripts: Provides a CMake script for enabling code coverage reports with GCC and Clang. Also writes good documentation.
CMake-codecov: CMake module with good documentation.
Services