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

Recompiles workspace crates every time #198

Closed Eugeny closed 2 years ago

Eugeny commented 2 years ago

Currently, running cargo llvm-cov run recompiles the workspace crates every time, making merging multiple runs with --no-report and --no-run --html unfeasible.

taiki-e commented 2 years ago

Could you provide an example to reproduce this?

Also, old results will be removed unless you pass --no-report to cargo llvm-cov run.

cargo llvm-cov run --no-report -- a
cargo llvm-cov run --no-report -- b
cargo llvm-cov --no-run --html
Eugeny commented 2 years ago

I've got the repro ready and then tried putting --no-report after run, and it worked! Shame on me.

Might still be unexpected behaviour however, that:

taiki-e commented 2 years ago
  • --no-report before run is silently ignored and

This is https://github.com/taiki-e/cargo-llvm-cov/issues/151, and will be fixed by https://github.com/taiki-e/cargo-llvm-cov/pull/197

  • --no-report affects whether a rebuild happens

readme example describes cargo llvm-cov clean as a command to remove artifacts.

Eugeny commented 2 years ago

This is https://github.com/taiki-e/cargo-llvm-cov/issues/151, and will be fixed by https://github.com/taiki-e/cargo-llvm-cov/pull/197

:+1:

readme example describes cargo llvm-cov clean as a command to remove artifacts.

Sorry if I wasn't clear - I've already figured out how to do / not do a rebuild, but it's still unexpected for a new user that adding --no-report will also change the build behaviour (and not just whether a report is generated)

taiki-e commented 2 years ago

I've already figured out how to do / not do a rebuild, but it's still unexpected for a new user that adding --no-report will also change the build behaviour (and not just whether a report is generated)

Indeed. Adding a document to mention it seems like a good idea.

fenollp commented 2 years ago

I see that the workspace's bin crates are recompiled everytime as well. I can reproduce with the provided repro repo. My usage:

while :; do cargo llvm-cov --all-targets --all-features --locked --frozen; done

# Note: plain cargo test call does not recompile things:
while :; do cargo test --all-targets --all-features --locked --frozen; done

Please advise.

Eugeny commented 2 years ago

@fenollp adding --no-report should help. In my cases, I've ended up running it once and then running the compiled binary multiple times directly during my integration tests.

taiki-e commented 2 years ago

Added --no-clean flag as a workaround for this. See #214 for more.