cargo-llvm-codecov-converter

Crates.iocargo-llvm-codecov-converter
lib.rscargo-llvm-codecov-converter
version0.1.0
sourcesrc
created_at2021-01-01 19:55:17.7813
updated_at2021-01-01 19:55:17.7813
descriptionconversion utility from llvm-cov format to codecov format
homepage
repositoryhttps://github.com/maboesanman/cargo-llvm-codecov-converter
max_upload_size
id330243
size24,338
Mason (maboesanman)

documentation

README

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:

export LLVM_PROFILE_FILE="target/debug/coverage/<my-crate>-%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/<my-crate>-*.profraw -o target/debug/coverage/<my-crate>.profdata

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

note the pipe into cargo llvm-codecov-converter

Commit count: 12

cargo fmt