Why does kcov calculate incorrect code coverage statistics for Rust programs?

后端 未结 2 1931
名媛妹妹
名媛妹妹 2020-12-17 17:34

I\'ve tried to use kcov to get code coverage for a Rust library. I\'ve followed this tutorial to build and use kcov. The coverage seems to work, however I\'m facing a strang

2条回答
  •  死守一世寂寞
    2020-12-17 17:54

    There is a workaround: the RUSTFLAGS='-C link-dead-code' environment variable. Use it while building and the Rust compiler will link dead code as well:

    RUSTFLAGS='-C link-dead-code' cargo test
    

提交回复
热议问题