Support #1512

Measure test coverage

Added by Eric Bohm 2 months ago.

Target version:
Start date:
Due date:
% Done:



It would be helpful to know the coverage that our tests provide for the core functionality.

One commonly available toolset for this is the GCC coverage feature for recording of coverage, the gcov tool for profiling, and the lcov tool to generate more human readable summary data.

The process is then:

./build LIBS netlrts-linux-x86_64 smp -j8 --suffix coverage --coverage
cd netlrts-linux-x86_64-smp-coverage/test; make -j8 OPTS+="--coverage";
cd ../tmp; make test;

That will create many files of the form sourcename.gcda in the tmp dir.

Repeat the make test set for each machine target one wishes to see, combined into an aggregated result run the test and accumulate the results.
Such as for non-smp, smp, and whichever choices of --with-production or other build time selections make sense to composite.

Coverage will be accumulated into the cwd (machineblah/tmp) for each of those runs.

They can then be processed by visualization and reporting tools of various kinds. The simplest to use is probably lcov.

run lcov to process that data and accumulate it

cd yourAccumulationDirectory;
lcov --capture --directory machineblah/tmp --rc lcov_branch_coverage=1 --output-file
lcov --add-tracefile --output-file

For each of the targets you want aggregated.

When you have accumulated it all, process the aggregate

genhtml --rc lcov_branch_coverage=1 --output-directory youroutputdir

This will generate an html summary that will allow you to browse through the coverage along the directory heirarchy of your source on a file by file basis.

Also available in: Atom PDF