From c4417ff0b7e5a4847b13e0ab0a96b3cb15d8d40b Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 14 Apr 2016 00:14:47 +0000 Subject: [PATCH] Remove the "multirust" bin --- src/rustup-mock/src/clitools.rs | 22 +- tests/cli-misc.rs | 510 ++------------------------------ tests/cli-rustup.rs | 12 +- tests/cli-self-update.rs | 64 ++-- tests/cli-v1.rs | 225 +++++--------- tests/cli-v2.rs | 324 ++++++++------------ 6 files changed, 259 insertions(+), 898 deletions(-) diff --git a/src/rustup-mock/src/clitools.rs b/src/rustup-mock/src/clitools.rs index 39e98f1149..f9b4cff407 100644 --- a/src/rustup-mock/src/clitools.rs +++ b/src/rustup-mock/src/clitools.rs @@ -84,21 +84,19 @@ pub fn setup(s: Scenario, f: &Fn(&Config)) { let current_exe_path = env::current_exe().map(PathBuf::from).unwrap(); let exe_dir = current_exe_path.parent().unwrap(); - let ref multirust_build_path = exe_dir.join(format!("rustup-setup{}", EXE_SUFFIX)); + let ref build_path = exe_dir.join(format!("rustup-setup{}", EXE_SUFFIX)); - let ref multirust_path = config.exedir.join(format!("multirust{}", EXE_SUFFIX)); - let setup_path = config.exedir.join(format!("multirust-setup{}", EXE_SUFFIX)); + let ref rustup_path = config.exedir.join(format!("rustup{}", EXE_SUFFIX)); + let setup_path = config.exedir.join(format!("rustup-setup{}", EXE_SUFFIX)); + let multirust_setup_path = config.exedir.join(format!("multirust-setup{}", EXE_SUFFIX)); let rustc_path = config.exedir.join(format!("rustc{}", EXE_SUFFIX)); let cargo_path = config.exedir.join(format!("cargo{}", EXE_SUFFIX)); - let rustup_setup_path = config.exedir.join(format!("rustup-setup{}", EXE_SUFFIX)); - let rustup_path = config.exedir.join(format!("rustup{}", EXE_SUFFIX)); - - fs::copy(multirust_build_path, multirust_path).unwrap(); - fs::hard_link(multirust_path, rustc_path).unwrap(); - fs::hard_link(multirust_path, setup_path).unwrap(); - fs::hard_link(multirust_path, cargo_path).unwrap(); - fs::hard_link(multirust_path, rustup_setup_path).unwrap(); - fs::hard_link(multirust_path, rustup_path).unwrap(); + + fs::copy(build_path, rustup_path).unwrap(); + fs::hard_link(rustup_path, setup_path).unwrap(); + fs::hard_link(rustup_path, multirust_setup_path).unwrap(); + fs::hard_link(rustup_path, rustc_path).unwrap(); + fs::hard_link(rustup_path, cargo_path).unwrap(); // Create some custom toolchains create_custom_toolchains(&config.customdir); diff --git a/tests/cli-misc.rs b/tests/cli-misc.rs index 4d100852d5..c057c42260 100644 --- a/tests/cli-misc.rs +++ b/tests/cli-misc.rs @@ -19,7 +19,7 @@ pub fn setup(f: &Fn(&Config)) { #[test] fn smoke_test() { setup(&|config| { - expect_ok(config, &["multirust", "--version"]); + expect_ok(config, &["rustup", "--version"]); }); } @@ -41,352 +41,17 @@ fn rustc_with_bad_multirust_toolchain_env_var() { }); } -#[test] -fn install_toolchain_linking_from_path() { - setup(&|config| { - let path = config.customdir.join("custom-1"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "default", "default-from-path", - "--link-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-1"); - }); -} - -#[test] -fn install_toolchain_from_path() { - setup(&|config| { - let path = config.customdir.join("custom-1"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "default", "default-from-path", - "--copy-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-1"); - }); -} - -#[test] -fn install_toolchain_linking_from_path_again() { - setup(&|config| { - let path = config.customdir.join("custom-1"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "default", "default-from-path", - "--link-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-1"); - let path = config.customdir.join("custom-2"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "default", "default-from-path", - "--link-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-2"); - }); -} - -#[test] -fn install_toolchain_from_path_again() { - setup(&|config| { - let path = config.customdir.join("custom-1"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "default", "default-from-path", - "--copy-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-1"); - let path = config.customdir.join("custom-2"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "default", "default-from-path", - "--copy-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-2"); - }); -} - -#[test] -fn install_toolchain_change_from_copy_to_link() { - setup(&|config| { - let path = config.customdir.join("custom-1"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "default", "default-from-path", - "--copy-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-1"); - let path = config.customdir.join("custom-2"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "default", "default-from-path", - "--link-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-2"); - }); -} - -#[test] -fn install_toolchain_change_from_link_to_copy() { - setup(&|config| { - let path = config.customdir.join("custom-1"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "default", "default-from-path", - "--link-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-1"); - let path = config.customdir.join("custom-2"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "default", "default-from-path", - "--copy-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-2"); - }); -} - -#[test] -fn install_toolchain_from_custom() { - setup(&|config| { - let trip = this_host_triple(); - let custom_installer = config.distdir.join( - format!("dist/rust-nightly-{}.tar.gz", trip)); - let custom_installer = custom_installer.to_string_lossy(); - expect_ok(config, &["multirust", "default", "custom", - "--installer", &custom_installer]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-n-2"); - }); -} - -#[test] -fn install_toolchain_from_custom_wrong_extension() { - setup(&|config| { - let trip = this_host_triple(); - let custom_installer = config.distdir.join( - format!("dist/rust-nightly-{}.msi", trip)); - let custom_installer = custom_installer.to_string_lossy(); - expect_err(config, &["multirust", "default", "custom", - "--installer", &custom_installer], - "invalid extension for installer: 'msi'"); - }); -} - -#[test] -fn install_override_toolchain_linking_from_path() { - setup(&|config| { - let path = config.customdir.join("custom-1"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "override", "default-from-path", - "--link-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-1"); - }); -} - -#[test] -fn install_override_toolchain_from_path() { - setup(&|config| { - let path = config.customdir.join("custom-1"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "override", "default-from-path", - "--copy-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-1"); - }); -} - -#[test] -fn install_override_toolchain_linking_from_path_again() { - setup(&|config| { - let path = config.customdir.join("custom-1"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "override", "default-from-path", - "--link-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-1"); - let path = config.customdir.join("custom-2"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "override", "default-from-path", - "--link-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-2"); - }); -} - -#[test] -fn install_override_toolchain_from_path_again() { - setup(&|config| { - let path = config.customdir.join("custom-1"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "override", "default-from-path", - "--copy-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-1"); - let path = config.customdir.join("custom-2"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "override", "default-from-path", - "--copy-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-2"); - }); -} - -#[test] -fn install_override_toolchain_change_from_copy_to_link() { - setup(&|config| { - let path = config.customdir.join("custom-1"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "default", "default-from-path", - "--copy-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-1"); - let path = config.customdir.join("custom-2"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "default", "default-from-path", - "--link-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-2"); - }); -} - -#[test] -fn install_override_toolchain_change_from_link_to_copy() { - setup(&|config| { - let path = config.customdir.join("custom-1"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "default", "default-from-path", - "--link-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-1"); - let path = config.customdir.join("custom-2"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "default", "default-from-path", - "--copy-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-2"); - }); -} - -#[test] -fn install_override_toolchain_from_custom() { - setup(&|config| { - let trip = this_host_triple(); - let custom_installer = config.distdir.join( - format!("dist/rust-nightly-{}.tar.gz", trip)); - let custom_installer = custom_installer.to_string_lossy(); - expect_ok(config, &["multirust", "override", "custom", - "--installer", &custom_installer]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-n-2"); - }); -} - -#[test] -fn update_toolchain_linking_from_path() { - setup(&|config| { - let path = config.customdir.join("custom-1"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "update", "default-from-path", - "--link-local", &path]); - expect_ok(config, &["multirust", "default", "default-from-path"]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-1"); - }); -} - -#[test] -fn update_toolchain_from_path() { - setup(&|config| { - let path = config.customdir.join("custom-1"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "update", "default-from-path", - "--copy-local", &path]); - expect_ok(config, &["multirust", "default", "default-from-path"]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-1"); - }); -} - -#[test] -fn update_toolchain_linking_from_path_again() { - setup(&|config| { - let path = config.customdir.join("custom-1"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "update", "default-from-path", - "--link-local", &path]); - expect_ok(config, &["multirust", "default", "default-from-path"]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-1"); - let path = config.customdir.join("custom-2"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "update", "default-from-path", - "--link-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-2"); - }); -} - -#[test] -fn update_toolchain_from_path_again() { - setup(&|config| { - let path = config.customdir.join("custom-1"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "update", "default-from-path", - "--copy-local", &path]); - expect_ok(config, &["multirust", "default", "default-from-path"]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-1"); - let path = config.customdir.join("custom-2"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "update", "default-from-path", - "--copy-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-2"); - }); -} - -#[test] -fn update_toolchain_change_from_copy_to_link() { - setup(&|config| { - let path = config.customdir.join("custom-1"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "update", "default-from-path", - "--copy-local", &path]); - expect_ok(config, &["multirust", "default", "default-from-path"]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-1"); - let path = config.customdir.join("custom-2"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "update", "default-from-path", - "--link-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-2"); - }); -} - -#[test] -fn update_toolchain_change_from_link_to_copy() { - setup(&|config| { - let path = config.customdir.join("custom-1"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "update", "default-from-path", - "--link-local", &path]); - expect_ok(config, &["multirust", "default", "default-from-path"]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-1"); - let path = config.customdir.join("custom-2"); - let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "update", "default-from-path", - "--copy-local", &path]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-c-2"); - }); -} - #[test] fn custom_invalid_names() { setup(&|config| { - expect_err(config, &["multirust", "update", "nightly", - "--installer", "foo"], + expect_err(config, &["rustup", "toolchain", "link", "nightly", + "foo"], for_host!("invalid custom toolchain name: 'nightly-{0}'")); - expect_err(config, &["multirust", "update", "beta", - "--installer", "foo"], + expect_err(config, &["rustup", "toolchain", "link", "beta", + "foo"], for_host!("invalid custom toolchain name: 'beta-{0}'")); - expect_err(config, &["multirust", "update", "stable", - "--installer", "foo"], + expect_err(config, &["rustup", "toolchain", "link", "stable", + "foo"], for_host!("invalid custom toolchain name: 'stable-{0}'")); }); } @@ -394,115 +59,20 @@ fn custom_invalid_names() { #[test] fn custom_invalid_names_with_archive_dates() { setup(&|config| { - expect_err(config, &["multirust", "update", "nightly-2015-01-01", - "--installer", "foo"], + expect_err(config, &["rustup", "toolchain", "link", "nightly-2015-01-01", + "foo"], for_host!("invalid custom toolchain name: 'nightly-2015-01-01-{0}'")); - expect_err(config, &["multirust", "update", "beta-2015-01-01", - "--installer", "foo"], + expect_err(config, &["rustup", "toolchain", "link", "beta-2015-01-01", + "foo"], for_host!("invalid custom toolchain name: 'beta-2015-01-01-{0}'")); - expect_err(config, &["multirust", "update", "stable-2015-01-01", - "--installer", "foo"], + expect_err(config, &["rustup", "toolchain", "link", "stable-2015-01-01", + "foo"], for_host!("invalid custom toolchain name: 'stable-2015-01-01-{0}'")); }); } -#[test] -fn invalid_names_with_link_local() { - setup(&|config| { - expect_err(config, &["multirust", "update", "nightly", - "--link-local", "foo"], - for_host!("invalid custom toolchain name: 'nightly-{0}'")); - expect_err(config, &["multirust", "update", "nightly-2015-01-01", - "--link-local", "foo"], - for_host!("invalid custom toolchain name: 'nightly-2015-01-01-{0}'")); - }); -} - -#[test] -fn invalid_names_with_copy_local() { - setup(&|config| { - expect_err(config, &["multirust", "update", "nightly", - "--copy-local", "foo"], - for_host!("invalid custom toolchain name: 'nightly-{0}'")); - expect_err(config, &["multirust", "update", "nightly-2015-01-01", - "--copy-local", "foo"], - for_host!("invalid custom toolchain name: 'nightly-2015-01-01-{0}'")); - }); -} - -#[test] -fn custom_remote_url() { - setup(&|config| { - let trip = this_host_triple(); - let custom_installer = config.distdir.join( - format!("dist/rust-nightly-{}.tar.gz", trip)); - let custom_installer = custom_installer.to_string_lossy(); - let custom_installer = format!("file://{}", custom_installer); - expect_ok(config, &["multirust", "default", "custom", - "--installer", &custom_installer]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-n-2"); - }); -} - -#[test] -fn custom_multiple_local_path() { - clitools::setup(Scenario::Full, &|config| { - let trip = this_host_triple(); - let custom_installer1 = config.distdir.join( - format!("dist/2015-01-01/rustc-nightly-{}.tar.gz", trip)); - let custom_installer1 = custom_installer1.to_string_lossy(); - let custom_installer2 = config.distdir.join( - format!("dist/2015-01-01/cargo-nightly-{}.tar.gz", trip)); - let custom_installer2 = custom_installer2.to_string_lossy(); - expect_ok(config, &["multirust", "default", "custom", - "--installer", &custom_installer1, - "--installer", &custom_installer2]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-n-1"); - expect_stdout_ok(config, &["cargo", "--version"], - "hash-n-1"); - }); -} - -#[test] -fn custom_multiple_remote_url() { - clitools::setup(Scenario::Full, &|config| { - let trip = this_host_triple(); - let custom_installer1 = config.distdir.join( - format!("dist/2015-01-01/rustc-nightly-{}.tar.gz", trip)); - let custom_installer1 = custom_installer1.to_string_lossy(); - let custom_installer1 = format!("file://{}", custom_installer1); - let custom_installer2 = config.distdir.join( - format!("dist/2015-01-01/cargo-nightly-{}.tar.gz", trip)); - let custom_installer2 = custom_installer2.to_string_lossy(); - let custom_installer2 = format!("file://{}", custom_installer2); - expect_ok(config, &["multirust", "default", "custom", - "--installer", &custom_installer1, - "--installer", &custom_installer2]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-n-1"); - expect_stdout_ok(config, &["cargo", "--version"], - "hash-n-1"); - }); -} - #[test] fn running_with_v2_metadata() { - setup(&|config| { - expect_ok(config, &["multirust", "default", "nightly"]); - // Replace the metadata version - rustup_utils::raw::write_file(&config.rustupdir.join("version"), - "2").unwrap(); - expect_err(config, &["multirust", "default", "nightly"], - "rustup's metadata is out of date. run `rustup self upgrade-data`"); - expect_err(config, &["rustc", "--version"], - "rustup's metadata is out of date. run `rustup self upgrade-data`"); - }); -} - -#[test] -fn running_with_v2_metadata_rustup() { setup(&|config| { expect_ok(config, &["rustup", "default", "nightly"]); // Replace the metadata version @@ -520,28 +90,6 @@ fn running_with_v2_metadata_rustup() { // are deleted. #[test] fn upgrade_v2_metadata_to_v12() { - setup(&|config| { - expect_ok(config, &["multirust", "default", "nightly"]); - // Replace the metadata version - rustup_utils::raw::write_file(&config.rustupdir.join("version"), - "2").unwrap(); - expect_stderr_ok(config, &["multirust", "upgrade-data"], - "warning: this upgrade will remove all existing toolchains. you will need to reinstall them"); - expect_err(config, &["multirust", "show-default"], - for_host!("toolchain 'nightly-{0}' is not installed")); - expect_err(config, &["rustc", "--version"], - for_host!("toolchain 'nightly-{0}' is not installed")); - expect_ok(config, &["multirust", "update", "nightly"]); - expect_stdout_ok(config, &["rustc", "--version"], - "hash-n-2"); - }); -} - -// The thing that changed in the version bump from 2 -> 12 was the -// toolchain format. Check that on the upgrade all the toolchains. -// are deleted. -#[test] -fn upgrade_v2_metadata_to_v12_rustup() { setup(&|config| { expect_ok(config, &["rustup", "default", "nightly"]); // Replace the metadata version @@ -557,37 +105,15 @@ fn upgrade_v2_metadata_to_v12_rustup() { }); } -#[test] -fn delete_data() { - setup(&|config| { - expect_ok(config, &["multirust", "default", "nightly"]); - assert!(config.rustupdir.exists()); - expect_ok(config, &["multirust", "delete-data", "-y"]); - assert!(!config.rustupdir.exists()); - }); -} - -#[test] -fn delete_data_no_data() { - setup(&|config| { - expect_ok(config, &["multirust", "default", "nightly"]); - assert!(config.rustupdir.exists()); - expect_ok(config, &["multirust", "delete-data", "-y"]); - assert!(!config.rustupdir.exists()); - expect_ok(config, &["multirust", "delete-data", "-y"]); - assert!(!config.rustupdir.exists()); - }); -} - // Regression test for newline placement #[test] fn update_all_no_update_whitespace() { setup(&|config| { - expect_stdout_ok(config, &["multirust", "update", "nightly"], -r" - nightly installed - 1.3.0 (hash-n-2) + expect_stdout_ok(config, &["rustup", "update", "nightly"], +for_host!(r" + nightly-{} installed - 1.3.0 (hash-n-2) -"); +")); }); } @@ -595,7 +121,7 @@ r" #[test] fn update_works_without_term() { setup(&|config| { - let mut cmd = clitools::cmd(config, "multirust", &["update", "nightly"]); + let mut cmd = clitools::cmd(config, "rustup", &["update", "nightly"]); clitools::env(config, &mut cmd); cmd.env_remove("TERM"); diff --git a/tests/cli-rustup.rs b/tests/cli-rustup.rs index 353d48b5a0..7d8cd59bc4 100644 --- a/tests/cli-rustup.rs +++ b/tests/cli-rustup.rs @@ -64,8 +64,8 @@ fn rustup_all_channels() { setup(&|config| { set_current_dist_date(config, "2015-01-01"); expect_ok(config, &["rustup", "update", "stable"]); - expect_ok(config, &["multirust", "update", "beta"]); - expect_ok(config, &["multirust", "update", "nightly"]); + expect_ok(config, &["rustup", "update", "beta"]); + expect_ok(config, &["rustup", "update", "nightly"]); set_current_dist_date(config, "2015-01-02"); expect_ok_ex(config, &["rustup", "update", "--no-self-update"], for_host!(r" @@ -110,10 +110,10 @@ fn rustup_some_channels_up_to_date() { setup(&|config| { set_current_dist_date(config, "2015-01-01"); expect_ok(config, &["rustup", "update", "stable"]); - expect_ok(config, &["multirust", "update", "beta"]); - expect_ok(config, &["multirust", "update", "nightly"]); + expect_ok(config, &["rustup", "update", "beta"]); + expect_ok(config, &["rustup", "update", "nightly"]); set_current_dist_date(config, "2015-01-02"); - expect_ok(config, &["multirust", "update", "beta"]); + expect_ok(config, &["rustup", "update", "beta"]); expect_ok_ex(config, &["rustup", "update", "--no-self-update"], for_host!(r" stable-{0} updated - 1.1.0 (hash-s-2) @@ -148,7 +148,7 @@ info: installing component 'rust-docs' fn rustup_no_channels() { setup(&|config| { expect_ok(config, &["rustup", "update", "stable"]); - expect_ok(config, &["multirust", "remove-toolchain", "stable"]); + expect_ok(config, &["rustup", "toolchain", "remove", "stable"]); expect_ok_ex(config, &["rustup", "update", "--no-self-update"], r"", r"info: no updatable toolchains installed diff --git a/tests/cli-self-update.rs b/tests/cli-self-update.rs index fcb7ed1e8f..88b168e6e9 100644 --- a/tests/cli-self-update.rs +++ b/tests/cli-self-update.rs @@ -144,7 +144,7 @@ fn install_creates_cargo_home() { fn uninstall_deletes_bins() { setup(&|config| { expect_ok(config, &["rustup-setup", "-y"]); - expect_ok(config, &["multirust", "self", "uninstall", "-y"]); + expect_ok(config, &["rustup", "self", "uninstall", "-y"]); let multirust = config.cargodir.join(&format!("bin/multirust{}", EXE_SUFFIX)); let rustc = config.cargodir.join(&format!("bin/rustc{}", EXE_SUFFIX)); let rustdoc = config.cargodir.join(&format!("bin/rustdoc{}", EXE_SUFFIX)); @@ -174,7 +174,7 @@ fn uninstall_works_if_some_bins_dont_exist() { fs::remove_file(&rustc).unwrap(); fs::remove_file(&cargo).unwrap(); - expect_ok(config, &["multirust", "self", "uninstall", "-y"]); + expect_ok(config, &["rustup", "self", "uninstall", "-y"]); assert!(!multirust.exists()); assert!(!rustc.exists()); @@ -189,8 +189,8 @@ fn uninstall_works_if_some_bins_dont_exist() { fn uninstall_deletes_multirust_home() { setup(&|config| { expect_ok(config, &["rustup-setup", "-y"]); - expect_ok(config, &["multirust", "default", "nightly"]); - expect_ok(config, &["multirust", "self", "uninstall", "-y"]); + expect_ok(config, &["rustup", "default", "nightly"]); + expect_ok(config, &["rustup", "self", "uninstall", "-y"]); assert!(!config.rustupdir.exists()); }); } @@ -200,7 +200,7 @@ fn uninstall_works_if_multirust_home_doesnt_exist() { setup(&|config| { expect_ok(config, &["rustup-setup", "-y"]); raw::remove_dir(&config.rustupdir).unwrap(); - expect_ok(config, &["multirust", "self", "uninstall", "-y"]); + expect_ok(config, &["rustup", "self", "uninstall", "-y"]); }); } @@ -208,7 +208,7 @@ fn uninstall_works_if_multirust_home_doesnt_exist() { fn uninstall_deletes_cargo_home() { setup(&|config| { expect_ok(config, &["rustup-setup", "-y"]); - expect_ok(config, &["multirust", "self", "uninstall", "-y"]); + expect_ok(config, &["rustup", "self", "uninstall", "-y"]); assert!(!config.cargodir.exists()); }); } @@ -219,7 +219,7 @@ fn uninstall_fails_if_not_installed() { expect_ok(config, &["rustup-setup", "-y"]); let multirust = config.cargodir.join(&format!("bin/multirust{}", EXE_SUFFIX)); fs::remove_file(&multirust).unwrap(); - expect_err(config, &["multirust", "self", "uninstall", "-y"], + expect_err(config, &["rustup", "self", "uninstall", "-y"], "rustup is not installed"); }); } @@ -262,7 +262,7 @@ fn uninstall_self_delete_works() { fn uninstall_doesnt_leave_gc_file() { setup(&|config| { expect_ok(config, &["rustup-setup", "-y"]); - expect_ok(config, &["multirust", "self", "uninstall", "-y"]); + expect_ok(config, &["rustup", "self", "uninstall", "-y"]); let ref parent = config.cargodir.parent().unwrap(); // Actually, there just shouldn't be any files here @@ -326,7 +326,7 @@ fn uninstall_removes_path_from_rc(rcfile: &str) { let ref rc = config.homedir.join(rcfile); raw::write_file(rc, my_rc).unwrap(); expect_ok(config, &["rustup-setup", "-y"]); - expect_ok(config, &["multirust", "self", "uninstall", "-y"]); + expect_ok(config, &["rustup", "self", "uninstall", "-y"]); let new_rc = raw::read_file(rc).unwrap(); assert_eq!(new_rc, my_rc); @@ -345,7 +345,7 @@ fn uninstall_doesnt_touch_rc_files_that_dont_contain_cargo_home() { setup(&|config| { let my_rc = "foo\nbar\nbaz"; expect_ok(config, &["rustup-setup", "-y"]); - expect_ok(config, &["multirust", "self", "uninstall", "-y"]); + expect_ok(config, &["rustup", "self", "uninstall", "-y"]); let ref profile = config.homedir.join(".profile"); raw::write_file(profile, my_rc).unwrap(); @@ -378,7 +378,7 @@ fn when_cargo_home_is_the_default_write_path_specially() { let expected = format!("{}\n{}\n", my_profile, addition); assert_eq!(new_profile, expected); - let mut cmd = clitools::cmd(config, "multirust", &["self", "uninstall", "-y"]); + let mut cmd = clitools::cmd(config, "rustup", &["self", "uninstall", "-y"]); cmd.env_remove("CARGO_HOME"); assert!(cmd.output().unwrap().status.success()); @@ -453,7 +453,7 @@ fn install_does_not_add_path_twice() { fn uninstall_removes_path() { setup(&|config| { expect_ok(config, &["rustup-setup", "-y"]); - expect_ok(config, &["multirust", "self", "uninstall", "-y"]); + expect_ok(config, &["rustup", "self", "uninstall", "-y"]); let path = config.cargodir.join("bin").to_string_lossy().to_string(); assert!(!get_path().unwrap().contains(&path)); @@ -495,7 +495,7 @@ fn update_but_delete_existing_updater_first() { // If it happens to already exist for some reason it // should just be deleted. raw::write_file(setup, "").unwrap(); - expect_ok(config, &["multirust", "self", "update"]); + expect_ok(config, &["rustup", "self", "update"]); let multirust = config.cargodir.join(&format!("bin/multirust{}", EXE_SUFFIX)); assert!(multirust.exists()); @@ -511,8 +511,8 @@ fn update_no_change() { let ref dist_dir = self_dist.join(&format!("{}", trip)); let ref dist_exe = dist_dir.join(&format!("rustup-setup{}", EXE_SUFFIX)); let ref dist_hash = dist_dir.join(&format!("rustup-setup{}.sha256", EXE_SUFFIX)); - let ref multirust_bin = config.exedir.join(&format!("multirust{}", EXE_SUFFIX)); - fs::copy(multirust_bin, dist_exe).unwrap(); + let ref rustup_bin = config.exedir.join(&format!("rustup{}", EXE_SUFFIX)); + fs::copy(rustup_bin, dist_exe).unwrap(); create_hash(dist_exe, dist_hash); expect_ok_ex(config, &["rustup", "self", "update"], @@ -537,7 +537,7 @@ fn update_bad_hash() { create_hash(some_other_file, dist_hash); - expect_err(config, &["multirust", "self", "update"], + expect_err(config, &["rustup", "self", "update"], "checksum failed"); }); } @@ -553,7 +553,7 @@ fn update_hash_file_404() { fs::remove_file(dist_hash).unwrap(); - expect_err(config, &["multirust", "self", "update"], + expect_err(config, &["rustup", "self", "update"], "could not download file"); }); } @@ -569,7 +569,7 @@ fn update_download_404() { fs::remove_file(dist_exe).unwrap(); - expect_err(config, &["multirust", "self", "update"], + expect_err(config, &["rustup", "self", "update"], "could not download file"); }); } @@ -643,8 +643,8 @@ info: downloading self-update fn updater_leaves_itself_for_later_deletion() { update_setup(&|config, _| { expect_ok(config, &["rustup-setup", "-y"]); - expect_ok(config, &["multirust", "update", "nightly"]); - expect_ok(config, &["multirust", "self", "update"]); + expect_ok(config, &["rustup", "update", "nightly"]); + expect_ok(config, &["rustup", "self", "update"]); let setup = config.cargodir.join(&format!("bin/rustup-setup{}", EXE_SUFFIX)); assert!(setup.exists()); @@ -655,10 +655,10 @@ fn updater_leaves_itself_for_later_deletion() { fn updater_is_deleted_after_running_multirust() { update_setup(&|config, _| { expect_ok(config, &["rustup-setup", "-y"]); - expect_ok(config, &["multirust", "update", "nightly"]); - expect_ok(config, &["multirust", "self", "update"]); + expect_ok(config, &["rustup", "update", "nightly"]); + expect_ok(config, &["rustup", "self", "update"]); - expect_ok(config, &["multirust", "update", "nightly"]); + expect_ok(config, &["rustup", "update", "nightly"]); let setup = config.cargodir.join(&format!("bin/rustup-setup{}", EXE_SUFFIX)); assert!(!setup.exists()); @@ -669,8 +669,8 @@ fn updater_is_deleted_after_running_multirust() { fn updater_is_deleted_after_running_rustc() { update_setup(&|config, _| { expect_ok(config, &["rustup-setup", "-y"]); - expect_ok(config, &["multirust", "default", "nightly"]); - expect_ok(config, &["multirust", "self", "update"]); + expect_ok(config, &["rustup", "default", "nightly"]); + expect_ok(config, &["rustup", "self", "update"]); expect_ok(config, &["rustc", "--version"]); @@ -683,10 +683,10 @@ fn updater_is_deleted_after_running_rustc() { fn multirust_still_works_after_update() { update_setup(&|config, _| { expect_ok(config, &["rustup-setup", "-y"]); - expect_ok(config, &["multirust", "default", "nightly"]); - expect_ok(config, &["multirust", "self", "update"]); + expect_ok(config, &["rustup", "default", "nightly"]); + expect_ok(config, &["rustup", "self", "update"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-2"); - expect_ok(config, &["multirust", "default", "beta"]); + expect_ok(config, &["rustup", "default", "beta"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-b-2"); }); } @@ -779,12 +779,12 @@ fn install_sets_up_stable_unless_a_different_default_is_requested() { fn install_sets_up_stable_unless_there_is_already_a_default() { setup(&|config| { expect_ok(config, &["rustup-setup", "-y"]); - expect_ok(config, &["multirust", "default", "nightly"]); - expect_ok(config, &["multirust", "remove-toolchain", "stable"]); + expect_ok(config, &["rustup", "default", "nightly"]); + expect_ok(config, &["rustup", "toolchain", "remove", "stable"]); expect_ok(config, &["rustup-setup", "-y"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-2"); - expect_err(config, &["multirust", "run", "stable", "rustc", "--version"], + expect_err(config, &["rustup", "run", "stable", "rustc", "--version"], for_host!("toolchain 'stable-{0}' is not installed")); }); } @@ -798,7 +798,7 @@ fn install_deletes_legacy_multirust_bins() { setup(&|config| { let ref multirust_bin_dir = config.rustupdir.join("bin"); fs::create_dir_all(multirust_bin_dir).unwrap(); - let ref multirust_bin = multirust_bin_dir.join("multirust"); + let ref multirust_bin = multirust_bin_dir.join("rustup"); let ref rustc_bin = multirust_bin_dir.join("rustc"); raw::write_file(multirust_bin, "").unwrap(); raw::write_file(rustc_bin, "").unwrap(); diff --git a/tests/cli-v1.rs b/tests/cli-v1.rs index 69eb0dfd24..b94a05344e 100644 --- a/tests/cli-v1.rs +++ b/tests/cli-v1.rs @@ -11,7 +11,7 @@ use tempdir::TempDir; use rustup_mock::clitools::{self, Config, Scenario, expect_ok, expect_stdout_ok, expect_err, expect_stderr_ok, set_current_dist_date, - change_dir, run, this_host_triple}; + change_dir, this_host_triple}; macro_rules! for_host { ($s: expr) => (&format!($s, this_host_triple())) } @@ -27,27 +27,10 @@ fn rustc_no_default_toolchain() { }); } -#[test] -fn show_default_no_default_toolchain() { - setup(&|config| { - expect_stdout_ok(config, &["multirust", "show-default"], - "no default toolchain configured"); - }); -} - -#[test] -fn default_toolchain() { - setup(&|config| { - expect_ok(config, &["multirust", "default", "nightly"]); - expect_stdout_ok(config, &["multirust", "show-default"], - "default toolchain: nightly"); - }); -} - #[test] fn expected_bins_exist() { setup(&|config| { - expect_ok(config, &["multirust", "default", "nightly"]); + expect_ok(config, &["rustup", "default", "nightly"]); expect_stdout_ok(config, &["rustc", "--version"], "1.3.0"); }); } @@ -55,11 +38,11 @@ fn expected_bins_exist() { #[test] fn install_toolchain_from_channel() { setup(&|config| { - expect_ok(config, &["multirust", "default", "nightly"]); + expect_ok(config, &["rustup", "default", "nightly"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-2"); - expect_ok(config, &["multirust", "default", "beta"]); + expect_ok(config, &["rustup", "default", "beta"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-b-2"); - expect_ok(config, &["multirust", "default", "stable"]); + expect_ok(config, &["rustup", "default", "stable"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-s-2"); }); } @@ -67,11 +50,11 @@ fn install_toolchain_from_channel() { #[test] fn install_toolchain_from_archive() { clitools::setup(Scenario::ArchivesV1, &|config| { - expect_ok(config, &["multirust", "default" , "nightly-2015-01-01"]); + expect_ok(config, &["rustup", "default" , "nightly-2015-01-01"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-1"); - expect_ok(config, &["multirust", "default" , "beta-2015-01-01"]); + expect_ok(config, &["rustup", "default" , "beta-2015-01-01"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-b-1"); - expect_ok(config, &["multirust", "default" , "stable-2015-01-01"]); + expect_ok(config, &["rustup", "default" , "stable-2015-01-01"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-s-1"); }); } @@ -79,7 +62,7 @@ fn install_toolchain_from_archive() { #[test] fn install_toolchain_from_version() { setup(&|config| { - expect_ok(config, &["multirust", "default" , "1.1.0"]); + expect_ok(config, &["rustup", "default" , "1.1.0"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-s-2"); }); } @@ -87,8 +70,8 @@ fn install_toolchain_from_version() { #[test] fn default_existing_toolchain() { setup(&|config| { - expect_ok(config, &["multirust", "update", "nightly"]); - expect_stderr_ok(config, &["multirust", "default", "nightly"], + expect_ok(config, &["rustup", "update", "nightly"]); + expect_stderr_ok(config, &["rustup", "default", "nightly"], for_host!("using existing install for 'nightly-{0}'")); }); } @@ -97,11 +80,11 @@ fn default_existing_toolchain() { fn update_channel() { clitools::setup(Scenario::ArchivesV1, &|config| { set_current_dist_date(config, "2015-01-01"); - expect_ok(config, &["multirust", "default", "nightly"]); + expect_ok(config, &["rustup", "default", "nightly"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-1"); set_current_dist_date(config, "2015-01-02"); - expect_ok(config, &["multirust", "update", "nightly"]); + expect_ok(config, &["rustup", "update", "nightly"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-2"); }); @@ -110,11 +93,11 @@ fn update_channel() { #[test] fn list_toolchains() { clitools::setup(Scenario::ArchivesV1, &|config| { - expect_ok(config, &["multirust", "update", "nightly"]); - expect_ok(config, &["multirust", "update", "beta-2015-01-01"]); - expect_stdout_ok(config, &["multirust", "list-toolchains"], + expect_ok(config, &["rustup", "update", "nightly"]); + expect_ok(config, &["rustup", "update", "beta-2015-01-01"]); + expect_stdout_ok(config, &["rustup", "toolchain", "list"], "nightly"); - expect_stdout_ok(config, &["multirust", "list-toolchains"], + expect_stdout_ok(config, &["rustup", "toolchain", "list"], "beta-2015-01-01"); }); } @@ -122,7 +105,7 @@ fn list_toolchains() { #[test] fn list_toolchains_with_none() { setup(&|config| { - expect_stdout_ok(config, &["multirust", "list-toolchains"], + expect_stdout_ok(config, &["rustup", "toolchain", "list"], "no installed toolchains"); }); } @@ -130,10 +113,10 @@ fn list_toolchains_with_none() { #[test] fn remove_toolchain() { setup(&|config| { - expect_ok(config, &["multirust", "update", "nightly"]); - expect_ok(config, &["multirust", "remove-toolchain", "nightly"]); - expect_ok(config, &["multirust", "list-toolchains"]); - expect_stdout_ok(config, &["multirust", "list-toolchains"], + expect_ok(config, &["rustup", "update", "nightly"]); + expect_ok(config, &["rustup", "toolchain", "remove", "nightly"]); + expect_ok(config, &["rustup", "toolchain", "list"]); + expect_stdout_ok(config, &["rustup", "toolchain", "list"], "no installed toolchains"); }); } @@ -141,8 +124,8 @@ fn remove_toolchain() { #[test] fn remove_default_toolchain_error_handling() { setup(&|config| { - expect_ok(config, &["multirust", "default", "nightly"]); - expect_ok(config, &["multirust", "remove-toolchain", "nightly"]); + expect_ok(config, &["rustup", "default", "nightly"]); + expect_ok(config, &["rustup", "toolchain", "remove", "nightly"]); expect_err(config, &["rustc"], for_host!("toolchain 'nightly-{0}' is not installed")); }); @@ -151,11 +134,11 @@ fn remove_default_toolchain_error_handling() { #[test] fn remove_override_toolchain_error_handling() { setup(&|config| { - let tempdir = TempDir::new("multirust").unwrap(); + let tempdir = TempDir::new("rustup").unwrap(); change_dir(tempdir.path(), &|| { - expect_ok(config, &["multirust", "default", "nightly"]); - expect_ok(config, &["multirust", "override", "beta"]); - expect_ok(config, &["multirust", "remove-toolchain", "beta"]); + expect_ok(config, &["rustup", "default", "nightly"]); + expect_ok(config, &["rustup", "override", "add", "beta"]); + expect_ok(config, &["rustup", "toolchain", "remove", "beta"]); expect_err(config, &["rustc"], for_host!("toolchain 'beta-{0}' is not installed")); }); @@ -171,7 +154,7 @@ fn bad_sha_on_manifest() { &mut sha_bytes[..10].clone_from_slice(b"aaaaaaaaaa"); let sha_str = String::from_utf8(sha_bytes).unwrap(); rustup_utils::raw::write_file(&sha_file, &sha_str).unwrap(); - expect_err(config, &["multirust", "default", "nightly"], + expect_err(config, &["rustup", "default", "nightly"], "checksum failed"); }); } @@ -186,7 +169,7 @@ fn bad_sha_on_installer() { rustup_utils::raw::write_file(&file.path(), "xxx").unwrap(); } } - expect_err(config, &["multirust", "default", "nightly"], + expect_err(config, &["rustup", "default", "nightly"], "checksum failed"); }); } @@ -194,13 +177,13 @@ fn bad_sha_on_installer() { #[test] fn install_override_toolchain_from_channel() { setup(&|config| { - expect_ok(config, &["multirust", "override", "nightly"]); + expect_ok(config, &["rustup", "override", "add", "nightly"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-2"); - expect_ok(config, &["multirust", "override", "beta"]); + expect_ok(config, &["rustup", "override", "add", "beta"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-b-2"); - expect_ok(config, &["multirust", "override", "stable"]); + expect_ok(config, &["rustup", "override", "add", "stable"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-s-2"); }); @@ -209,13 +192,13 @@ fn install_override_toolchain_from_channel() { #[test] fn install_override_toolchain_from_archive() { clitools::setup(Scenario::ArchivesV1, &|config| { - expect_ok(config, &["multirust", "override", "nightly-2015-01-01"]); + expect_ok(config, &["rustup", "override", "add", "nightly-2015-01-01"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-1"); - expect_ok(config, &["multirust", "override", "beta-2015-01-01"]); + expect_ok(config, &["rustup", "override", "add", "beta-2015-01-01"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-b-1"); - expect_ok(config, &["multirust", "override", "stable-2015-01-01"]); + expect_ok(config, &["rustup", "override", "add", "stable-2015-01-01"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-s-1"); }); @@ -224,7 +207,7 @@ fn install_override_toolchain_from_archive() { #[test] fn install_override_toolchain_from_version() { setup(&|config| { - expect_ok(config, &["multirust", "override", "1.1.0"]); + expect_ok(config, &["rustup", "override", "add", "1.1.0"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-s-2"); }); @@ -233,10 +216,10 @@ fn install_override_toolchain_from_version() { #[test] fn override_overrides_default() { setup(&|config| { - let tempdir = TempDir::new("multirust").unwrap(); - expect_ok(config, &["multirust", "default" , "nightly"]); + let tempdir = TempDir::new("rustup").unwrap(); + expect_ok(config, &["rustup", "default" , "nightly"]); change_dir(tempdir.path(), &|| { - expect_ok(config, &["multirust", "override" , "beta"]); + expect_ok(config, &["rustup", "override" , "add", "beta"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-b-2"); }); }); @@ -245,15 +228,15 @@ fn override_overrides_default() { #[test] fn multiple_overrides() { setup(&|config| { - let tempdir1 = TempDir::new("multirust").unwrap(); - let tempdir2 = TempDir::new("multirust").unwrap(); + let tempdir1 = TempDir::new("rustup").unwrap(); + let tempdir2 = TempDir::new("rustup").unwrap(); - expect_ok(config, &["multirust", "default", "nightly"]); + expect_ok(config, &["rustup", "default", "nightly"]); change_dir(tempdir1.path(), &|| { - expect_ok(config, &["multirust", "override", "beta"]); + expect_ok(config, &["rustup", "override", "add", "beta"]); }); change_dir(tempdir2.path(), &|| { - expect_ok(config, &["multirust", "override", "stable"]); + expect_ok(config, &["rustup", "override", "add", "stable"]); }); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-2"); @@ -270,88 +253,22 @@ fn multiple_overrides() { #[test] fn change_override() { setup(&|config| { - let tempdir = TempDir::new("multirust").unwrap(); + let tempdir = TempDir::new("rustup").unwrap(); change_dir(tempdir.path(), &|| { - expect_ok(config, &["multirust", "override", "nightly"]); - expect_ok(config, &["multirust", "override", "beta"]); + expect_ok(config, &["rustup", "override", "add", "nightly"]); + expect_ok(config, &["rustup", "override", "add", "beta"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-b-2"); }); }); } -#[test] -fn show_override() { - setup(&|config| { - let tempdir = TempDir::new("multirust").unwrap(); - change_dir(tempdir.path(), &|| { - expect_ok(config, &["multirust", "override", "nightly"]); - - let expected_override_dir = fs::canonicalize(tempdir.path()).unwrap();; - let expected_toolchain_dir = config.rustupdir.join("toolchains").join("nightly"); - - expect_stdout_ok(config, &["multirust", "show-override"], - "override toolchain: nightly"); - expect_stdout_ok(config, &["multirust", "show-override"], - &format!("override reason: directory override for '{}'", - expected_override_dir.to_string_lossy())); - expect_stdout_ok(config, &["multirust", "show-override"], - &format!("override location: {}", - expected_toolchain_dir.to_string_lossy())); - expect_stdout_ok(config, &["multirust", "show-override"], - "hash-n-2"); - }); - }); -} - -#[test] -fn show_override_no_default() { - setup(&|config| { - expect_stdout_ok(config, &["multirust", "show-override"], - "no override"); - }); -} - -#[test] -fn show_override_show_default() { - setup(&|config| { - expect_ok(config, &["multirust", "default", "nightly"]); - expect_stdout_ok(config, &["multirust", "show-override"], - "no override"); - expect_stdout_ok(config, &["multirust", "show-override"], - "default toolchain: nightly"); - }); -} - -#[test] -fn show_override_from_multirust_toolchain_env_var() { - setup(&|config| { - let tempdir = TempDir::new("multirusT").unwrap(); - change_dir(tempdir.path(), &|| { - - let expected_toolchain_dir = config.rustupdir.join("toolchains").join("beta"); - - expect_ok(config, &["multirust", "update", "beta"]); - expect_ok(config, &["multirust", "override", "nightly"]); - // change_dir has a lock so it's ok to futz the environment - let out = run(config, "multirust", &["show-override"], - &[("RUSTUP_TOOLCHAIN", "beta")]); - assert!(out.ok); - assert!(out.stdout.contains("override toolchain: beta")); - assert!(out.stdout.contains("override reason: environment override")); - assert!(out.stdout.contains(&format!("override location: {}", - expected_toolchain_dir.to_string_lossy()))); - assert!(out.stdout.contains("override toolchain: beta")); - }); - }); -} - #[test] fn remove_override_no_default() { setup(&|config| { - let tempdir = TempDir::new("multirust").unwrap(); + let tempdir = TempDir::new("rustup").unwrap(); change_dir(tempdir.path(), &|| { - expect_ok(config, &["multirust", "override", "nightly"]); - expect_ok(config, &["multirust", "remove-override"]); + expect_ok(config, &["rustup", "override", "add", "nightly"]); + expect_ok(config, &["rustup", "override", "remove"]); expect_err(config, &["rustc"], "no default toolchain configured"); }); @@ -361,11 +278,11 @@ fn remove_override_no_default() { #[test] fn remove_override_with_default() { setup(&|config| { - let tempdir = TempDir::new("multirust").unwrap(); + let tempdir = TempDir::new("rustup").unwrap(); change_dir(tempdir.path(), &|| { - expect_ok(config, &["multirust", "default", "nightly"]); - expect_ok(config, &["multirust", "override", "beta"]); - expect_ok(config, &["multirust", "remove-override"]); + expect_ok(config, &["rustup", "default", "nightly"]); + expect_ok(config, &["rustup", "override", "add", "beta"]); + expect_ok(config, &["rustup", "override", "remove"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-2"); }); }); @@ -374,18 +291,18 @@ fn remove_override_with_default() { #[test] fn remove_override_with_multiple_overrides() { setup(&|config| { - let tempdir1 = TempDir::new("multirust").unwrap(); - let tempdir2 = TempDir::new("multirust").unwrap(); - expect_ok(config, &["multirust", "default", "nightly"]); + let tempdir1 = TempDir::new("rustup").unwrap(); + let tempdir2 = TempDir::new("rustup").unwrap(); + expect_ok(config, &["rustup", "default", "nightly"]); change_dir(tempdir1.path(), &|| { - expect_ok(config, &["multirust", "override", "beta"]); + expect_ok(config, &["rustup", "override", "add", "beta"]); }); change_dir(tempdir2.path(), &|| { - expect_ok(config, &["multirust", "override", "stable"]); + expect_ok(config, &["rustup", "override", "add", "stable"]); }); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-2"); change_dir(tempdir1.path(), &|| { - expect_ok(config, &["multirust", "remove-override"]); + expect_ok(config, &["rustup", "override", "remove"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-2"); }); change_dir(tempdir2.path(), &|| { @@ -397,8 +314,8 @@ fn remove_override_with_multiple_overrides() { #[test] fn no_update_on_channel_when_date_has_not_changed() { setup(&|config| { - expect_ok(config, &["multirust", "update", "nightly"]); - expect_stdout_ok(config, &["multirust", "update", "nightly"], + expect_ok(config, &["rustup", "update", "nightly"]); + expect_stdout_ok(config, &["rustup", "update", "nightly"], "unchanged"); }); } @@ -407,11 +324,11 @@ fn no_update_on_channel_when_date_has_not_changed() { fn update_on_channel_when_date_has_changed() { clitools::setup(Scenario::ArchivesV1, &|config| { set_current_dist_date(config, "2015-01-01"); - expect_ok(config, &["multirust", "default", "nightly"]); + expect_ok(config, &["rustup", "default", "nightly"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-1"); set_current_dist_date(config, "2015-01-02"); - expect_ok(config, &["multirust", "update", "nightly"]); + expect_ok(config, &["rustup", "update", "nightly"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-2"); }); @@ -420,9 +337,9 @@ fn update_on_channel_when_date_has_changed() { #[test] fn run_command() { setup(&|config| { - expect_ok(config, &["multirust", "update", "nightly"]); - expect_ok(config, &["multirust", "default", "beta"]); - expect_stdout_ok(config, &["multirust", "run", "nightly", "rustc" , "--version"], + expect_ok(config, &["rustup", "update", "nightly"]); + expect_ok(config, &["rustup", "default", "beta"]); + expect_stdout_ok(config, &["rustup", "run", "nightly", "rustc" , "--version"], "hash-n-2"); }); } @@ -431,9 +348,9 @@ fn run_command() { fn remove_toolchain_then_add_again() { // Issue brson/multirust #53 setup(&|config| { - expect_ok(config, &["multirust", "default", "beta"]); - expect_ok(config, &["multirust", "remove-toolchain", "beta"]); - expect_ok(config, &["multirust", "update", "beta"]); + expect_ok(config, &["rustup", "default", "beta"]); + expect_ok(config, &["rustup", "toolchain", "remove", "beta"]); + expect_ok(config, &["rustup", "update", "beta"]); expect_ok(config, &["rustc", "--version"]); }); } diff --git a/tests/cli-v2.rs b/tests/cli-v2.rs index 3b89468a62..6e50a72671 100644 --- a/tests/cli-v2.rs +++ b/tests/cli-v2.rs @@ -11,7 +11,7 @@ use tempdir::TempDir; use rustup_mock::clitools::{self, Config, Scenario, expect_ok, expect_stdout_ok, expect_err, expect_stderr_ok, set_current_dist_date, - change_dir, run, this_host_triple}; + change_dir, this_host_triple}; use rustup_dist::dist::TargetTriple; @@ -29,27 +29,10 @@ fn rustc_no_default_toolchain() { }); } -#[test] -fn show_default_no_default_toolchain() { - setup(&|config| { - expect_stdout_ok(config, &["multirust", "show-default"], - "no default toolchain configured"); - }); -} - -#[test] -fn default_toolchain() { - setup(&|config| { - expect_ok(config, &["multirust", "default", "nightly"]); - expect_stdout_ok(config, &["multirust", "show-default"], - "default toolchain: nightly"); - }); -} - #[test] fn expected_bins_exist() { setup(&|config| { - expect_ok(config, &["multirust", "default", "nightly"]); + expect_ok(config, &["rustup", "default", "nightly"]); expect_stdout_ok(config, &["rustc", "--version"], "1.3.0"); }); } @@ -57,11 +40,11 @@ fn expected_bins_exist() { #[test] fn install_toolchain_from_channel() { setup(&|config| { - expect_ok(config, &["multirust", "default", "nightly"]); + expect_ok(config, &["rustup", "default", "nightly"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-2"); - expect_ok(config, &["multirust", "default", "beta"]); + expect_ok(config, &["rustup", "default", "beta"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-b-2"); - expect_ok(config, &["multirust", "default", "stable"]); + expect_ok(config, &["rustup", "default", "stable"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-s-2"); }); } @@ -69,11 +52,11 @@ fn install_toolchain_from_channel() { #[test] fn install_toolchain_from_archive() { clitools::setup(Scenario::ArchivesV2, &|config| { - expect_ok(config, &["multirust", "default" , "nightly-2015-01-01"]); + expect_ok(config, &["rustup", "default" , "nightly-2015-01-01"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-1"); - expect_ok(config, &["multirust", "default" , "beta-2015-01-01"]); + expect_ok(config, &["rustup", "default" , "beta-2015-01-01"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-b-1"); - expect_ok(config, &["multirust", "default" , "stable-2015-01-01"]); + expect_ok(config, &["rustup", "default" , "stable-2015-01-01"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-s-1"); }); } @@ -81,7 +64,7 @@ fn install_toolchain_from_archive() { #[test] fn install_toolchain_from_version() { setup(&|config| { - expect_ok(config, &["multirust", "default" , "1.1.0"]); + expect_ok(config, &["rustup", "default" , "1.1.0"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-s-2"); }); } @@ -89,8 +72,8 @@ fn install_toolchain_from_version() { #[test] fn default_existing_toolchain() { setup(&|config| { - expect_ok(config, &["multirust", "update", "nightly"]); - expect_stderr_ok(config, &["multirust", "default", "nightly"], + expect_ok(config, &["rustup", "update", "nightly"]); + expect_stderr_ok(config, &["rustup", "default", "nightly"], for_host!("using existing install for 'nightly-{0}'")); }); } @@ -99,11 +82,11 @@ fn default_existing_toolchain() { fn update_channel() { clitools::setup(Scenario::ArchivesV2, &|config| { set_current_dist_date(config, "2015-01-01"); - expect_ok(config, &["multirust", "default", "nightly"]); + expect_ok(config, &["rustup", "default", "nightly"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-1"); set_current_dist_date(config, "2015-01-02"); - expect_ok(config, &["multirust", "update", "nightly"]); + expect_ok(config, &["rustup", "update", "nightly"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-2"); }); @@ -112,11 +95,11 @@ fn update_channel() { #[test] fn list_toolchains() { clitools::setup(Scenario::ArchivesV2, &|config| { - expect_ok(config, &["multirust", "update", "nightly"]); - expect_ok(config, &["multirust", "update", "beta-2015-01-01"]); - expect_stdout_ok(config, &["multirust", "list-toolchains"], + expect_ok(config, &["rustup", "update", "nightly"]); + expect_ok(config, &["rustup", "update", "beta-2015-01-01"]); + expect_stdout_ok(config, &["rustup", "toolchain", "list"], "nightly"); - expect_stdout_ok(config, &["multirust", "list-toolchains"], + expect_stdout_ok(config, &["rustup", "toolchain", "list"], "beta-2015-01-01"); }); } @@ -124,7 +107,7 @@ fn list_toolchains() { #[test] fn list_toolchains_with_none() { setup(&|config| { - expect_stdout_ok(config, &["multirust", "list-toolchains"], + expect_stdout_ok(config, &["rustup", "toolchain", "list"], "no installed toolchains"); }); } @@ -132,10 +115,10 @@ fn list_toolchains_with_none() { #[test] fn remove_toolchain() { setup(&|config| { - expect_ok(config, &["multirust", "update", "nightly"]); - expect_ok(config, &["multirust", "remove-toolchain", "nightly"]); - expect_ok(config, &["multirust", "list-toolchains"]); - expect_stdout_ok(config, &["multirust", "list-toolchains"], + expect_ok(config, &["rustup", "update", "nightly"]); + expect_ok(config, &["rustup", "toolchain", "remove", "nightly"]); + expect_ok(config, &["rustup", "toolchain", "list"]); + expect_stdout_ok(config, &["rustup", "toolchain", "list"], "no installed toolchains"); }); } @@ -143,8 +126,8 @@ fn remove_toolchain() { #[test] fn remove_default_toolchain_error_handling() { setup(&|config| { - expect_ok(config, &["multirust", "default", "nightly"]); - expect_ok(config, &["multirust", "remove-toolchain", "nightly"]); + expect_ok(config, &["rustup", "default", "nightly"]); + expect_ok(config, &["rustup", "toolchain", "remove", "nightly"]); expect_err(config, &["rustc"], for_host!("toolchain 'nightly-{0}' is not installed")); }); @@ -153,11 +136,11 @@ fn remove_default_toolchain_error_handling() { #[test] fn remove_override_toolchain_error_handling() { setup(&|config| { - let tempdir = TempDir::new("multirust").unwrap(); + let tempdir = TempDir::new("rustup").unwrap(); change_dir(tempdir.path(), &|| { - expect_ok(config, &["multirust", "default", "nightly"]); - expect_ok(config, &["multirust", "override", "beta"]); - expect_ok(config, &["multirust", "remove-toolchain", "beta"]); + expect_ok(config, &["rustup", "default", "nightly"]); + expect_ok(config, &["rustup", "override", "add", "beta"]); + expect_ok(config, &["rustup", "toolchain", "remove", "beta"]); expect_err(config, &["rustc"], for_host!("toolchain 'beta-{0}' is not installed")); }); @@ -174,7 +157,7 @@ fn bad_sha_on_manifest() { &mut sha_bytes[..10].clone_from_slice(b"aaaaaaaaaa"); let sha_str = String::from_utf8(sha_bytes).unwrap(); rustup_utils::raw::write_file(&sha_file, &sha_str).unwrap(); - expect_err(config, &["multirust", "default", "nightly"], + expect_err(config, &["rustup", "default", "nightly"], "checksum failed"); }); } @@ -190,7 +173,7 @@ fn bad_sha_on_installer() { rustup_utils::raw::write_file(&file.path(), "xxx").unwrap(); } } - expect_err(config, &["multirust", "default", "nightly"], + expect_err(config, &["rustup", "default", "nightly"], "checksum failed"); }); } @@ -198,13 +181,13 @@ fn bad_sha_on_installer() { #[test] fn install_override_toolchain_from_channel() { setup(&|config| { - expect_ok(config, &["multirust", "override", "nightly"]); + expect_ok(config, &["rustup", "override", "add", "nightly"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-2"); - expect_ok(config, &["multirust", "override", "beta"]); + expect_ok(config, &["rustup", "override", "add", "beta"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-b-2"); - expect_ok(config, &["multirust", "override", "stable"]); + expect_ok(config, &["rustup", "override", "add", "stable"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-s-2"); }); @@ -213,13 +196,13 @@ fn install_override_toolchain_from_channel() { #[test] fn install_override_toolchain_from_archive() { clitools::setup(Scenario::ArchivesV2, &|config| { - expect_ok(config, &["multirust", "override", "nightly-2015-01-01"]); + expect_ok(config, &["rustup", "override", "add", "nightly-2015-01-01"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-1"); - expect_ok(config, &["multirust", "override", "beta-2015-01-01"]); + expect_ok(config, &["rustup", "override", "add", "beta-2015-01-01"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-b-1"); - expect_ok(config, &["multirust", "override", "stable-2015-01-01"]); + expect_ok(config, &["rustup", "override", "add", "stable-2015-01-01"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-s-1"); }); @@ -228,7 +211,7 @@ fn install_override_toolchain_from_archive() { #[test] fn install_override_toolchain_from_version() { setup(&|config| { - expect_ok(config, &["multirust", "override", "1.1.0"]); + expect_ok(config, &["rustup", "override", "add", "1.1.0"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-s-2"); }); @@ -237,10 +220,10 @@ fn install_override_toolchain_from_version() { #[test] fn override_overrides_default() { setup(&|config| { - let tempdir = TempDir::new("multirust").unwrap(); - expect_ok(config, &["multirust", "default" , "nightly"]); + let tempdir = TempDir::new("rustup").unwrap(); + expect_ok(config, &["rustup", "default" , "nightly"]); change_dir(tempdir.path(), &|| { - expect_ok(config, &["multirust", "override" , "beta"]); + expect_ok(config, &["rustup", "override" , "add", "beta"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-b-2"); }); }); @@ -249,15 +232,15 @@ fn override_overrides_default() { #[test] fn multiple_overrides() { setup(&|config| { - let tempdir1 = TempDir::new("multirust").unwrap(); - let tempdir2 = TempDir::new("multirust").unwrap(); + let tempdir1 = TempDir::new("rustup").unwrap(); + let tempdir2 = TempDir::new("rustup").unwrap(); - expect_ok(config, &["multirust", "default", "nightly"]); + expect_ok(config, &["rustup", "default", "nightly"]); change_dir(tempdir1.path(), &|| { - expect_ok(config, &["multirust", "override", "beta"]); + expect_ok(config, &["rustup", "override", "add", "beta"]); }); change_dir(tempdir2.path(), &|| { - expect_ok(config, &["multirust", "override", "stable"]); + expect_ok(config, &["rustup", "override", "add", "stable"]); }); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-2"); @@ -302,88 +285,22 @@ fn override_windows_root() { #[test] fn change_override() { setup(&|config| { - let tempdir = TempDir::new("multirust").unwrap(); + let tempdir = TempDir::new("rustup").unwrap(); change_dir(tempdir.path(), &|| { - expect_ok(config, &["multirust", "override", "nightly"]); - expect_ok(config, &["multirust", "override", "beta"]); + expect_ok(config, &["rustup", "override", "add", "nightly"]); + expect_ok(config, &["rustup", "override", "add", "beta"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-b-2"); }); }); } -#[test] -fn show_override() { - setup(&|config| { - let tempdir = TempDir::new("multirust").unwrap(); - change_dir(tempdir.path(), &|| { - expect_ok(config, &["multirust", "override", "nightly"]); - - let expected_override_dir = fs::canonicalize(tempdir.path()).unwrap();; - let expected_toolchain_dir = config.rustupdir.join("toolchains").join("nightly"); - - expect_stdout_ok(config, &["multirust", "show-override"], - "override toolchain: nightly"); - expect_stdout_ok(config, &["multirust", "show-override"], - &format!("override reason: directory override for '{}'", - expected_override_dir.to_string_lossy())); - expect_stdout_ok(config, &["multirust", "show-override"], - &format!("override location: {}", - expected_toolchain_dir.to_string_lossy())); - expect_stdout_ok(config, &["multirust", "show-override"], - "hash-n-2"); - }); - }); -} - -#[test] -fn show_override_no_default() { - setup(&|config| { - expect_stdout_ok(config, &["multirust", "show-override"], - "no override"); - }); -} - -#[test] -fn show_override_show_default() { - setup(&|config| { - expect_ok(config, &["multirust", "default", "nightly"]); - expect_stdout_ok(config, &["multirust", "show-override"], - "no override"); - expect_stdout_ok(config, &["multirust", "show-override"], - "default toolchain: nightly"); - }); -} - -#[test] -fn show_override_from_multirust_toolchain_env_var() { - setup(&|config| { - let tempdir = TempDir::new("multirusT").unwrap(); - change_dir(tempdir.path(), &|| { - - let expected_toolchain_dir = config.rustupdir.join("toolchains").join("beta"); - - expect_ok(config, &["multirust", "update", "beta"]); - expect_ok(config, &["multirust", "override", "nightly"]); - // change_dir has a lock so it's ok to futz the environment - let out = run(config, "multirust", &["show-override"], - &[("RUSTUP_TOOLCHAIN", "beta")]); - assert!(out.ok); - assert!(out.stdout.contains("override toolchain: beta")); - assert!(out.stdout.contains("override reason: environment override")); - assert!(out.stdout.contains(&format!("override location: {}", - expected_toolchain_dir.to_string_lossy()))); - assert!(out.stdout.contains("override toolchain: beta")); - }); - }); -} - #[test] fn remove_override_no_default() { setup(&|config| { - let tempdir = TempDir::new("multirust").unwrap(); + let tempdir = TempDir::new("rustup").unwrap(); change_dir(tempdir.path(), &|| { - expect_ok(config, &["multirust", "override", "nightly"]); - expect_ok(config, &["multirust", "remove-override"]); + expect_ok(config, &["rustup", "override", "add", "nightly"]); + expect_ok(config, &["rustup", "override", "remove"]); expect_err(config, &["rustc"], "no default toolchain configured"); }); @@ -393,11 +310,11 @@ fn remove_override_no_default() { #[test] fn remove_override_with_default() { setup(&|config| { - let tempdir = TempDir::new("multirust").unwrap(); + let tempdir = TempDir::new("rustup").unwrap(); change_dir(tempdir.path(), &|| { - expect_ok(config, &["multirust", "default", "nightly"]); - expect_ok(config, &["multirust", "override", "beta"]); - expect_ok(config, &["multirust", "remove-override"]); + expect_ok(config, &["rustup", "default", "nightly"]); + expect_ok(config, &["rustup", "override", "add", "beta"]); + expect_ok(config, &["rustup", "override", "remove"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-2"); }); }); @@ -406,18 +323,18 @@ fn remove_override_with_default() { #[test] fn remove_override_with_multiple_overrides() { setup(&|config| { - let tempdir1 = TempDir::new("multirust").unwrap(); - let tempdir2 = TempDir::new("multirust").unwrap(); - expect_ok(config, &["multirust", "default", "nightly"]); + let tempdir1 = TempDir::new("rustup").unwrap(); + let tempdir2 = TempDir::new("rustup").unwrap(); + expect_ok(config, &["rustup", "default", "nightly"]); change_dir(tempdir1.path(), &|| { - expect_ok(config, &["multirust", "override", "beta"]); + expect_ok(config, &["rustup", "override", "add", "beta"]); }); change_dir(tempdir2.path(), &|| { - expect_ok(config, &["multirust", "override", "stable"]); + expect_ok(config, &["rustup", "override", "add", "stable"]); }); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-2"); change_dir(tempdir1.path(), &|| { - expect_ok(config, &["multirust", "remove-override"]); + expect_ok(config, &["rustup", "override", "remove"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-2"); }); change_dir(tempdir2.path(), &|| { @@ -429,8 +346,8 @@ fn remove_override_with_multiple_overrides() { #[test] fn no_update_on_channel_when_date_has_not_changed() { setup(&|config| { - expect_ok(config, &["multirust", "update", "nightly"]); - expect_stdout_ok(config, &["multirust", "update", "nightly"], + expect_ok(config, &["rustup", "update", "nightly"]); + expect_stdout_ok(config, &["rustup", "update", "nightly"], "unchanged"); }); } @@ -439,11 +356,11 @@ fn no_update_on_channel_when_date_has_not_changed() { fn update_on_channel_when_date_has_changed() { clitools::setup(Scenario::ArchivesV2, &|config| { set_current_dist_date(config, "2015-01-01"); - expect_ok(config, &["multirust", "default", "nightly"]); + expect_ok(config, &["rustup", "default", "nightly"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-1"); set_current_dist_date(config, "2015-01-02"); - expect_ok(config, &["multirust", "update", "nightly"]); + expect_ok(config, &["rustup", "update", "nightly"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-2"); }); @@ -452,9 +369,9 @@ fn update_on_channel_when_date_has_changed() { #[test] fn run_command() { setup(&|config| { - expect_ok(config, &["multirust", "update", "nightly"]); - expect_ok(config, &["multirust", "default", "beta"]); - expect_stdout_ok(config, &["multirust", "run", "nightly", "rustc" , "--version"], + expect_ok(config, &["rustup", "update", "nightly"]); + expect_ok(config, &["rustup", "default", "beta"]); + expect_stdout_ok(config, &["rustup", "run", "nightly", "rustc" , "--version"], "hash-n-2"); }); } @@ -463,9 +380,9 @@ fn run_command() { fn remove_toolchain_then_add_again() { // Issue brson/multirust #53 setup(&|config| { - expect_ok(config, &["multirust", "default", "beta"]); - expect_ok(config, &["multirust", "remove-toolchain", "beta"]); - expect_ok(config, &["multirust", "update", "beta"]); + expect_ok(config, &["rustup", "default", "beta"]); + expect_ok(config, &["rustup", "toolchain", "remove", "beta"]); + expect_ok(config, &["rustup", "update", "beta"]); expect_ok(config, &["rustc", "--version"]); }); } @@ -476,9 +393,9 @@ fn upgrade_v1_to_v2() { set_current_dist_date(config, "2015-01-01"); // Delete the v2 manifest so the first day we install from the v1s fs::remove_file(config.distdir.join("dist/channel-rust-nightly.toml.sha256")).unwrap(); - expect_ok(config, &["multirust", "default", "nightly"]); + expect_ok(config, &["rustup", "default", "nightly"]); set_current_dist_date(config, "2015-01-02"); - expect_ok(config, &["multirust", "update", "nightly"]); + expect_ok(config, &["rustup", "update", "nightly"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-2"); }); @@ -488,10 +405,10 @@ fn upgrade_v1_to_v2() { fn upgrade_v2_to_v1() { clitools::setup(Scenario::Full, &|config| { set_current_dist_date(config, "2015-01-01"); - expect_ok(config, &["multirust", "default", "nightly"]); + expect_ok(config, &["rustup", "default", "nightly"]); set_current_dist_date(config, "2015-01-02"); fs::remove_file(config.distdir.join("dist/channel-rust-nightly.toml.sha256")).unwrap(); - expect_err(config, &["multirust", "update", "nightly"], + expect_err(config, &["rustup", "update", "nightly"], "the server unexpectedly provided an obsolete version of the distribution manifest"); }); } @@ -499,7 +416,7 @@ fn upgrade_v2_to_v1() { #[test] fn list_targets_no_toolchain() { setup(&|config| { - expect_err(config, &["multirust", "list-targets", "nightly"], + expect_err(config, &["rustup", "target", "list", "--toolchain=nightly"], for_host!("toolchain 'nightly-{0}' is not installed")); }); } @@ -507,8 +424,8 @@ fn list_targets_no_toolchain() { #[test] fn list_targets_v1_toolchain() { clitools::setup(Scenario::SimpleV1, &|config| { - expect_ok(config, &["multirust", "update", "nightly"]); - expect_err(config, &["multirust", "list-targets", "nightly"], + expect_ok(config, &["rustup", "update", "nightly"]); + expect_err(config, &["rustup", "target", "list", "--toolchain=nightly"], for_host!("toolchain 'nightly-{0}' does not support components")); }); } @@ -518,9 +435,10 @@ fn list_targets_custom_toolchain() { setup(&|config| { let path = config.customdir.join("custom-1"); let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "update", "default-from-path", - "--copy-local", &path]); - expect_err(config, &["multirust", "list-targets", "default-from-path"], + expect_ok(config, &["rustup", "toolchain", "link", "default-from-path", + &path]); + expect_ok(config, &["rustup", "default", "default-from-path"]); + expect_err(config, &["rustup", "target", "list"], "toolchain 'default-from-path' does not support components"); }); } @@ -528,10 +446,10 @@ fn list_targets_custom_toolchain() { #[test] fn list_targets() { setup(&|config| { - expect_ok(config, &["multirust", "default", "nightly"]); - expect_stdout_ok(config, &["multirust", "list-targets", "nightly"], + expect_ok(config, &["rustup", "default", "nightly"]); + expect_stdout_ok(config, &["rustup", "target", "list"], clitools::CROSS_ARCH1); - expect_stdout_ok(config, &["multirust", "list-targets", "nightly"], + expect_stdout_ok(config, &["rustup", "target", "list"], clitools::CROSS_ARCH2); }); } @@ -539,8 +457,8 @@ fn list_targets() { #[test] fn add_target() { setup(&|config| { - expect_ok(config, &["multirust", "default", "nightly"]); - expect_ok(config, &["multirust", "add-target", "nightly", clitools::CROSS_ARCH1]); + expect_ok(config, &["rustup", "default", "nightly"]); + expect_ok(config, &["rustup", "target", "add", clitools::CROSS_ARCH1]); let path = format!("toolchains/nightly-{}/lib/rustlib/{}/lib/libstd.rlib", this_host_triple(), clitools::CROSS_ARCH1); assert!(config.rustupdir.join(path).exists()); @@ -550,15 +468,15 @@ fn add_target() { #[test] fn add_target_no_toolchain() { setup(&|config| { - expect_err(config, &["multirust", "add-target", "nightly", clitools::CROSS_ARCH1], + expect_err(config, &["rustup", "target", "add", clitools::CROSS_ARCH1, "--toolchain=nightly"], for_host!("toolchain 'nightly-{0}' is not installed")); }); } #[test] fn add_target_bogus() { setup(&|config| { - expect_ok(config, &["multirust", "default", "nightly"]); - expect_err(config, &["multirust", "add-target", "nightly", "bogus"], + expect_ok(config, &["rustup", "default", "nightly"]); + expect_err(config, &["rustup", "target", "add", "bogus"], "does not contain component 'rust-std' for target 'bogus'"); }); } @@ -566,8 +484,8 @@ fn add_target_bogus() { #[test] fn add_target_v1_toolchain() { clitools::setup(Scenario::SimpleV1, &|config| { - expect_ok(config, &["multirust", "update", "nightly"]); - expect_err(config, &["multirust", "add-target", "nightly", clitools::CROSS_ARCH1], + expect_ok(config, &["rustup", "update", "nightly"]); + expect_err(config, &["rustup", "target", "add", clitools::CROSS_ARCH1, "--toolchain=nightly"], for_host!("toolchain 'nightly-{0}' does not support components")); }); } @@ -577,9 +495,10 @@ fn add_target_custom_toolchain() { setup(&|config| { let path = config.customdir.join("custom-1"); let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "update", "default-from-path", - "--copy-local", &path]); - expect_err(config, &["multirust", "add-target", "default-from-path", clitools::CROSS_ARCH1], + expect_ok(config, &["rustup", "toolchain", "link", "default-from-path", + &path]); + expect_ok(config, &["rustup", "default", "default-from-path"]); + expect_err(config, &["rustup", "target", "add", clitools::CROSS_ARCH1], "toolchain 'default-from-path' does not support components"); }); } @@ -587,9 +506,9 @@ fn add_target_custom_toolchain() { #[test] fn add_target_again() { setup(&|config| { - expect_ok(config, &["multirust", "default", "nightly"]); - expect_ok(config, &["multirust", "add-target", "nightly", clitools::CROSS_ARCH1]); - expect_stderr_ok(config, &["multirust", "add-target", "nightly", clitools::CROSS_ARCH1], + expect_ok(config, &["rustup", "default", "nightly"]); + expect_ok(config, &["rustup", "target", "add", clitools::CROSS_ARCH1]); + expect_stderr_ok(config, &["rustup", "target", "add", clitools::CROSS_ARCH1], &format!("component 'rust-std' for target '{}' is up to date", clitools::CROSS_ARCH1)); let path = format!("toolchains/nightly-{}/lib/rustlib/{}/lib/libstd.rlib", @@ -602,8 +521,8 @@ fn add_target_again() { fn add_target_host() { setup(&|config| { let trip = TargetTriple::from_host(); - expect_ok(config, &["multirust", "default", "nightly"]); - expect_err(config, &["multirust", "add-target", "nightly", &trip.to_string()], + expect_ok(config, &["rustup", "default", "nightly"]); + expect_err(config, &["rustup", "target", "add", &trip.to_string()], for_host!("component 'rust-std' for target '{0}' is required for toolchain 'nightly-{0}' and cannot be re-added")); }); } @@ -611,9 +530,9 @@ fn add_target_host() { #[test] fn remove_target() { setup(&|config| { - expect_ok(config, &["multirust", "default", "nightly"]); - expect_ok(config, &["multirust", "add-target", "nightly", clitools::CROSS_ARCH1]); - expect_ok(config, &["multirust", "remove-target", "nightly", clitools::CROSS_ARCH1]); + expect_ok(config, &["rustup", "default", "nightly"]); + expect_ok(config, &["rustup", "target", "add", clitools::CROSS_ARCH1]); + expect_ok(config, &["rustup", "target", "remove", clitools::CROSS_ARCH1]); let path = format!("toolchains/nightly-{}/lib/rustlib/{}/lib/libstd.rlib", this_host_triple(), clitools::CROSS_ARCH1); assert!(!config.rustupdir.join(path).exists()); @@ -623,8 +542,8 @@ fn remove_target() { #[test] fn remove_target_not_installed() { setup(&|config| { - expect_ok(config, &["multirust", "default", "nightly"]); - expect_err(config, &["multirust", "remove-target", "nightly", clitools::CROSS_ARCH1], + expect_ok(config, &["rustup", "default", "nightly"]); + expect_err(config, &["rustup", "target", "remove", clitools::CROSS_ARCH1], &format!("toolchain 'nightly-{}' does not contain component 'rust-std' for target '{}'", this_host_triple(), clitools::CROSS_ARCH1)); }); @@ -633,7 +552,7 @@ fn remove_target_not_installed() { #[test] fn remove_target_no_toolchain() { setup(&|config| { - expect_err(config, &["multirust", "remove-target", "nightly", clitools::CROSS_ARCH1], + expect_err(config, &["rustup", "target", "remove", clitools::CROSS_ARCH1, "--toolchain=nightly"], for_host!("toolchain 'nightly-{0}' is not installed")); }); } @@ -641,8 +560,8 @@ fn remove_target_no_toolchain() { #[test] fn remove_target_bogus() { setup(&|config| { - expect_ok(config, &["multirust", "default", "nightly"]); - expect_err(config, &["multirust", "remove-target", "nightly", "bogus"], + expect_ok(config, &["rustup", "default", "nightly"]); + expect_err(config, &["rustup", "target", "remove", "bogus"], "does not contain component 'rust-std' for target 'bogus'"); }); } @@ -650,8 +569,8 @@ fn remove_target_bogus() { #[test] fn remove_target_v1_toolchain() { clitools::setup(Scenario::SimpleV1, &|config| { - expect_ok(config, &["multirust", "update", "nightly"]); - expect_err(config, &["multirust", "remove-target", "nightly", clitools::CROSS_ARCH1], + expect_ok(config, &["rustup", "default", "nightly"]); + expect_err(config, &["rustup", "target", "remove", clitools::CROSS_ARCH1, "--toolchain=nightly"], for_host!("toolchain 'nightly-{0}' does not support components")); }); } @@ -661,9 +580,10 @@ fn remove_target_custom_toolchain() { setup(&|config| { let path = config.customdir.join("custom-1"); let path = path.to_string_lossy(); - expect_ok(config, &["multirust", "update", "default-from-path", - "--copy-local", &path]); - expect_err(config, &["multirust", "remove-target", "default-from-path", clitools::CROSS_ARCH1], + expect_ok(config, &["rustup", "toolchain", "link", "default-from-path", + &path]); + expect_ok(config, &["rustup", "default", "default-from-path"]); + expect_err(config, &["rustup", "target", "remove", clitools::CROSS_ARCH1], "toolchain 'default-from-path' does not support components"); }); } @@ -671,10 +591,10 @@ fn remove_target_custom_toolchain() { #[test] fn remove_target_again() { setup(&|config| { - expect_ok(config, &["multirust", "default", "nightly"]); - expect_ok(config, &["multirust", "add-target", "nightly", clitools::CROSS_ARCH1]); - expect_ok(config, &["multirust", "remove-target", "nightly", clitools::CROSS_ARCH1]); - expect_err(config, &["multirust", "remove-target", "nightly", clitools::CROSS_ARCH1], + expect_ok(config, &["rustup", "default", "nightly"]); + expect_ok(config, &["rustup", "target", "add", clitools::CROSS_ARCH1]); + expect_ok(config, &["rustup", "target", "remove", clitools::CROSS_ARCH1]); + expect_err(config, &["rustup", "target", "remove", clitools::CROSS_ARCH1], &format!("toolchain 'nightly-{}' does not contain component 'rust-std' for target '{}'", this_host_triple(), clitools::CROSS_ARCH1)); }); @@ -684,8 +604,8 @@ fn remove_target_again() { fn remove_target_host() { setup(&|config| { let trip = TargetTriple::from_host(); - expect_ok(config, &["multirust", "default", "nightly"]); - expect_err(config, &["multirust", "remove-target", "nightly", &trip.to_string()], + expect_ok(config, &["rustup", "default", "nightly"]); + expect_err(config, &["rustup", "target", "remove", &trip.to_string()], for_host!("component 'rust-std' for target '{0}' is required for toolchain 'nightly-{0}' and cannot be removed")); }); } @@ -716,7 +636,7 @@ fn update_unavailable_std() { setup(&|config| { let ref trip = TargetTriple::from_host(); make_component_unavailable(config, "rust-std", trip); - expect_err(config, &["multirust", "update", "nightly"], + expect_err(config, &["rustup", "update", "nightly"], &format!("component 'rust-std' for '{}' is unavailable for download", trip)); }); }