-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Add compile-pass mode to compiletest #44522
Conversation
rustc itself does not use this, but this is really useful for other clients of compiletest, e.g., miri.
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
Hmm I thought our usual way to handle this was to force (via an attribute)
Update: I'm not saying that I prefer the above hack to having a dedicated |
miri needs this because there is no binary being produced, so running the test makes no sense (and indeed, for "cross-interpretation", is not possible). rustc is in a different situation, so why would rustc need this? That test, to me, looks more like it tests the But then there is e.g. https://github.com/rust-lang/rust/blob/b1363a73ede57ae595f3a1be2bb75d308ba4f7f6/src/test/compile-fail/privacy/restricted/lookup-ignores-private.rs... |
The difference between There are many This also means that many |
What do you man by "check warnings etc."? Should things be I am happy to move some existing |
I mean it ignores
No, that can be enabled when explicitly checking whether some test does not emit certain warnings, but should not be turned on in general imo. |
Oh I see. But for tests that don't have anything like that (e.g. this one), making the
Tests like this? However, it has some "pretty-expanded" flag, so something still seems to be going on somewhere... |
yes
I'm not sure about that one either. |
It seems the test suites to run are defined in
None of these folders even exist... |
I moved all run-pass tests that have a line matching I can do similar things for compile-fail, though the grepping will have to be a little more careful there I suppose. |
Ah dang this is a little overeager and moves too many tests... I'll try sth. more conservative |
856d3a0
to
4920b3b
Compare
All right, I moved everything that matches |
4920b3b
to
336f1be
Compare
Does |
336f1be
to
eb7ddad
Compare
It invokes I am fine not moving any tests around here; all I really care about is having this test mode available for miri.^^ |
That's up to rustc/miri. If the compilation stops early, noone will notice, because noone tries to use the final binary. Miri simply stops compilation before it reaches trans (on non-host targets) |
Not really, e.g. if you referred to an undefined external symbol, it will not fail until reaching the linker. |
I verified that the compile-pass tests all only have one Let me know if you'd prefer me to
|
OK so -- This is not the direction that I want to move in (personally) for our test suite. I would prefer to be grouping tests by the functionality that they test and not the mode that they run in. More specifically, my plan was to unify
We currently have the ability to define "run-pass" I wrote about this here in this internals thread (with this addendum) and I still personally think it's the way to go. That said, I have wanted the ability to write |
Hmm... our compile-fail tests can't be ui tests, but maybe our run pass tests could be. |
@oli-obk why can't your compile-fail tests be |
I tried it once. Since we generate a stacktrace on failures, the output differs between the emulated platforms, since libstd's condiuonal compilation produces different functions. We might be able to reduce some cases, but many are impossible |
We'd also have to re-create all ui files if the libstd stack trace "above main" ever changes, which sounds like a pain.
Fair enough. As I already said above, I am no no way attached to moving existing rustc tests around, and I can take the 2nd commit out of this PR. Would that work for you? I noticed that ui tests have a conditional in compiletest to control whether the test is run, but I could not figure out so far how that conditional is controlled: rust/src/tools/compiletest/src/runtest.rs Line 2209 in 3a7ab6c
EDIT: Ah, it seems one says |
It actually seems like ui tests work very well for miri's run-pass suite, see rust-lang/miri#343. |
rustc itself does not use this, but this is really useful for other clients of compiletest, e.g., miri.
Currently, miri uses some pretty epic hacks to work around not having this -- see for yourself in rust-lang/miri#334.