mozilla / grcov

Rust tool to collect and aggregate code coverage data for multiple source files
Mozilla Public License 2.0
1.19k stars 149 forks source link

Follow symlinks in binary_path #1026

Closed jbreams closed 1 year ago

jbreams commented 1 year ago

I'm using grcov to generate coverage info for a medium-sized CMake C++ project - I found that if I pointed the binary path to the root of my build artifacts tree, grcov could run for 45 minutes without producing any results. I see others have run into similar issues and there are open issues to improve the performance of scanning the binary path or to allow you to list multiple binary paths. The solution I came up with in the short term was to make it so grcov could follow symlinks in the binary path, and then in my CI environment where I generate coverage info, I drop a symlink to each binary that's generating coverage info into a coverage_binaries directory and pass that in as the binary path to grcov. That way it only has to scan the specific binaries there's definitely coverage info for, and not the entire build tree. I also updated the message passed to panic! when scanning a directory fails so you get actual diagnostics about what went wrong.

marco-c commented 1 year ago

A simpler alternative could be to make it possible to pass multiple binary paths as arguments, so instead of a directory you'd pass the specific binaries. I think the PR is useful anyway.