You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spawning a process for an interactive main programm during integration testing and then communicating with it (e.g. via stdin/stdout) leads to falsely uncovered lines.
Same happens when similarly testing routes of a web server program (my original problem). However, there I even experience tarpaulin crashing ("Failed to get test coverage! Error: ESRCH: No such process"). Although I can imagine this having a similar cause, I should maybe open a separate issue?
Ok, turns out that the child.kill() caused all those problems. Similar to #252 (comment), I added an exit route to my project (hidden behind a feature flag) which I now use instead.
Similarly, in the simplified example above, one could exit whenever some specific string is read on stdin.
I don't like this hack very much, but for now it works.
Ah glad you found it, I figured seeing the initial email in my inbox it would be the kill. I have some idea on how to solve this, generally by catching the kill signal from the test forwarding and marking that the binary is expected to exit not-of-its-own-volition. I'll update you when I've had a chance to work on this and if I make any progress
Describe the bug
Spawning a process for an interactive main programm during integration testing and then communicating with it (e.g. via stdin/stdout) leads to falsely uncovered lines.
Same happens when similarly testing routes of a web server program (my original problem). However, there I even experience tarpaulin crashing ("Failed to get test coverage! Error: ESRCH: No such process"). Although I can imagine this having a similar cause, I should maybe open a separate issue?
To Reproduce
src/main.rs
tests/tests.rs
Running
cargo tarpaulin --follow-exec
Output:
Distro: Ubuntu 20.04
Rustc version: 1.57.0-nightly (b69fe5726 2021-09-10)
Expected behavior
100% coverage
The text was updated successfully, but these errors were encountered: