cargo-llvm-codecov-converter

Convert from llvm-cov format to codecov format

installation: cargo install cargo-llvm-codecov-converter

converts llvm-cov json formatted output from the llvm-cov export tool into the codecov custom coverage format via Stdin and Stdout

for example to calculate coverage for rust code:

```bash export LLVMPROFILEFILE="target/debug/coverage/-%m.profraw"

build the test binary with coverage instrumentation

executables=$(RUSTFLAGS="-Zinstrument-coverage" cargo test --tests --no-run --message-format=json | jq -r "select(.profile.test == true) | .executable")

run instrumented tests

$executables

combine profraw files

cargo profdata -- merge -sparse target/debug/coverage/-*.profraw -o target/debug/coverage/.profdata

collect coverage

cargo cov -- export $executables \ --instr-profile=target/debug/coverage/.profdata \ --ignore-filename-regex="(..cargo/registry/.)|(..rustup/.)|(.test.)" \ --skip-functions \ | cargo llvm-codecov-converter > target/debug/coverage/.json ```

note the pipe into cargo llvm-codecov-converter