Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for running non-test binaries #507

Closed
xd009642 opened this issue Jul 22, 2020 · 7 comments
Closed

Allow for running non-test binaries #507

xd009642 opened this issue Jul 22, 2020 · 7 comments

Comments

@xd009642
Copy link
Owner

xd009642 commented Jul 22, 2020

If a user is using a non-cargo build system for rust but has a built and instrumented binary they should be able to collect coverage for it. This issue is for tracking that feature. I've identified two approaches that could work:

  1. Run coverage on an arbitrary binary from a path

Edit: removed some unnecessary noise

@xd009642 xd009642 changed the title Allow for running binaries not built with cargo Allow for running non-test binaries Aug 11, 2020
@xd009642
Copy link
Owner Author

@DenialAdams, in develop I've added a --print-rust-flags and --print-rustdoc-flags the latter isn't relevant to this, however the former should make it possible to build you binaries with eval "export "$(cargo run -- tarpaulin --print-rust-flags)"" to set the rustflags. Then just need to sort the running the test side of things for an initial proof of concept.

I'd have liked to get the --print-rust-flags command to just print a single line however different configs can result in different rust flags so tail is just there to print out the last one printed.

Once it works like that I'll then look at refining the usage but it should be workable via a potentially ugly config file listing a call to your binary as a config.

@xd009642
Copy link
Owner Author

Created a draft PR with my first work on this. #604 It should work fine for basic usage

@Ch00k
Copy link
Contributor

Ch00k commented Nov 3, 2020

Does the change, implemented in #604, address the scenario described here? That scenario is exactly my situation: I have a bunch of integration tests, that call the executable with process::Command. I am running tarpaulin 0.16.0, but it reports 0% coverage.

@xd009642
Copy link
Owner Author

xd009642 commented Nov 3, 2020

Ah no that's covered by #107 an older issue. Though it is something I will start working on this month it's just moderately fiddly (need to capture the process spawn, read /proc/pid, add some extra tracing logic)

@xd009642
Copy link
Owner Author

xd009642 commented Nov 3, 2020

Also, I aim to do #612 next as the relocation mode could complicate those test setups anyway and lead to failures to get any coverage data and spurious failures even if I did get it working

@xd009642
Copy link
Owner Author

xd009642 commented Nov 7, 2020

@Ch00k I've got a prototype of following process exec's on #615 if you want to try it out. So far I've just tried it on a very simple toy project so more people testing it is appreciated 😄

@xd009642
Copy link
Owner Author

xd009642 commented Mar 1, 2021

pretty sure this is now solved so just going to close it

@xd009642 xd009642 closed this as completed Mar 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants