-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
#107307 Adding additional information to "cargo test --list" output #107785
Conversation
… output earlier: p2dchecks::fibonacci_test::case_1: test now: // test test_type | ignored_or_not | location_info p2dchecks::fibonacci_test::case_1: test | false | src\lib.rs:57:8: 57:19
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @petrochenkov (or someone else) soon. Please see the contribution instructions for more information. |
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
… output fixing build break
… output fixing build break
… output attempting to fix ordering issue
… output wtf am i doing?
… output wtf am i doing (redux)?
… output fixing tests
@@ -21,6 +21,7 @@ Session.vim | |||
.project | |||
.favorites.json | |||
.settings/ | |||
.vs/ |
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.
Could you avoid changes to this file?
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.
this is the visual studio ide creating the file. like .vscode.
with the extension i have just released (rust-analy - for which this PR is, i do expect windows devs to use visual studio more often.
is it okay to retain it?
Not sure who is responsible for libtest interfaces like this. cc @matklad as well, since you may know people who knows something about vscode integration. |
cc @Veykril Some high-level non-normative comments:
|
thanks for you comments - they all make sense.
i did my best to make this back-compatible - but if you let me know how to add an opt in flag, i am happy to do that.
the issue with json flag - this is my observation and i could be wrong - is that they are only available in the nightly builds. we cannot expect tool users to use only the nightly builds. |
… output taking in PR comments.
… output fixing build break.
Not the devtools team, libtest output is libs or compiler. (probably libs) |
My general take here is that this would require a lot more discussion before landing and probably should not be done as a PR. And also I think the proper solution is fully machine readable output for cargo test, which requires an RFC. |
… output making the delimiter consistent.
@Manishearth some clarifying questions.
are you referring to "--message-format json"? if so i agree. i am happy to start one and then raise the PR. however if you are referring to this entire change, it will be good to understand your reasoning. my reasoning is that:
i agree and happy to start it. |
If you are referring to the We can also stabilize I agree with @Manishearth that there probably should be more discussion. I assume there aren't already standard formats for just listing tests (such as junit)? I would starting a thread on internals to see if anyone in a wider audience has any feedback for adding a JSON format for listing tests, along with a proposed structure. I would also write a comment on #49359 soliciting feedback (since some people following that probably have some familiarity with machine-readable test integration). |
few things to set the context
point#1 means we cannot run the test and then populate the test explorer experience -> that beats the point of test explorer. regarding the "--message-format json" it does not work for listing. |
i am really thankful to the folks for jumping in with their comments / perspectives in <24hrs. i love it ❤️. however i also feel a lack of direction of what needs to be done. there is a 'pressing business need' so to speak and i do wish to do the right thing but in phase wise and balanced manner - prefer not to boil the ocean first up & sequentially. @petrochenkov @matklad @Manishearth @ehuss @m-ou-se based on your comments above i recommend the following approach
wdyt? |
Yea, what I think I and others are suggesting here is to add a JSON format for listing tests (instead of extending the textual format proposed here). Per the comments at #107785 (comment), I don't think we can change the existing output format, which I would agree with. I would not expect there to be significant procedure for just introducing a JSON format for listing tests, the design space is not that large. Just take a little bit of time to see if anyone has any insight to contribute. |
@ehuss may be i misunderstood. are you suggesting the following poa?
if so that is simpler and i am happy to start on it. @petrochenkov @matklad @Manishearth @m-ou-se let us know if you have any comments. |
I think you have mismatched expectations as to the speed at which things move here. Any feature addition, even if it's just a flag, is going to need to be properly thought through, because it's going to be supported forever. This is not something we take lightly. I think it's very unlikely that this PR will be merged without significant further discussion. We don't need to boil the ocean, but we do need to make sure we understand the design space and plan accordingly. This applies doubly so given that the test runner is not quite owned by any team that can take responsibility here. I don't see a "pressing business need" at all. I think this is an interesting feature to have, but by no means super urgent. Also, I recommend checking out cargo nextest; an unofficial test runner, which may be more amenable to quick feature requests if you have a pressing need. |
ok @Manishearth how do you recommend i proceed? like i said i want to do the right thing. also i am happy for it to take as long as it does. is this plan good enough for you?
regarding the other points nextest doesn't work for me because it requires users to add another package - rust-analyzer.vs or any other tool for that matter, should work out of the box i.e. 0 friction. for now we can keep aside whether this is a critical or a good to have - that depends on how you see things. |
I think for now just drop any code changes, and work on soliciting feedback and coming up with a holistic plan for all of the things involved. Make an internals post and then an RFC based on the feedback you get there (and the feedback you've gotten here so far) There's no need to work on the |
@Manishearth okay sure. so the new plan is:
okay with you? |
@parthopdas internals.rust-lang.org You could post a "pre-RFC" using the RFC template but not necessarily fillign in every section But actually I suggest just making a post and talk about the motivation, and solicit other motivations in the same area so you know what the set of needs are. And see what people propose as designs. One concern I have is that you seem very very new to these processes, and it might be better if you can find someone more familiar who has time to help you shepherd this. I cannot.
FWIW i'm not the person you need to convince, you need to convince the community and the teams 😄 |
okay i'll start on it. thanks for the discussions everyone. love you guys! ❤️ @Manishearth let me know if you have anyone in mind who can shepherd this through. |
Actually, this doesn't apply: the entire purpose of this feature is to work with other third party packages (this wasn't clear to me earlier). Those packages have other methods available to them for doing test discovery: looking at the code in the file, or using runners like nextest. They can choose to include a nextest binary if they want. |
Let me put my comment there |
cc @calebcartwright : You seem to maintain vscode-rust-test-adapter, do you think you can help here? |
Also cc @matklad who probably has a better idea of IDE integration stuff |
I confess I'm a bit I'm unsure whether we're supposed to continue the dialog here or shift to internals, but will respond here for now. From my pov I think it's fair to say that there's a lot that's already technically possible with the existing I'd personally love to see some libtest enhancements that improve machine-friendliness to make certain test-related ide/editor features more feasible (which imo should not entail more textual output and parsing) because I think those types of features can play a non-insignificant factor in the overall developer experience with a language. I'm not definitively sure who owns libtest either (sounds like there may have been plans to establish a test team?). I could probably make time to help assist an effort to make improvements, though I wouldn't have the bandwidth to fully drive the effort either. (edit): I think it's also worth noting that the existing test listing info does include line numbers for doc tests, just not unit tests nor integration tests. I recognize that's likely due to some behind the scenes technicalities, but regardless of the editor/ide-centric impetus for this particular proposal, I definitely think it's worth at least a discussion on having the ability to do the same for unit and integration tests, if for no reason other than consistency. |
@Manishearth what does it entail to take up 'ownership' of the testlib aspects? i am happy to contribute to that and other areas depending on my needs but what in addition to that? |
No, it's about team ownership. Right now I think it mostly falls between libs and devtools. The creation of a formalized devtools subteam would be nice for it, but it would need to be run or at least advised by someone familiar with how the Rust project works. If you can find someone willing to take that on, we can try something. In general libtest has been considered "done" (or, low priority) for a while which is why there hasn't ever been much motion on it. There's the custom test frameworks RFC (tracking issue) that didn't ever get driven further and that would be a nice task for a team picking this up, but kinda big. |
since we are on the topic - i'd state my opinion as well on custom test frameworks RFC 50297 and a proposal for it jrenner proposal i like the current approach better: doc / bench / tests with just 1 attribute [#test] with ability to extend e.g. test-case / quickcheck crates. even there while doc is an innovation but bench is also probably not required. RFC 50297 imho is overcomplicating testability aspects of rust code.
i think this is the way to go - which is what we appear to be doing. curiously the RFC is missing a prior art section. and while other ecosystems do have custom test frameworks (e.g. .net world has the xunit family) it is not to the extent the rfc is proposing. imho end goal of testing is to rapidly provide feedback on the architecture itself. harder something is to test, lesser you can prove its correctness and more the complexity will seep into the end user experience. i am a believer of 1000s of fine grained unit tests, 100ish of integration tests and 10s of end to end Acceptance tests. i cover that philosophy in bunch of talks at YT @parthopdas. simpler is better - lesser the constraints, the more degrees of freedom, the more scenarios can be covered (e.g. if just one test provides which in itself is complex, doesn't meet my needs what then? in addition more complex you make a test framework (e.g. setup teardown), the more complex testing itself becomes and lesser of it we do. what i would love to see (and willing to make happen) is investment in tools that make testing experience sexy & a breeze - for the very same reasons. case in point: ncrunch but for rust. and i believe with just minor tweaks to the existing infra, we have everything we need from the current testlib implementation. |
Closes #107307
earlier:
now:
// test | test_type | ignored_or_active | location_info