-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Introduce compile-pass #49321
Introduce compile-pass #49321
Conversation
The grep for main doesn't quite work because of |
@Mark-Simulacrum Thanks for noticing this. I've updated the numbers and will move those back with the next commit. |
65386e0
to
a9cc2c4
Compare
Do we have timing information showing that there is a benefit to gain here? Can we be more conservative about moving tests over? I spot checked a few and tests like https://github.com/ishitatsuyuki/rust/blob/a9cc2c4b429d2f002212fbabd217eed3bb48917e/src/test/compile-pass/issue-15487.rs should not move. |
@alexcrichton why should it not move? There’s no information whatsoever to be gained from running that test. |
@nagisa We want to skip trans/linking for It's probably a good idea to add a whitelist of attributes and test flags which should be allowed for compile-pass and only move over tests which passes these. If a test uses |
Well, I’d much rather skip linking by specifying specific flags in the test file instead, for now, anyway. Something like With |
☔ The latest upstream changes (presumably #49337) made this pull request unmergeable. Please resolve the merge conflicts. |
To clarify, Regarding linkage tests, I'm planning to add a new comment config |
Status: waiting on decision. This is going to have a lot of conflicts so I'm not going to rebase until a concluding review. |
At this point, is there any use in specifically having compile-pass tests instead of moving them to ui? One can also specify --emit-metadata on ui single tests once we want to that |
@oli-obk The thing is that compile-pass tests are not UI tests. From IRC:
|
Yeah, I’m fairly in favour of compile-pass and would r+ this, but looking over 512 tests to ensure that none of them got moved by mistake is… a chore. I guess I’ll do that. |
From the short overview of the tests it seems to me that there are about three stages that are important:
None of these 512 tests, really care about being run and most of them, as suspected, fall into the first category. Notable exceptions would be the test pointed out by @alexcrichton above, which falls into the third category (checking the linking). There are also some tests that should’ve been a codegen test in a first place ( So, if we expect @alexcrichton what sort of performance numbers are you looking for? Is a local build before/after sufficient? Should we also produce expected gains for when we start using --emit=metadata? |
@nagisa Thanks for checking all the tests! However, I don't think that linkage tests belong to Assuming that all of the moved tests can be classified into the three categories you said, we can probably grep Checking for codegen tests looks a bit harder. For those tests, it may be better to make them into proper codegen tests instead. |
er sorry for the delay!
ah as you discovered in #49321 (comment) this test is intended for linking which
This is sort of yet-another-test-suite to maintain and I'd just want to make sure it's pulling its weight. It looks like the motivation here is to have a faster test suite by avoiding linking/running/codegen of binaries, which makes sense but I'd like to get a sense of scale. For example how long does this new test suite take to finish? How long did it take to finish in run-pass? |
@alexcrichton What should I do to get this to progress? Swap out linking tests? Taking some timing data? |
Could something like @nagisa's suggestion be used for this instead of a new test suite? With that I think selective tests could opt-in? I don't think we should apply the flag in a blanket fashion, but we can start reviewing tests to be added to |
@alexcrichton How does that compare to a blacklist based approach? Given that most tests are about trait resolution, how about specifying those that really need codegen instead? |
@ishitatsuyuki I would not be confident in the conclusion that most tests are about trait resolution, I think 100% of the tests I've ever written require the actual test to run. As a result I'm very wary to start one day ceasing execution of most of our tests. |
I would prefer not to have more "test modes". I have rather been expecting us to consolidate things into the
you can also add
to actually do the execution, if desired. |
@alexcrichton All of the moved tests has an empty main. There's absolutely no meaning in running it, unless we're testing some special linkage. @nikomatsakis The point is to keep the name intuitive. See previous discussion at #49321 (comment). |
@ishitatsuyuki yes while empty main may most of the time imply testing the trait system it could also just as equally mean that linkage is being tested or that codegen doesn't panic/abort. I think it needs to be evaluated on a case-by-case basis whether it's appropriate to stop executing tests. |
The suggestion you mentioned assumes that
With the exception of some auxiliary tests, we only feed dead code into LLVM, or they may be eliminated before even getting into LLVM. Linkage tests are exceptions, and the rest doesn't really test any codegen because there's no real code to transform. |
Yeah as @nikomatsakis mentioned we probably want to consolidate everything anyway at some point and move purely towards annotations in the test file to dictate what sort of test it is. My point about not blanket changing things is that we have tests which do rely on hitting llvm/linking. It's difficult to automatically classify which test is which. |
@alexcrichton / @ishitatsuyuki: How do you want to move forward with this? The open questions I see are
Im not sure from the comments, is there a clear answer for (1) & (2)? If so, I would propose to mainly implement (1) & (2) here and then move the individual tests in follow-up PRs with manual review. |
I'm personally ok with a mode such as this, and I think we'd just want it as a header like |
a9cc2c4
to
3910c23
Compare
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
3910c23
to
00bc634
Compare
@bors: r+ |
📌 Commit 00bc634 has been approved by |
Introduce compile-pass r? @alexcrichton The plan is to move things that cannot fail (no assert, unwrap, etc) out so we don't have to run them, and in the long term we can also stop running LLVM for them. Out of 3215 tests... ``` Language Files Lines Code Comments Blanks Rust 3215 119254 64688 35135 19431 ``` 16% of them has an empty main (which is already moved in this PR). ``` grep -rnPzl 'fn main\(\)\s*{\s*}' | xargs rg --files-without-match cfg | wc -l 547 ``` And only 50% of the tests contains assertions: ``` rg -e assert -e unwrap -e expect -e panic -l | wc -l 1600 ``` The remainder is likely able to get moved, but they need check by a human so I didn't touch them in PR. cc @rust-lang/compiler * [ ] Update documentation
☀️ Test successful - status-appveyor, status-travis |
What is/was the intended difference between Because I see several instances of |
(Is the idea that |
compile-pass is a hack to compile things that cannot be executed (libs etc). You still want to check linkage in this case. skip-codegen is for tests that does no runtime assertion, and tests things like type inference only. |
IMO we should use |
@eddyb They are two different concepts; |
Well, if the dead IR would cause LLVM to signal an error, then that's a good thing to know... |
@pnkfelix Yes that theoretically may happen, but:
|
I strongly prefer |
I usually write However, if overhead from |
r? @alexcrichton
The plan is to move things that cannot fail (no assert, unwrap, etc) out so we don't have to run them, and in the long term we can also stop running LLVM for them.
Out of 3215 tests...
16% of them has an empty main (which is already moved in this PR).
And only 50% of the tests contains assertions:
The remainder is likely able to get moved, but they need check by a human so I didn't touch them in PR.
cc @rust-lang/compiler