Crates.io | cargo-llvm-codecov-converter |
lib.rs | cargo-llvm-codecov-converter |
version | 0.1.0 |
source | src |
created_at | 2021-01-01 19:55:17.7813 |
updated_at | 2021-01-01 19:55:17.7813 |
description | conversion utility from llvm-cov format to codecov format |
homepage | |
repository | https://github.com/maboesanman/cargo-llvm-codecov-converter |
max_upload_size | |
id | 330243 |
size | 24,338 |
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