Closed cschwan closed 2 years ago
So to get coverage binaries actually have to be built with a specific set of linker flags. Also because -Clink-dead-code
has frequently caused incremental compilation errors with rustc (and last I checked still does on certain platforms). Tarpaulin does clean by default. You also need --follow-exec
to follow application spawns.
So what you want is probably something like cargo tarpaulin --run-types Bins Tests Lib --follow-exec
. If that doesn't work maybe cargo tarpaulin --command Build --no-run && cargo tarpaulin --follow-exec --skip-clean
@xd009642 thanks a lot! Your second options works for me. You can close this Issue as far as it concerns me.
Cool, also I came across this in a discussion the other day and found just a simple cargo tarpaulin --follow-exec
worked for a project using assert_cmd that I made. So may be worth trying that as well! (Link to discussion: https://github.com/xd009642/tarpaulin/discussions/908)
@xd009642 Only adding --follow-exec
didn't work in my case, although the binary was built (somewhere) ... but it works for me
is this the same issue impacting cargo-msrv
?
As far as I can tell no, it seems that your test simply runs longer than the timeout that you specified (line 510), I'd simply increase it.
Describe the bug Tarpaulin doesn't work together with [
assert_cmd
](), because tarpaulin doesn't build binaries (or deletes them). After working around the problem no line coverage is generated.To Reproduce
The error:
The problem is surely triggered because tarpaulin cleans the project. Using
--skip-clean
I can avoid this, but in that case I don't get line coverage. Is this expected? How do I get coverage for the main function?