Can lcov / genhtml show files that have never been executed?

How can I make lcov

and genhtml

show files that are not linked / uploaded? I am using it to show test coverage, and I would like every source file to appear in the HTML report even if it has zero coverage. This way I can use lcov to identify source files that are missing tests. The missing source files have a .gcno file for them, but not a .gcda file.

+3


source to share


1 answer


If you want to see all files, you need to create a baseline coverage data file with the -i option. After capturing the data, you must concatenate the two files with the -a option.

There is an example on the lcov man page ( https://linux.die.net/man/1/lcov ):



Capture the original null coverage data.

Run lcov with -c and this option on directories containing .bb, .bbg, or .gcno before running any test case. The result is a "baseline" coverage data file that contains zero coverage for each instrumental line. Combine this data file (using lcov -a) with the coverage data files captured after the test run to ensure that the percentage of the total lines covered is correct, even if not all source code files were loaded during the test.

Recommended procedure when writing data for a test case:

  • create baseline coverage data file

    lcov -c -i -d appdir -o app_base.info

  • run test

    Appdir / test

  • create test coverage data file

    lcov -c -d appdir -o app_test.info

  • combine baseline and test coverage data

    lcov -a app_base.info -a app_test.info -o app_total.info

Then you need to use app_total.info as source for genhtml.

+3


source







All Articles