xd009642 / tarpaulin

A code coverage tool for Rust projects
https://crates.io/crates/cargo-tarpaulin
Apache License 2.0
2.5k stars 180 forks source link

Using tokio's Command causes the test case to be stuck when using tarpaulin #1056

Open rongduan-zhu opened 2 years ago

rongduan-zhu commented 2 years ago

Describe the bug Test case using tokio's Command to spawn a child process is stuck waiting for the future to complete. This did not happen in tarpaulin 0.16.0 and repros in newer version after it. Adding --follow-exec fixes the issue, however, it causes a segfault in tarpaulin in our production tests and unfortunately I have not been able to come up with repro for it. However, I've captured the debug output which might help shed some light on why the segfault happened.

0.16.0 has a different issue where tarpaulin would intermittently fail due to cargo_tarpaulin: Failed to get test coverage! Error: Failed to run tests: Attempting to handle tarpaulin being signaled which prompted us to upgrade to a newer version of tarpaulin but it seems starting from 0.17.0 is when the capability of tracing into binaries were added and we started seeing the issue above.

To Reproduce I've created a repro at https://github.com/rongduan-zhu/tarpaulin-stuck-repro. You can just run cargo tarpaulin and the test will timeout after 60 seconds.

Running cargo test finishes instantly without any issues.

Expected behavior Running cargo tarpaulin should be able to execute the test and yield the same result as cargo test

xd009642 commented 1 year ago

You can now try --engine llvm and that may solve your issues - otherwise potentially it was unwittingly fixed and I didn't realise last year. Sorry for replying so late :disappointed: