#coverage #gcov #lcov

cov

gcov format (.gcda/.gcno) parser and analyzer in pure Rust

4 releases

Uses old Rust 2015

0.0.5 Aug 29, 2018
0.0.4 Jun 18, 2018
0.0.2 Nov 15, 2017
0.0.1 Jun 13, 2017
0.0.0 Jun 8, 2017

#391 in Parser implementations

Download history 15/week @ 2021-10-05 12/week @ 2021-10-12 28/week @ 2021-10-19 13/week @ 2021-10-26 25/week @ 2021-11-02 9/week @ 2021-11-09 40/week @ 2021-11-16 17/week @ 2021-11-23 25/week @ 2021-11-30 16/week @ 2021-12-07 11/week @ 2021-12-14 9/week @ 2021-12-21 14/week @ 2021-12-28 10/week @ 2022-01-04 27/week @ 2022-01-11 8/week @ 2022-01-18

61 downloads per month
Used in cargo-cov

MIT license

125KB
2.5K SLoC

cargo-cov: Source coverage for Rust

cargo-cov is a cargo subcommand which performs source coverage collection and reporting for Rust crates. cargo-cov utilizes LLVM's gcov-compatible profile generation pass, and supports a lot of platforms.

  • ✓ FreeBSD, Linux, macOS, Windows (MSVC only)
  • ✓ x86_64, x86

Usage: for Local Testing on nightly Rust

You may install cargo-cov via cargo.

cargo install cargo-cov

The typical workflow is like this:

# clean up previous coverage result
cargo cov clean

# test the code
cargo cov test

# open the coverage report
cargo cov report --open

Usage: for Testing on stable Rust (1.19+)

We strongly recommend you use nightly Rust since only the nightly toolchain has built-in instrumented profiling support via -Zprofile.

If you must use a stable toolchain, you may try the following:

  1. Install the compiler-rt profile library.

    Target Instruction
    Ubuntu, Debian Install libclang-common-7-dev, or simply install clang
    Fedora Install compiler-rt
    OpenSUSE Install llvm-clang
    Windows (MSVC) Install Clang for Windows Pre-Built Binary from LLVM
    macOS, iOS Provided by the Xcode command line tools
    Android Provided by Android NDK
  2. Execute the doc-test separately from the normal tests. Run the doc-test before the normal tests.

    # Run --doc tests before other things before 1.19
    cargo cov test --doc
    cargo cov test --lib
    

We do not guarantee that a correct coverage profile will be generated using this method.

Dependencies

~1.6–2.4MB
~53K SLoC