-
Notifications
You must be signed in to change notification settings - Fork 13k
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
[WIP] Move compiletest out of tree #63929
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
|
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 |
I personally feel like moving compiletest out of the tree isn't a great idea at this point -- it's pretty frequently changed or altered in concert with changes to our tests, and while in theory it could be "just a dependency" or similar it's also tied very closely to bootstrap via all of its arguments. I'm also not entirely sure that there are enough wins from moving it out of tree: if the goal here is to decouple it from in-tree libtest, that's great, but should be orthogonal to moving it out of tree? Overall I'd like to see some justification for why we're taking this route -- it feels like there should be at least a link to some explanation comment (or one here), but I wasn't able to find one (admittedly, somewhat quickly). |
This was first discussed as part of removing libtest: Ultimately I'm much more interested in getting libtest moved out, so if there's a better way I'm all for it |
At minimum, I think if we move compiletest out of tree then it
See https://rust-lang.github.io/compiler-team/procedures/crates/ for the compiler team's policy re. out of tree crates. |
I see no justification in #63929 (comment) beyond "why not" -- could you clarify if there's some inherent issue I'm missing? I would be surprised if compiletest's dependency on in-tree libtest caused any problems with moving to an external copy of libtest; if it does, we can temporarily keep two versions around or some similar situation -- I'm willing to put in legwork in bootstrap to make things work, if it'd be helpful. So far, it seems like there's multiple downsides to moving compiletest out and little to no benefit. |
Sounds reasonable. I'll close for now then. And take a crack at just doing the external libtest thing. Personally, I think compiletest is so painfully easy to externalize that it should be, but a PR probably isn't the place to discuss that. |
There's a huge difference between being easy to externalize and that being a good idea -- compiletest is too tightly coupled to the tests in this repository for that to be feasible. But I agree that such discussion is best suited for internals or Zulip, perhaps. Let me know if I can help with libtest extraction in terms of bootstrap work. |
This already happened. There's a history here you're missing, clippy uses (its own out of tree) compiletest which uses unstable features, and the whole thing comes crashing down if libtest is moved out without rustc's compiletest. Out of tree compiletest is something others use too, and it's tricky to keep maintaining it on stable and nightly simultaneously for clippy and for other consumers. The nightly dependency is necessary for features that require libtest, but when we tried moving libtest out of tree everything broke. Moving compiletest (and its libtest dependency) out first reduces the largest potential source of conflicts here. Plus, people actually use the existing out of tree compiletest, and having a single official compiletest (as opposed to a somewhat-mirrored somewhat-broken compiletest clone) would be much nicer for all. |
FWIW the goal here is to share the exact same compiletest version between rust-lang/rust, and other rust-lang projects like clippy. An alternative would be to leave the source code in this repo, publish it to crates.io, and have clippy and rust bootstrap pull it from crates.io. |
So I've taken a brief look at the build failures in the PR which moved libtest out of tree and they seem ... unexpected to me? That is, it looks like unstable surface area changed in that PR which isn't what I'd expect at all. Maybe we were trying to do too many things at once? Basically it is my opinion that if we're causing downstream breakage for clippy, we're probably causing it for many libtest-using crates and then the moving out bit is probably doing something not quite right. It should be possible to change where the source code of libtest is without affecting anyone. |
That's ... a bit of an odd goal IMO? It's my opinion that there certainly exists space for something simpler than compiletest in the ecosystem (perhaps just targeting UI tests) but our version of compiletest is probably pretty clunky and such. Bits and pieces of it are of course fine to publish for reuse but the whole crate does a lot of rustc-specific magic that would feel pretty odd as a crates.io crate at least to me. |
Maybe? What compiler plugins like clippy currently use is the
Which PR did you look at? IIRC the PR that extracted libtest worked fine and passed all tests. What didn't work was the one tried to update the libtest dependency to a different libtest version and ran into linker issues. |
I think some crates started to use libtest 0.0.0 from crates.io which also caused them some issues, or issues mixing the libtest from crates.io with the libtest from another rust toolchain. Can't remember.
Sure, this can be added by just moving the code as is to a repo, and using a submodule. But the intent was for rust itself to pull in a libtest crate from crates.io. And that interacted badly with how Rust build process treats libtest specially. This changed a lot recently, from a 3 step to a 2 step process, so maybe the linking issues that appeared back then do not appear now. |
Basically I think if this PR moves us closer to some goal people want, then we can proceed with it -- I just feel like this should be easier than this PR (i.e., we should be able to skip changes to compiletest as part of moving libtest). If that's not the case for whatever reason then fine, and we can reopen, but those reasons would ideally be documented in the PR (at least a link to relevant build logs would be great!) |
Miri is also using compiletest-rs, and the fact that it lacks some features compared to rustc's compiletest is causing pain on a regular basis. On other occasions we'd also like to be able to customize things more, e.g. using a different rustc for aux builds vs the final build (only the final build should use Miri). Maybe we should switch to trybuild entirely, though I am not sure if that is feasible. |
Possibly crazy idea: move Miri in-tree? |
That's not really the direction we have been taking with tools lately. And Miri is just the second example listed here, clippy being another. |
@RalfJung The reason Clippy isn't being moved in tree is that @Manishearth wants to keep it out-of-tree for better on-boarding through shorter build times. Other than that, I believe the bors queue is equipped to take on Clippy. How is the situation re. on-boarding re. Miri? Would moving Miri in-tree be detrimental to on-boarding efforts? |
TBH I have no idea. We don't exactly have many contributors. But speaking just for myself, I am quite happy every time hacking on Miri does not involve having to build rustc. |
Is there anybody working on a component that's out of tree unhappy with that? 😄 |
This commit attempts to move
compiletest
to an external dependency. This was recommended as a first step to externalizinglibtest
itself.Currently everything is in personal git repos until we can get it all aligned and working.
The goal is to depend on an out-of-tree
compiletest
crate that depends on an externalizedlibtest
. I'm currently hosting these under djrenren/compiletest and djrenren/libtest, but these will need to be migrated to official locations once everything is up and running.It appears to be mostly working with a few spurious test failures on my machine that seem unrelated. I've created the PR so we can run bors and such.
Steps before merging
libtest
andcompiletest
into official locations