coverage/README.md
Code coverage can be enabled for TimescaleDB builds by setting the
option -DCODECOVEAGE=ON when running CMake (it is off by
default). This enables the necessary compiler option (--coverage) to
generate code coverage statistics and should be enough for CI build
reports using, e.g., codecov.io. In addition, local code coverage
reports can be generated with the lcov tool, when this tool is
installed on the build system.
A code coverage report is generated in three steps using lcov:
coverage_base target).coverage_test
target).coverage_final target).Each of these steps can be run manually using the mentioned targets, but should happen automatically as part of regular build and test steps. Optionally, this process can be extended with a filtering step to ignore certain paths that shouldn't be included in the final report.
Once the complete test suite has run (installcheck target), it is
possible to produce a HTML-based code coverage report that can be
viewed in a web browser. This is automated by the coverage target.
Thus, the complete steps to produce a code coverage report are:
cmake --buildcmake --build --target installcheckcmake --build --target coverage