Open kinnison opened 3 years ago
I'd like to work on this.
Wonderful. Perhaps a good start would be for you to look at all the tests which already work on rust-toolchain, and then come up with some proposed tests as comments on this issue. Once we have a good idea of what tests you should write, it'll be worth putting hand-to-keyboard to produce some test code.
@kinnison I appreciate your comment and suggestion. I will start working at this weekend.
@kinnison I read through the test codes... My idea is that creating the function that generates a damaged toolchain in tests/mock/clitools.rs
. After that, I will start adding some test codes. Is that the right approach...? Thanks.
I'm not sure you need to create broken toolchains in clitools.rs
.
Let's first consider the 'checking components and targets work' part of the above:
A possible testing scenario might be:
rust-toolchain
stating that it wants nightly
with the rust-src
component installed.nightly
but without rust-src
rust-src
to be installed when the user interacts with rustup (e.g. rustup show active-toolchain
) in that projectYou could extend the above to include, for example, the user deliberately uninstalling a needed component or target, and verifying that on interacting with rustup show active-toolchain
in that directory, the uninstalled bits are reinstalled.
Now for the 'healing' aspect, specifically the linked PR deals with the fact that if the already installed toolchain looked like a dist toolchain but somehow was missing its manifest file then we would have failed to "heal" it. To understand what's going on there we need to think through the code which leads up to that point:
nightly
)rust-toolchain
file is present with nightly
in it and the user runs rustup show active-toolchain
)To achieve 3 there, all we need do in a test is:
nightly
to be installed (e.g. rustup default nightly
- there's lots of examples of this in the test suite)lib/rustlib/multirust-channel-manifest.toml
inside the relevant installed toolchain dirI hope that's enough for you to proceed, good luck. I really want these tests, so it's wonderful that you're going to give it a go 👍🏻
Does show active-toolchain install the toolchain today? I have cognitive friction around the idea that 'show' installs things. Other than that, this all sounds good.
@rbtcollins Yep if there's a rust-toolchain
file then rustup show active-toolchain
will install that in order to be able to show it.
We could do with some additional testing of the
rust-toolchain
functionality. Particularly around healing damaged toolchain installations, ensuring that the right components/targets are installed into it, etc.This is related to #2574