Request for local llvm source code coverage for developers

Hi,

This request is related to a previous thread titled ‘A new code coverage bot’ (http://lists.llvm.org/pipermail/llvm-dev/2016-September/105094.html).

“The purpose of the bot is to make high-quality coverage reports available to

llvm developers, and to provide additional testing for clang’s code coverage

implementation”

I am wondering if there is a framework in place to get the code coverage information locally.

I have to get code coverage information of a llvm development branch which resides on my local machine. I also need to get the coverage numbers by running my own set of test suites.

Thanks and Best Regards

Arvind

Hi Arvind,

You can use “llvm/utils/prepare-code-coverage-artifact.py” to generate coverage reports. Here’s how:

  1. Build llvm with coverage reporting enabled.
    See: https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#collecting-coverage-reports-for-the-llvm-project
  2. Collect profiles by running tests.
  3. Use prepare-code-coverage-artifact.py in “–only-merge” mode to merge your profiles together.
  4. Use prepare-code-coverage-artifact.py again to emit an html report, passing in “–use-existing-profdata path/to/merged/profile”.
    If you need coverage reporting for multiple binaries, pass in the paths to the binaries you’re interested in, along with the “–unified-report” option.
    If you only want coverage for a particular set of files or directories, you can specify this with the “–restrict” option.

best,
vedant