Repository: taiki-e/cargo-llvm-cov

Issue #415: [Feature request] Allow external profraws to be imported when using the `report` command
Created: 2025-01-24T18:49:34Z
This can may be useful when using llvm-cov aside fuzz cargo command, especially when using the fuzz coverage command.
Why ?
I'm learning to do fuzzing on a library I'm creating, and while fuzz is a great tool to actually do fuzzing, it's not as good to show the results of the coverages in a meaningfull way. On the other hand, your tool allows to show the results of the coverage in an understandable way, but seems to only support well cargo run, cargo test, and cargo nextest.
So why not create a bridge between the two ?
How ?
The possibility i had in mind would be to have an argument --import / --external which could be used multiple times per command. Each time that argument is provided, the path of the profraw file should be put after.
I'm not sure if copying the profraw files to the the llvm-cov-target directory each time we use the report command is a good idea from a UX perspective, which is why i would suggest a flag argument --copy-all-external to be added as well.
PS
It seems that your tool allows to use external results (from what i can see here), but i didn't understood how to import my profdata / profraw into llvm-cov from there. Maybe this part is not even concerned with my feature request, idk.
What do you guys think about it ?

Duplicate issue #430: Document how to combine with `cargo fuzz`
Created: 2025-04-03T14:15:32Z
I feel like this should be possible, but I can't get it to work.
There are a bunch of moving parts here, that I don't fully understand. Various pages on the web contain outdated information. I'm just trying to get the cargo-llvm-cov experience for my fuzz tests.
The cargo fuzz coverage command generates coverage files, e.g.
Generating coverage data for corpus "/home/folkertdev/rust/zlib-rs/fuzz/corpus/uncompress"
INFO: Running with entropic power schedule (0xFF, 100).
INFO: Seed: 2395233786
INFO: Loaded 1 modules   (26954 inline 8-bit counters): 26954 [0x60fbee92a940, 0x60fbee93128a), 
INFO: Loaded 1 PC tables (26954 PCs): 26954 [0x60fbee931290,0x60fbee99a730), 
MERGE-OUTER: 4072 files, 0 in the initial corpus, 0 processed earlier
MERGE-OUTER: attempt 1
INFO: Running with entropic power schedule (0xFF, 100).
INFO: Seed: 2429353336
INFO: Loaded 1 modules   (26954 inline 8-bit counters): 26954 [0x5c5fda2fa940, 0x5c5fda30128a), 
INFO: Loaded 1 PC tables (26954 PCs): 26954 [0x5c5fda301290,0x5c5fda36a730), 
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 1048576 bytes
MERGE-INNER: using the control file '/tmp/libFuzzerTemp.Merge109102.txt'
MERGE-INNER: 4072 total files; 0 processed earlier; will process 4072 files now
#1	pulse  cov: 243 ft: 244 exec/s: 0 rss: 36Mb
#2	pulse  cov: 249 ft: 256 exec/s: 0 rss: 36Mb
#4	pulse  cov: 251 ft: 265 exec/s: 0 rss: 37Mb
#8	pulse  cov: 268 ft: 300 exec/s: 0 rss: 39Mb
#16	pulse  cov: 275 ft: 319 exec/s: 0 rss: 42Mb
#32	pulse  cov: 318 ft: 399 exec/s: 0 rss: 49Mb
#64	pulse  cov: 480 ft: 633 exec/s: 0 rss: 63Mb
#128	pulse  cov: 504 ft: 761 exec/s: 0 rss: 91Mb
#256	pulse  cov: 516 ft: 884 exec/s: 0 rss: 146Mb
#512	pulse  cov: 523 ft: 988 exec/s: 0 rss: 256Mb
#1024	pulse  cov: 537 ft: 1130 exec/s: 0 rss: 276Mb
#2048	pulse  cov: 541 ft: 1233 exec/s: 0 rss: 277Mb
#4072	DONE   cov: 550 ft: 1371 exec/s: 4072 rss: 282Mb
MERGE-OUTER: successful in 1 attempt(s)
MERGE-OUTER: the control file has 529523 bytes
MERGE-OUTER: consumed 0Mb (41Mb rss) to parse the control file
MERGE-OUTER: 257 new files with 1371 new features added; 550 new coverage edges
Merging raw coverage data...
Coverage data merged and saved in "/home/folkertdev/rust/zlib-rs/fuzz/coverage/uncompress/coverage.profdata".

How can I now use this with cargo llvm-fuzz, so that I get the nice html summary table of just the functions in my projects?
I have this more low-level command now, which works but the output is just a long list of files with coverage information which is not really readable.
~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-cov show -Xdemangler=rustfilt \
    target/x86_64-unknown-linux-gnu/coverage/x86_64-unknown-linux-gnu/release/uncompress \
    -instr-profile=/home/folkertdev/rust/zlib-rs/fuzz/coverage/uncompress/coverage.profdata \
    --format=html \
    -ignore-filename-regex "\.rustup|\.cargo" > index.html

The summary-only option does not work.
So, is there something that I can get cargo llvm-cov to do here to improve my experience?

Closing comment (2025-04-03T20:49:00Z): Duplicate of #415.