Giter VIP home page Giter VIP logo

cov's Introduction

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.

cov's People

Contributors

kennytm avatar asomers avatar eh2406 avatar garious avatar mmullis avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.