-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
feat: add cargo nextest support #144
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
Not sure if it is good to simply add a
nextest
command... Maybe it would be better to allow users to run arbitrary command incargo llvm-cov <user command>
?
Ideally, I would like cargo-llvm-cov to work with other subcommands as well.
However, I don't know what a good way to "passthrough arguments to an external subcommand" using clap, so I'm planning to move CLI parsing to lexopt before doing that. (Like I've done in other crates in the past 1, 2, 3)
src/cli.rs
Outdated
max_term_width(MAX_TERM_WIDTH), | ||
setting(AppSettings::DeriveDisplayOrder) | ||
)] | ||
Nextest, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Options after the nextest
subcommand do not seem to be recognized.
$ cargo llvm-cov nextest --all-features
error: Found argument '--all-features' which wasn't expected, or isn't valid in this context
If you tried to supply `--all-features` as a value rather than a flag, use `-- --all-features`
USAGE:
cargo llvm-cov nextest
For more information try --help
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's awesome! I'll have a try :)
Signed-off-by: Alex Chi <iskyzh@gmail.com>
180e623
to
1b0d581
Compare
I've updated the code to parse the extra args. PTAL, thanks! cc @taiki-e |
Signed-off-by: Alex Chi <iskyzh@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
bors r+
Build succeeded: |
Published in 0.2.4. Also, I've added nextest support to the installer of cargo-llvm-cov for GitHub Actions and updated installation docs. Lines 419 to 424 in d070f37
|
Ah, flags before Flags after $ cargo llvm-cov nextest --html
...
Summary [ 1.798s] 861 tests run: 861 passed, 0 skipped
Finished report saved to /Users/taiki/projects/portable-atomic/target/llvm-cov/html Flags before $ cargo llvm-cov --html nextest
Summary [ 1.853s] 861 tests run: 861 passed, 0 skipped
Filename Regions Missed Regions Cover Functions Missed Functions Executed Lines Missed Lines Cover Branches Missed Branches Cover
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
...
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL 528 126 76.14% 165 13 92.12% 1469 132 91.01% 0 0 - |
Aha, thanks! It's a little confusing because of how the passthrough options work I guess. |
Looking at this more, I think the support for passthrough args is slightly broken. For example,
|
Personally I suspect it would be easiest if the arguments to nextest were handled after
which makes the separation of arguments pretty clear. What do you think? |
Some args need to be fed to both nextest and llvm-cov to get things work correctly. For example, if user specifies Lines 137 to 139 in d070f37
Maybe we'll need to have a stable cli interface for nextest, and make the full opt parsing of nextest part of the llvm-cov? |
Ahhh I see. Well, nextest's interface is stable (i.e append-only, though new features are being added all the time). Specifically around test names, there's work going on in nextest-rs/nextest#117 to select specific tests in specific packages. There's also experimental support for reusing builds across machines by archiving the target directory, for example: https://nexte.st/book/reusing-builds.html I'm wondering if nextest can provide the information llvm-cov needs as a JSON blob. What information do you need? |
Based on my experience with cargo-hack and cargo-minimal-versions (and some unpublished cargo subcommands), I think the minimal information that is needed for partial parsing arguments in such a subcommand is basically only information about the short flags, which have no value. I believe the same approach could be used for cargo-llvm-cov. |
197: Switch from clap to lexopt r=taiki-e a=taiki-e Fixes #151, #144 (comment), and #144 (comment) Co-authored-by: Taiki Endo <te316e89@gmail.com>
Arguments-related bugs have been fixed in 0.5.0. |
Signed-off-by: Alex Chi iskyzh@gmail.com
cargo-nextest is quite popular recently, but it lacks coverage support. In this PR, I added a new
nextest
command to run tests.I've tested it locally and it works. On my own project, it shows (nearly) the same coverage as normal
cargo llvm-cov
.Not sure if it is good to simply add a
nextest
command... Maybe it would be better to allow users to run arbitrary command incargo llvm-cov <user command>
?Thanks for reviewing!