Search code examples
ccode-coveragelcovtranspiler

Hiding C sources when using lcov with a language transpiled to C


I'm experimenting with a language (ooc) that transpiles into C and is then compiled using gcc. I want to check code coverage for a project written in this language and display it using lcov and genhtml. The C code has #line references throughout the file pointing to the corresponding file in the original source.

So far so good, I have it setup and working. But lcov seems to generate results for both the orignal source and the generated C code, which bloats the output.

How can I hide results for the C code?


Solution

  • Managed to solve this on my own.

    After the initial lcov call, but before genhtml, call for example:

    lcov --remove <info-file> '/usr/include/*' -o <info-file>

    Where <info-file> is the .info-file generated by lcov in the initial step.