taiki-e / cargo-llvm-cov

Cargo subcommand to easily use LLVM source-based code coverage (-C instrument-coverage).
Apache License 2.0
933 stars 57 forks source link

Add `--workspace` flag to `clean` subcommand #81

Closed taiki-e closed 3 years ago

taiki-e commented 3 years ago

It would be useful to have a flag to remove only artifacts that may affect the coverage results, using the same way as https://github.com/taiki-e/cargo-llvm-cov/pull/79.

cargo llvm-cov clean --workspace # remove artifacts that may affect the coverage results
cargo llvm-cov --no-report --features a
cargo llvm-cov --no-report --features b
cargo llvm-cov --no-run --lcov
taiki-e commented 3 years ago

FYI @davidhewitt: I think it will be possible to cache the target directory again in pyo3's coverage CI once this is implemented.

davidhewitt commented 3 years ago

👍 sounds great! I'll update pyo3's CI once implemented.

How do you expect this to interact with coverage for proc macros? In some ways it's useful to rebuild the entire pyo3 test suite so that proc macro invocations are covered. Though it would be nice to not need to rebuild all dependencies!

taiki-e commented 3 years ago

How do you expect this to interact with coverage for proc macros? In some ways it's useful to rebuild the entire pyo3 test suite so that proc macro invocations are covered. Though it would be nice to not need to rebuild all dependencies!

The way introduced in #79 will remove trybuild's build artifacts in the same way it did for normal build artifacts. So I think proc-macro coverage will also work well without any additional action.

https://github.com/taiki-e/cargo-llvm-cov/blob/eb7c3f350bb787d6a91fcbb1ee28af4f55c678ce/src/main.rs#L135-L149

(By the way, in 0.1.0, trybuild's build artifacts were in target/tests/target, but in 0.1.1+, they are now generated in target/llvm-cov-target/tests/target. (https://github.com/taiki-e/cargo-llvm-cov/commit/bd93d1928eec5c6acb62617c02951dc4f9674508))

davidhewitt commented 3 years ago

Brilliant!

taiki-e commented 3 years ago

The way introduced in #79 will remove trybuild's build artifacts in the same way it did for normal build artifacts.

I found that the way introduced in #79 did not remove the trybuild artifacts correctly. #85 also includes a fix for that problem.

taiki-e commented 3 years ago

Added in 0.1.5.