Skip to content

WIP: Initial cargo-grcov command#533

Draft
gilescope wants to merge 9 commits into
mozilla:masterfrom
gilescope:cargo
Draft

WIP: Initial cargo-grcov command#533
gilescope wants to merge 9 commits into
mozilla:masterfrom
gilescope:cargo

Conversation

@gilescope

@gilescope gilescope commented Dec 2, 2020

Copy link
Copy Markdown
Contributor

PR for cargo-grcov. Will fix #326

I'm a big fan of early review to make sure I'm headed in the right direction. Wasn't qute sure how grcov created errors - they seem to be logged with log.error!(), but didn't spot any custom errors - should I just create a specific error type where needed - or is there one that converts from a string?

@gilescope gilescope marked this pull request as draft December 2, 2020 10:09
@marco-c

marco-c commented Dec 16, 2020

Copy link
Copy Markdown
Collaborator

Sorry for the delay, I hope I'll be able to get to this by the end of this week.

@dnaka91

dnaka91 commented Jun 14, 2021

Copy link
Copy Markdown
Contributor

Is there any progress on this?

I'm recently using grcov a lot and it would be great to have a dedicated cargo-grcov command that does all of the heavy lifting within a single command. Currently have to copy over a bunch of setup scripts for each project and this would simplify things A LOT.

@marco-c

marco-c commented Jun 14, 2021

Copy link
Copy Markdown
Collaborator

Unfortunately I didn't have time to review this :(

If somebody can help me with reviewing the code in detail, I can review the overall architecture.

(Assuming @gilescope is still interested in finishing this).

@dnaka91

dnaka91 commented Jun 17, 2021

Copy link
Copy Markdown
Contributor

I looked through the code and it is pretty much a wrapper around the grcov binary with the arguments and env vars described in the README.md directly applied by this new binary. It seems to miss support for source-based coverage yet.

I personally prefer to have cargo-grcov being a second binary that is independent of the grcov binary and simply uses the same components directly. That avoids version mismatches and failures trying to resolve the location of grcov.

Pretty much what was done for the flamegraph tool is what I think is more effective and safer towards errors. As we have a good abstraction already, it's easy to implement as well.

If you, @marco-c, don't mind, I would start a new PR that uses the same technique as in the flamegraph crate and combine it with the effort already done here, then adding in more features. For that PR I would probably strip many options from the CLI and only expose what make sense in the context of cargo.

What do you think?

@marco-c

marco-c commented Jun 29, 2021

Copy link
Copy Markdown
Collaborator

@dnaka91 sounds good to me!

@gilescope

gilescope commented Jul 11, 2021 via email

Copy link
Copy Markdown
Contributor Author

@marco-c

marco-c commented Jul 20, 2021

Copy link
Copy Markdown
Collaborator

@dnaka91 still interested?

@dnaka91

dnaka91 commented Jul 20, 2021

Copy link
Copy Markdown
Contributor

Definitely! Sorry, I didn't post any update on this for a while. Had a few other things going on and simply didn't get to it yet. Already checked the current implementation of this PR and I think I'll go with a very similar approach and then add a few cli args from the original grcov binary.

Also, I was hoping that #648 would maybe be merged before I start on this (or decided not to, just so I don't have to implement the CLI logic twice). Is there any chance you could give it a look soonish? 🙇‍♂️

@gilescope

Copy link
Copy Markdown
Contributor Author

@dnaka91 structopt is merged in now if that helps...

@gilescope

Copy link
Copy Markdown
Contributor Author

I've updated this PR to structopt. @dnaka91 as I said if you want to go on from here that's cool with me.

@dnaka91

dnaka91 commented Oct 17, 2021

Copy link
Copy Markdown
Contributor

@gilescope thanks for letting me know. I didn't work on this for quite a long time but will likely be able to pick up on this again soon-ish.

@gilescope

gilescope commented Oct 17, 2021 via email

Copy link
Copy Markdown
Contributor Author

@marco-c

marco-c commented Apr 21, 2022

Copy link
Copy Markdown
Collaborator

@dnaka91 @gilescope does any of you want to pick this up again?

@dnaka91

dnaka91 commented Apr 22, 2022

Copy link
Copy Markdown
Contributor

Sorry, I didn't do any further work on this. Reason is, that I moved to cargo-llvm-cov which just works better for me and seems more active compared to grcov. Therefore, I don't really have the motivation to push this further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a command "cargo grcov"

3 participants