I am working on a large software project with many thousands of tests. A common workflow using gcov as a coverage tool is:
- Build code with coverage instrumentation
- Run all the tests. Gcov aggregates the line coverage counters together into its .gcda files
- Generate a report for some set of files using those combined gcda files.
- Analyze the report to find files/sections of code that are not covered by any test.
Using llvm’s source-based code coverage, I don’t believe I can accomplish steps 3-4. Each binary produces a .profraw file which contains profile counts, but the mapping of those profile counts to files is contained inside the binary. I can use llvm-profdata merge to merge multiple .profraw files together, but the report can still only be generated for a single binary, and so only the files contained in that binary’s __llvm_covmap section will be produced as part of the report.
Am I correct in this thinking? Is there a way to get a single coverage report for a set of multiple binaries? I discovered the undocumented ‘llvm-cov convert-for-testing’ command which generates ‘covmapping files’, which appear to be the contents of __llvm_covmap with an additional header. Maybe it’s possible to merge multiple of these covmapping files and generate a report from that data (plus the merged profraw files)? Or perhaps I could use ‘llvm-cov export’ on each binary individually and manually merge the results somehow (although in that case, I would not be able to ‘import’ the merge to create the usual report) ? Are there other suggestions, or is this a planned feature in 4.0? I found some discussion on this thread, but I am not sure if this is asking the same thing: