I’m using LLVM’s source-based code coverage feature to prepare coverage reports for my code base.
However, the tests for the the (rather large, badly coupled…) code base are distributed across multiple binaries, which use somwhat of a homebrewn test framework. It is not easily possible to combine all tests in one binary.
I would like the coverage reports to reflect the coverage resulting from running all those test binaries. I know that I can merge the generated ‘instruction profiles’ from each run using llvm-profdata merge
, but llvm-cov show
still requires me to specify a single binary. Is there any way of generating coverage across multiple binaries?
1 Like
llvm-cov show
does actually allow you to specify multiple binaries, even if that doesn’t seem obvious at first. Basically the first name not part of a flag is taken as a binary, but you can add subsequent binaries by using -object <binary2> -object <binary3> ...
.
See the synopsis here llvm-cov - emit coverage information — LLVM 16.0.0git documentation
2 Likes
Oh thanks! Somehow I missed that.
Hi @zero9178 and @tinloaf
Thanks for the post. I am finally be able to use multiple binaries. But I have a question. Is the binary path in llvm-cov
commutative? I mean, do the following two different operations generate the exact same coverage report?
llvm-cov show binary_a -object binary_b ...
llvm-cov show binary_b -object binary_a ...