Support generating unique profraw files by default when using -C instrument-coverage
#100381
Labels
A-code-coverage
Area: Source-based code coverage (-Cinstrument-coverage)
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
Currently, when enabling the instrumentation of Rust crates using the
-C instrument-coverage
rustc flag, rustc does not set any default naming scheme for the generated*.profraw
files. Today, a user has two options:default.profraw
. Thie issue here is if there is more than one binary being executed that is linked to the instrumented library, LLVM would overwrite the coverage results from the previous executed binary.LLVM_PROFILE_FILE
environment variable and apply LLVMs special pattern strings to ensure unique files are generated.LLVM also has API support for passing in the designated filename for instrumented profile files via rustc. This is leveraged today when enabling profile guided optimization or PGO. The Rust compiler directly sets a default naming scheme for the generated profraw file,
default_%m.profraw
.Profile files generated by rustc's
-C instrument-coverage
should have the same or similar defaults to ensure coverage results are not overwritten by each test binary executed. A similar but more unique version of the default for PGO instrumented profile files should be used since multiple binaries are executed using the same instrumented library such asdefault_%m_%p.profraw
.The text was updated successfully, but these errors were encountered: