[llvm-dev] Filter and merge coverage reports

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[llvm-dev] Filter and merge coverage reports

Tingyuan LIANG via llvm-dev
I’m trying to replicate a workflow I use from gcov with llvm. My workflow is this:
1) Build my code with coverage instrumentation
2) Run a test
3) Get a binary coverage artifact for the test
4) Filter the binary artifact to a certain set of files (the “files under test”
5) Go to 2 for other tests in the test suite. Steps 2-4 might also be run multiple times in parallel. 
6) Now that all tests are run and filtered, merge all the binary coverage objects.
7) Make an html report from the merged object

Note that a merge of filtered coverage artifacts is not the same as a filter of merged coverage artifacts. For example, I run two tests: one is a unit test of a math library, and the other is a unit test of some application that uses the math library. What I want to do is filter the math unit test coverage output to show only the math library files, and filter the application test coverage output to show only the application’s files. Then I want to join them all into one report. The filtering must happen before the merge. 

With llvm-cov, I can create filtered reports from binary artifacts (*.profdata files), and with llvm-profdata I can merge binary artifacts. However, I’m not aware of a method of merging some intermediate coverage data that has been filtered. 

I thought that perhaps the json output from “llvm-cov export” would help here; I could use “llvm-cov export -instr-profile=coverage1.profdata MathTest math.c” to create a json of the filtered math test. However, this doesn’t seem like a solution for at least two reasons:
1) I am not aware of an existing tool for merging the json output from multiple invocations of “llvm-cov export”
2) I am not aware of a tool that produces html reports from the json format, even if I could merge them. 


Is my workflow possible? It’s easy with gcov, but I don’t know if it supported by llvm coverage. 

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev