-
Notifications
You must be signed in to change notification settings - Fork 891
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
rustup_mode: add toolchain install --allow-downgrade option #2126
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1392,3 1392,60 @@ fn check_pgp_keys() { | |
); | ||
}) | ||
} | ||
|
||
#[test] | ||
fn install_allow_downgrade() { | ||
clitools::setup(Scenario::MissingComponent, &|config| { | ||
let trip = TargetTriple::from_build(); | ||
|
||
// this dist has no rls and there is no newer one | ||
set_current_dist_date(config, "2019-09-14"); | ||
expect_ok( | ||
config, | ||
&[ | ||
"rustup", | ||
"toolchain", | ||
"install", | ||
"nightly", | ||
"--no-self-update", | ||
], | ||
); | ||
expect_stdout_ok(config, &["rustc", "--version"], "hash-nightly-3"); | ||
expect_component_not_executable(config, "rls"); | ||
|
||
expect_err( | ||
config, | ||
&[ | ||
"rustup", | ||
"toolchain", | ||
"install", | ||
"nightly", | ||
"--no-self-update", | ||
"-c", | ||
"rls", | ||
], | ||
&format!( | ||
"component 'rls' for target '{}' is unavailable for download for channel nightly", | ||
trip, | ||
), | ||
); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps here add a check that the expect_component_not_executable(config, "rls"); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although I added it I would rather see that in a different testcase which checks if toolchain install does not change anything without allow-downgrade. When I look at the subcommand toolchain install I see 7 arguments and would expect at least as many as 7 tests at the level of cli-v2.rs, but there are not. Or else I don't know yet about all the test levels. Well that's obvious :) |
||
expect_stdout_ok(config, &["rustc", "--version"], "hash-nightly-3"); | ||
expect_component_not_executable(config, "rls"); | ||
|
||
expect_ok( | ||
config, | ||
&[ | ||
"rustup", | ||
"toolchain", | ||
"install", | ||
"nightly", | ||
"--no-self-update", | ||
"-c", | ||
"rls", | ||
"--allow-downgrade", | ||
], | ||
); | ||
expect_stdout_ok(config, &["rustc", "--version"], "hash-nightly-2"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While this is useful to check that it did downgrade, that'd be clearer if you'd done the equivalent above as commented. Also you could usefully assert that the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like the expect_component_executable check much more than the version check. Thx |
||
expect_component_executable(config, "rls"); | ||
}); | ||
} |
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.
After this, I'd add an expect to check the rustc version is the version we expect (i.e. one without rls)
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.
Yes, I add that. It is though like a sanity check to find out if our test setup is based on the right assumptions.