From 999e1c5c11c71978e8e11b2b1e95466fa17be3a9 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 13 Apr 2016 18:03:11 +0000 Subject: [PATCH 1/2] Rename crates to rustup_* --- Cargo.lock | 110 +++++++++--------- Cargo.toml | 14 +-- appveyor.yml | 2 +- ci/run.sh | 2 +- src/{multirust-cli => rustup-cli}/cli.rs | 0 src/{multirust-cli => rustup-cli}/common.rs | 10 +- .../download_tracker.rs | 6 +- src/{multirust-cli => rustup-cli}/job.rs | 0 src/{multirust-cli => rustup-cli}/log.rs | 0 src/{multirust-cli => rustup-cli}/main.rs | 8 +- .../multirust_mode.rs | 6 +- .../proxy_mode.rs | 4 +- .../rustup_mode.rs | 8 +- .../self_update.rs | 14 +-- .../setup_mode.rs | 2 +- src/{multirust-cli => rustup-cli}/term2.rs | 0 src/{multirust-cli => rustup-cli}/tty.rs | 0 .../Cargo.toml | 8 +- src/{multirust-dist => rustup-dist}/build.rs | 0 .../src/component/components.rs | 4 +- .../src/component/mod.rs | 0 .../src/component/package.rs | 2 +- .../src/component/transaction.rs | 18 +-- .../src/config.rs | 0 .../src/dist.rs | 6 +- .../src/download.rs | 2 +- .../src/errors.rs | 18 +-- .../src/lib.rs | 2 +- .../src/manifest.rs | 0 .../src/manifestation.rs | 2 +- .../src/prefix.rs | 0 .../src/temp.rs | 4 +- .../src/toml_utils.rs | 0 .../tests/channel-rust-nightly-example.toml | 0 .../tests/channel-rust-nightly-example2.toml | 0 .../tests/dist.rs | 28 ++--- .../tests/install.rs | 24 ++-- .../tests/manifest.rs | 8 +- .../tests/transactions.rs | 18 +-- .../Cargo.toml | 2 +- .../src/clitools.rs | 0 .../src/dist.rs | 0 .../src/lib.rs | 0 .../Cargo.toml | 2 +- .../src/errors.rs | 0 .../src/lib.rs | 0 .../src/notify.rs | 0 .../src/raw.rs | 0 .../src/utils.rs | 0 src/{multirust => rustup}/config.rs | 6 +- src/{multirust => rustup}/env_var.rs | 0 src/{multirust => rustup}/errors.rs | 24 ++-- src/{multirust => rustup}/install.rs | 12 +- src/{multirust => rustup}/lib.rs | 6 +- src/{multirust => rustup}/override_db.rs | 4 +- src/{multirust => rustup}/rust-key.gpg.ascii | 0 src/{multirust => rustup}/toolchain.rs | 14 +-- tests/cli-exact.rs | 6 +- tests/cli-misc.rs | 16 +-- tests/cli-rustup.rs | 8 +- tests/cli-self-update.rs | 14 +-- tests/cli-v1.rs | 14 +-- tests/cli-v2.rs | 24 ++-- 63 files changed, 241 insertions(+), 241 deletions(-) rename src/{multirust-cli => rustup-cli}/cli.rs (100%) rename src/{multirust-cli => rustup-cli}/common.rs (96%) rename src/{multirust-cli => rustup-cli}/download_tracker.rs (98%) rename src/{multirust-cli => rustup-cli}/job.rs (100%) rename src/{multirust-cli => rustup-cli}/log.rs (100%) rename src/{multirust-cli => rustup-cli}/main.rs (97%) rename src/{multirust-cli => rustup-cli}/multirust_mode.rs (99%) rename src/{multirust-cli => rustup-cli}/proxy_mode.rs (92%) rename src/{multirust-cli => rustup-cli}/rustup_mode.rs (98%) rename src/{multirust-cli => rustup-cli}/self_update.rs (99%) rename src/{multirust-cli => rustup-cli}/setup_mode.rs (98%) rename src/{multirust-cli => rustup-cli}/term2.rs (100%) rename src/{multirust-cli => rustup-cli}/tty.rs (100%) rename src/{multirust-dist => rustup-dist}/Cargo.toml (80%) rename src/{multirust-dist => rustup-dist}/build.rs (100%) rename src/{multirust-dist => rustup-dist}/src/component/components.rs (98%) rename src/{multirust-dist => rustup-dist}/src/component/mod.rs (100%) rename src/{multirust-dist => rustup-dist}/src/component/package.rs (99%) rename src/{multirust-dist => rustup-dist}/src/component/transaction.rs (93%) rename src/{multirust-dist => rustup-dist}/src/config.rs (100%) rename src/{multirust-dist => rustup-dist}/src/dist.rs (98%) rename src/{multirust-dist => rustup-dist}/src/download.rs (99%) rename src/{multirust-dist => rustup-dist}/src/errors.rs (96%) rename src/{multirust-dist => rustup-dist}/src/lib.rs (93%) rename src/{multirust-dist => rustup-dist}/src/manifest.rs (100%) rename src/{multirust-dist => rustup-dist}/src/manifestation.rs (99%) rename src/{multirust-dist => rustup-dist}/src/prefix.rs (100%) rename src/{multirust-dist => rustup-dist}/src/temp.rs (98%) rename src/{multirust-dist => rustup-dist}/src/toml_utils.rs (100%) rename src/{multirust-dist => rustup-dist}/tests/channel-rust-nightly-example.toml (100%) rename src/{multirust-dist => rustup-dist}/tests/channel-rust-nightly-example2.toml (100%) rename src/{multirust-dist => rustup-dist}/tests/dist.rs (98%) rename src/{multirust-dist => rustup-dist}/tests/install.rs (96%) rename src/{multirust-dist => rustup-dist}/tests/manifest.rs (95%) rename src/{multirust-dist => rustup-dist}/tests/transactions.rs (98%) rename src/{multirust-mock => rustup-mock}/Cargo.toml (95%) rename src/{multirust-mock => rustup-mock}/src/clitools.rs (100%) rename src/{multirust-mock => rustup-mock}/src/dist.rs (100%) rename src/{multirust-mock => rustup-mock}/src/lib.rs (100%) rename src/{multirust-utils => rustup-utils}/Cargo.toml (98%) rename src/{multirust-utils => rustup-utils}/src/errors.rs (100%) rename src/{multirust-utils => rustup-utils}/src/lib.rs (100%) rename src/{multirust-utils => rustup-utils}/src/notify.rs (100%) rename src/{multirust-utils => rustup-utils}/src/raw.rs (100%) rename src/{multirust-utils => rustup-utils}/src/utils.rs (100%) rename src/{multirust => rustup}/config.rs (98%) rename src/{multirust => rustup}/env_var.rs (100%) rename src/{multirust => rustup}/errors.rs (94%) rename src/{multirust => rustup}/install.rs (91%) rename src/{multirust => rustup}/lib.rs (70%) rename src/{multirust => rustup}/override_db.rs (98%) rename src/{multirust => rustup}/rust-key.gpg.ascii (100%) rename src/{multirust => rustup}/toolchain.rs (97%) diff --git a/Cargo.lock b/Cargo.lock index 38ae1520e7..88ef6a30e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,5 @@ [root] -name = "multirust-rs" +name = "rustup" version = "0.1.6" dependencies = [ "clap 2.2.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -8,12 +8,12 @@ dependencies = [ "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "multirust-dist 0.1.6", - "multirust-mock 0.1.6", - "multirust-utils 0.1.6", "openssl 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.1.66 (registry+https://github.com/rust-lang/crates.io-index)", + "rustup-dist 0.1.6", + "rustup-mock 0.1.6", + "rustup-utils 0.1.6", "scopeguard 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -238,57 +238,6 @@ dependencies = [ "libc 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "multirust-dist" -version = "0.1.6" -dependencies = [ - "flate2 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "multirust-mock 0.1.6", - "multirust-utils 0.1.6", - "ole32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.1.66 (registry+https://github.com/rust-lang/crates.io-index)", - "tar 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tempdir 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "multirust-mock" -version = "0.1.6" -dependencies = [ - "flate2 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tar 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tempdir 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "multirust-utils" -version = "0.1.6" -dependencies = [ - "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "ole32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "shell32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "userenv-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winreg 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "num" version = "0.1.32" @@ -424,6 +373,57 @@ dependencies = [ "semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rustup-dist" +version = "0.1.6" +dependencies = [ + "flate2 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "ole32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.66 (registry+https://github.com/rust-lang/crates.io-index)", + "rustup-mock 0.1.6", + "rustup-utils 0.1.6", + "tar 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tempdir 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustup-mock" +version = "0.1.6" +dependencies = [ + "flate2 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tar 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tempdir 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustup-utils" +version = "0.1.6" +dependencies = [ + "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ole32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "shell32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "userenv-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winreg 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "scopeguard" version = "0.1.2" diff --git a/Cargo.toml b/Cargo.toml index 0dd7d17941..4f188af674 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "multirust-rs" +name = "rustup" version = "0.1.6" authors = [ "Diggory Blake " ] description = "multirust in rust - manage multiple rust installations with ease" @@ -16,8 +16,8 @@ keywords = ["multirust", "install", "proxy"] license = "MIT OR Apache-2.0" [dependencies] -multirust-dist = { path = "src/multirust-dist" } -multirust-utils = { path = "src/multirust-utils" } +rustup-dist = { path = "src/rustup-dist" } +rustup-utils = { path = "src/rustup-utils" } clap = "2.2.4" regex = "0.1.41" openssl = "0.7.2" @@ -55,15 +55,15 @@ user32-sys = "0.1.2" kernel32-sys = "0.2.1" [dev-dependencies] -multirust-mock = { path = "src/multirust-mock" } +rustup-mock = { path = "src/rustup-mock" } lazy_static = "0.1.15" [lib] -name = "multirust" -path = "src/multirust/lib.rs" +name = "rustup" +path = "src/rustup/lib.rs" test = false # no unit tests [[bin]] name = "rustup-setup" -path = "src/multirust-cli/main.rs" +path = "src/rustup-cli/main.rs" test = false # no unit tests diff --git a/appveyor.yml b/appveyor.yml index 1eb3fc97f7..c99d7d6763 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -43,7 +43,7 @@ build: false test_script: - cargo build --release - - cargo test --release -p multirust-dist + - cargo test --release -p rustup-dist - cargo test --release notifications: diff --git a/ci/run.sh b/ci/run.sh index e164abb229..7f10ff39b7 100644 --- a/ci/run.sh +++ b/ci/run.sh @@ -5,6 +5,6 @@ set -ex cargo build --release --target $TARGET if [ -z "$SKIP_TESTS" ]; then - cargo test --release -p multirust-dist --target $TARGET + cargo test --release -p rustup-dist --target $TARGET cargo test --release --target $TARGET fi diff --git a/src/multirust-cli/cli.rs b/src/rustup-cli/cli.rs similarity index 100% rename from src/multirust-cli/cli.rs rename to src/rustup-cli/cli.rs diff --git a/src/multirust-cli/common.rs b/src/rustup-cli/common.rs similarity index 96% rename from src/multirust-cli/common.rs rename to src/rustup-cli/common.rs index 787f01cae2..179a343218 100644 --- a/src/multirust-cli/common.rs +++ b/src/rustup-cli/common.rs @@ -1,8 +1,8 @@ //! Just a dumping ground for cli stuff -use multirust::{Cfg, Result, Notification, Toolchain, Error, UpdateStatus}; -use multirust_utils::{self, utils}; -use multirust_utils::notify::NotificationLevel; +use rustup::{Cfg, Result, Notification, Toolchain, Error, UpdateStatus}; +use rustup_utils::{self, utils}; +use rustup_utils::notify::NotificationLevel; use self_update; use std::ffi::OsStr; use std::io::{Write, Read, BufRead}; @@ -83,9 +83,9 @@ pub fn run_inner>(mut command: Command, process::exit(code); } Err(e) => { - Err(multirust_utils::Error::RunningCommand { + Err(rustup_utils::Error::RunningCommand { name: args[0].as_ref().to_owned(), - error: multirust_utils::raw::CommandError::Io(e), + error: rustup_utils::raw::CommandError::Io(e), }.into()) } } diff --git a/src/multirust-cli/download_tracker.rs b/src/rustup-cli/download_tracker.rs similarity index 98% rename from src/multirust-cli/download_tracker.rs rename to src/rustup-cli/download_tracker.rs index dd9ad949ba..d88a741f66 100644 --- a/src/multirust-cli/download_tracker.rs +++ b/src/rustup-cli/download_tracker.rs @@ -2,9 +2,9 @@ use std::collections::VecDeque; use std::fmt; use term; use time::precise_time_s; -use multirust::Notification; -use multirust_dist::Notification as In; -use multirust_utils::Notification as Un; +use rustup::Notification; +use rustup_dist::Notification as In; +use rustup_utils::Notification as Un; use tty; /// Keep track of this many past download amounts diff --git a/src/multirust-cli/job.rs b/src/rustup-cli/job.rs similarity index 100% rename from src/multirust-cli/job.rs rename to src/rustup-cli/job.rs diff --git a/src/multirust-cli/log.rs b/src/rustup-cli/log.rs similarity index 100% rename from src/multirust-cli/log.rs rename to src/rustup-cli/log.rs diff --git a/src/multirust-cli/main.rs b/src/rustup-cli/main.rs similarity index 97% rename from src/multirust-cli/main.rs rename to src/rustup-cli/main.rs index 29760d4313..b1a3e05486 100644 --- a/src/multirust-cli/main.rs +++ b/src/rustup-cli/main.rs @@ -1,13 +1,13 @@ -extern crate multirust_dist; +extern crate rustup_dist; #[macro_use] -extern crate multirust_utils; +extern crate rustup_utils; #[macro_use] extern crate clap; extern crate regex; extern crate hyper; #[macro_use] -extern crate multirust; +extern crate rustup; extern crate term; extern crate openssl; extern crate itertools; @@ -42,7 +42,7 @@ mod term2; use std::env; use std::path::PathBuf; -use multirust::{Error, Result}; +use rustup::{Error, Result}; fn main() { if let Err(e) = run_multirust() { diff --git a/src/multirust-cli/multirust_mode.rs b/src/rustup-cli/multirust_mode.rs similarity index 99% rename from src/multirust-cli/multirust_mode.rs rename to src/rustup-cli/multirust_mode.rs index 548aa517f3..94872b663b 100644 --- a/src/multirust-cli/multirust_mode.rs +++ b/src/rustup-cli/multirust_mode.rs @@ -3,9 +3,9 @@ use cli; use common::{self, confirm, set_globals, run_inner, show_channel_update, show_tool_versions, update_all_channels}; -use multirust::*; -use multirust_dist::manifest::Component; -use multirust_dist::dist::TargetTriple; +use rustup::*; +use rustup_dist::manifest::Component; +use rustup_dist::dist::TargetTriple; use self_update; use std::env; use std::path::{Path, PathBuf}; diff --git a/src/multirust-cli/proxy_mode.rs b/src/rustup-cli/proxy_mode.rs similarity index 92% rename from src/multirust-cli/proxy_mode.rs rename to src/rustup-cli/proxy_mode.rs index 66011cac56..8e12c0ba69 100644 --- a/src/multirust-cli/proxy_mode.rs +++ b/src/rustup-cli/proxy_mode.rs @@ -1,6 +1,6 @@ use common::{run_inner, set_globals}; -use multirust::{Cfg, Result, Error}; -use multirust_utils::utils; +use rustup::{Cfg, Result, Error}; +use rustup_utils::utils; use std::env; use std::path::PathBuf; use job; diff --git a/src/multirust-cli/rustup_mode.rs b/src/rustup-cli/rustup_mode.rs similarity index 98% rename from src/multirust-cli/rustup_mode.rs rename to src/rustup-cli/rustup_mode.rs index cfbf890627..bb66b3fe81 100644 --- a/src/multirust-cli/rustup_mode.rs +++ b/src/rustup-cli/rustup_mode.rs @@ -1,9 +1,9 @@ use clap::{App, Arg, AppSettings, SubCommand, ArgMatches}; use common; -use multirust::{Result, Cfg, Error, Toolchain}; -use multirust_dist::manifest::Component; -use multirust_dist::dist::TargetTriple; -use multirust_utils::utils; +use rustup::{Result, Cfg, Error, Toolchain}; +use rustup_dist::manifest::Component; +use rustup_dist::dist::TargetTriple; +use rustup_utils::utils; use self_update; use std::path::Path; diff --git a/src/multirust-cli/self_update.rs b/src/rustup-cli/self_update.rs similarity index 99% rename from src/multirust-cli/self_update.rs rename to src/rustup-cli/self_update.rs index 1ce424c80b..e4c7914c67 100644 --- a/src/multirust-cli/self_update.rs +++ b/src/rustup-cli/self_update.rs @@ -32,10 +32,10 @@ use common::{self, confirm}; use itertools::Itertools; -use multirust::{Error, Result, NotifyHandler}; -use multirust_dist::dist; -use multirust_dist; -use multirust_utils::utils; +use rustup::{Error, Result, NotifyHandler}; +use rustup_dist::dist; +use rustup_dist; +use rustup_utils::utils; use openssl::crypto::hash::{Type, Hasher}; use std::env; use std::env::consts::EXE_SUFFIX; @@ -259,7 +259,7 @@ fn cleanup_legacy() -> Result<()> { #[cfg(windows)] fn legacy_multirust_home_dir() -> Result { - use multirust_utils::raw::windows::{ + use rustup_utils::raw::windows::{ get_special_folder, FOLDERID_LocalAppData }; @@ -500,7 +500,7 @@ fn delete_multirust_and_cargo_home() -> Result<()> { /// Run by multirust-gc-$num.exe to delete CARGO_HOME #[cfg(windows)] pub fn complete_windows_uninstall() -> Result<()> { - use multirust::NotifyHandler; + use rustup::NotifyHandler; use std::ffi::OsStr; use std::process::Stdio; @@ -939,7 +939,7 @@ pub fn prepare_update() -> Result> { // Check that hash is correct if latest_hash != download_hash { - return Err(Error::Install(multirust_dist::Error::ChecksumFailed { + return Err(Error::Install(rustup_dist::Error::ChecksumFailed { url: url, expected: latest_hash, calculated: download_hash, diff --git a/src/multirust-cli/setup_mode.rs b/src/rustup-cli/setup_mode.rs similarity index 98% rename from src/multirust-cli/setup_mode.rs rename to src/rustup-cli/setup_mode.rs index 515da8c074..a434352b8e 100644 --- a/src/multirust-cli/setup_mode.rs +++ b/src/rustup-cli/setup_mode.rs @@ -1,6 +1,6 @@ use std::env; use self_update; -use multirust::Result; +use rustup::Result; use clap::{App, Arg}; use common; diff --git a/src/multirust-cli/term2.rs b/src/rustup-cli/term2.rs similarity index 100% rename from src/multirust-cli/term2.rs rename to src/rustup-cli/term2.rs diff --git a/src/multirust-cli/tty.rs b/src/rustup-cli/tty.rs similarity index 100% rename from src/multirust-cli/tty.rs rename to src/rustup-cli/tty.rs diff --git a/src/multirust-dist/Cargo.toml b/src/rustup-dist/Cargo.toml similarity index 80% rename from src/multirust-dist/Cargo.toml rename to src/rustup-dist/Cargo.toml index 2af0c21d59..ed95fc9dfb 100644 --- a/src/multirust-dist/Cargo.toml +++ b/src/rustup-dist/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "multirust-dist" +name = "rustup-dist" version = "0.1.6" authors = [ "Diggory Blake " ] description = "Installation from a Rust distribution server" @@ -23,8 +23,8 @@ flate2 = "0.2.9" tempdir = "0.3.4" walkdir = "0.1.5" toml = "0.1.27" -multirust-mock = { path = "../multirust-mock" } -multirust-utils = { path = "../multirust-utils" } +rustup-mock = { path = "../rustup-mock" } +rustup-utils = { path = "../rustup-utils" } [lib] -name = "multirust_dist" +name = "rustup_dist" diff --git a/src/multirust-dist/build.rs b/src/rustup-dist/build.rs similarity index 100% rename from src/multirust-dist/build.rs rename to src/rustup-dist/build.rs diff --git a/src/multirust-dist/src/component/components.rs b/src/rustup-dist/src/component/components.rs similarity index 98% rename from src/multirust-dist/src/component/components.rs rename to src/rustup-dist/src/component/components.rs index 21dc7a74e3..e3f6056a0f 100644 --- a/src/multirust-dist/src/component/components.rs +++ b/src/rustup-dist/src/component/components.rs @@ -2,7 +2,7 @@ /// `Components` and `DirectoryPackage` are the two sides of the /// installation / uninstallation process. -use multirust_utils::{self, utils}; +use rustup_utils::{self, utils}; use prefix::InstallPrefix; use errors::*; @@ -118,7 +118,7 @@ impl<'a> ComponentBuilder<'a> { // FIXME: This writes relative paths to the component manifest, // but rust-installer writes absolute paths. try!(writeln!(file, "{}", part.encode()).map_err(|e| { - multirust_utils::Error::WritingFile { + rustup_utils::Error::WritingFile { name: "component", path: abs_path.clone(), error: e, diff --git a/src/multirust-dist/src/component/mod.rs b/src/rustup-dist/src/component/mod.rs similarity index 100% rename from src/multirust-dist/src/component/mod.rs rename to src/rustup-dist/src/component/mod.rs diff --git a/src/multirust-dist/src/component/package.rs b/src/rustup-dist/src/component/package.rs similarity index 99% rename from src/multirust-dist/src/component/package.rs rename to src/rustup-dist/src/component/package.rs index cc6865d8f7..28c948a6e7 100644 --- a/src/multirust-dist/src/component/package.rs +++ b/src/rustup-dist/src/component/package.rs @@ -9,7 +9,7 @@ use component::components::*; use component::transaction::*; use errors::*; -use multirust_utils::utils; +use rustup_utils::utils; use temp; use std::path::{Path, PathBuf}; diff --git a/src/multirust-dist/src/component/transaction.rs b/src/rustup-dist/src/component/transaction.rs similarity index 93% rename from src/multirust-dist/src/component/transaction.rs rename to src/rustup-dist/src/component/transaction.rs index 3f119394cc..56e2375681 100644 --- a/src/multirust-dist/src/component/transaction.rs +++ b/src/rustup-dist/src/component/transaction.rs @@ -9,7 +9,7 @@ //! FIXME: This uses ensure_dir_exists in some places but rollback //! does not remove any dirs created by it. -use multirust_utils::{self, utils}; +use rustup_utils::{self, utils}; use temp; use prefix::InstallPrefix; use errors::*; @@ -114,7 +114,7 @@ impl<'a> Transaction<'a> { let (item, mut file) = try!(ChangedItem::add_file(&self.prefix, component, relpath.clone())); self.change(item); try!(write!(file, "{}", content).map_err(|e| { - multirust_utils::Error::WritingFile { + rustup_utils::Error::WritingFile { name: "component", path: self.prefix.abs_path(&relpath), error: e, @@ -178,7 +178,7 @@ impl<'a> ChangedItem<'a> { AddedDir(ref path) => { try!(utils::remove_dir("component", &prefix.abs_path(path), - multirust_utils::NotifyHandler::none())) + rustup_utils::NotifyHandler::none())) } RemovedFile(ref path, ref tmp) | ModifiedFile(ref path, Some(ref tmp)) => { try!(utils::rename_file("component", &tmp, &prefix.abs_path(path))) @@ -204,10 +204,10 @@ impl<'a> ChangedItem<'a> { }) } else { if let Some(p) = abs_path.parent() { - try!(utils::ensure_dir_exists("component", p, multirust_utils::NotifyHandler::none())); + try!(utils::ensure_dir_exists("component", p, rustup_utils::NotifyHandler::none())); } let file = try!(File::create(&abs_path).map_err(|e| { - multirust_utils::Error::WritingFile { + rustup_utils::Error::WritingFile { name: "component", path: abs_path, error: e, @@ -229,7 +229,7 @@ impl<'a> ChangedItem<'a> { }) } else { if let Some(p) = abs_path.parent() { - try!(utils::ensure_dir_exists("component", p, multirust_utils::NotifyHandler::none())); + try!(utils::ensure_dir_exists("component", p, rustup_utils::NotifyHandler::none())); } try!(utils::copy_file(src, &abs_path)); Ok(ChangedItem::AddedFile(relpath)) @@ -244,9 +244,9 @@ impl<'a> ChangedItem<'a> { }) } else { if let Some(p) = abs_path.parent() { - try!(utils::ensure_dir_exists("component", p, multirust_utils::NotifyHandler::none())); + try!(utils::ensure_dir_exists("component", p, rustup_utils::NotifyHandler::none())); } - try!(utils::copy_dir(src, &abs_path, multirust_utils::NotifyHandler::none())); + try!(utils::copy_dir(src, &abs_path, rustup_utils::NotifyHandler::none())); Ok(ChangedItem::AddedDir(relpath)) } } @@ -285,7 +285,7 @@ impl<'a> ChangedItem<'a> { Ok(ChangedItem::ModifiedFile(relpath, Some(backup))) } else { if let Some(p) = abs_path.parent() { - try!(utils::ensure_dir_exists("component", p, multirust_utils::NotifyHandler::none())); + try!(utils::ensure_dir_exists("component", p, rustup_utils::NotifyHandler::none())); } Ok(ChangedItem::ModifiedFile(relpath, None)) } diff --git a/src/multirust-dist/src/config.rs b/src/rustup-dist/src/config.rs similarity index 100% rename from src/multirust-dist/src/config.rs rename to src/rustup-dist/src/config.rs diff --git a/src/multirust-dist/src/dist.rs b/src/rustup-dist/src/dist.rs similarity index 98% rename from src/multirust-dist/src/dist.rs rename to src/rustup-dist/src/dist.rs index fdb0718679..0951746bf9 100644 --- a/src/multirust-dist/src/dist.rs +++ b/src/rustup-dist/src/dist.rs @@ -1,7 +1,7 @@ use temp; use errors::*; -use multirust_utils::utils; +use rustup_utils::utils; use prefix::InstallPrefix; use manifest::Component; use manifest::Manifest as ManifestV2; @@ -412,8 +412,8 @@ pub fn update_from_dist<'a>(download: DownloadCfg<'a>, } } Ok(None) => return Ok(None), - Err(Error::Utils(::multirust_utils::errors::Error::DownloadingFile { - error: ::multirust_utils::raw::DownloadError::Status(hyper::status::StatusCode::NotFound), + Err(Error::Utils(::rustup_utils::errors::Error::DownloadingFile { + error: ::rustup_utils::raw::DownloadError::Status(hyper::status::StatusCode::NotFound), .. })) => { // Proceed to try v1 as a fallback diff --git a/src/multirust-dist/src/download.rs b/src/rustup-dist/src/download.rs similarity index 99% rename from src/multirust-dist/src/download.rs rename to src/rustup-dist/src/download.rs index 49716002bf..87f265aeea 100644 --- a/src/multirust-dist/src/download.rs +++ b/src/rustup-dist/src/download.rs @@ -1,5 +1,5 @@ use errors::*; -use multirust_utils::utils; +use rustup_utils::utils; use temp; use openssl::crypto::hash::{Type, Hasher}; diff --git a/src/multirust-dist/src/errors.rs b/src/rustup-dist/src/errors.rs similarity index 96% rename from src/multirust-dist/src/errors.rs rename to src/rustup-dist/src/errors.rs index a56a91e3d7..169af8190d 100644 --- a/src/multirust-dist/src/errors.rs +++ b/src/rustup-dist/src/errors.rs @@ -5,14 +5,14 @@ use std::io; use temp; use walkdir; use toml; -use multirust_utils; -use multirust_utils::notify::{self, NotificationLevel, Notifyable}; +use rustup_utils; +use rustup_utils::notify::{self, NotificationLevel, Notifyable}; use manifest::Component; use dist::TargetTriple; #[derive(Debug)] pub enum Notification<'a> { - Utils(multirust_utils::Notification<'a>), + Utils(rustup_utils::Notification<'a>), Temp(temp::Notification<'a>), Extracting(&'a Path, &'a Path), @@ -33,7 +33,7 @@ pub enum Notification<'a> { #[derive(Debug)] pub enum Error { - Utils(multirust_utils::Error), + Utils(rustup_utils::Error), Temp(temp::Error), InvalidFileExtension, @@ -69,7 +69,7 @@ pub enum Error { BadInstalledMetadataVersion(String), ComponentDirPermissionsFailed(walkdir::Error), ComponentFilePermissionsFailed(io::Error), - ComponentDownloadFailed(Component, multirust_utils::Error), + ComponentDownloadFailed(Component, rustup_utils::Error), ObsoleteDistManifest, Parsing(Vec), MissingKey(String), @@ -89,9 +89,9 @@ pub type SharedNotifyHandler = notify::SharedNotifyHandler Notifyable>>; extend_error!(Error: temp::Error, e => Error::Temp(e)); -extend_error!(Error: multirust_utils::Error, e => Error::Utils(e)); +extend_error!(Error: rustup_utils::Error, e => Error::Utils(e)); -extend_notification!(Notification: multirust_utils::Notification, n => Notification::Utils(n)); +extend_notification!(Notification: rustup_utils::Notification, n => Notification::Utils(n)); extend_notification!(Notification: temp::Notification, n => Notification::Temp(n)); impl<'a> Notification<'a> { @@ -347,10 +347,10 @@ impl Display for Error { } } NoManifestFound(ref ch, ref e) => { - use multirust_utils::raw::DownloadError; + use rustup_utils::raw::DownloadError; use hyper::status::StatusCode::NotFound; match **e { - Error::Utils(multirust_utils::Error::DownloadingFile { + Error::Utils(rustup_utils::Error::DownloadingFile { error: DownloadError::Status(NotFound), .. }) => { diff --git a/src/multirust-dist/src/lib.rs b/src/rustup-dist/src/lib.rs similarity index 93% rename from src/multirust-dist/src/lib.rs rename to src/rustup-dist/src/lib.rs index bfae5e50a7..4be62c7821 100644 --- a/src/multirust-dist/src/lib.rs +++ b/src/rustup-dist/src/lib.rs @@ -8,7 +8,7 @@ extern crate toml; extern crate flate2; extern crate tar; #[macro_use] -extern crate multirust_utils; +extern crate rustup_utils; pub use errors::{Error, Notification, NotifyHandler}; diff --git a/src/multirust-dist/src/manifest.rs b/src/rustup-dist/src/manifest.rs similarity index 100% rename from src/multirust-dist/src/manifest.rs rename to src/rustup-dist/src/manifest.rs diff --git a/src/multirust-dist/src/manifestation.rs b/src/rustup-dist/src/manifestation.rs similarity index 99% rename from src/multirust-dist/src/manifestation.rs rename to src/rustup-dist/src/manifestation.rs index 85ae10ebe8..bcc46ff5e9 100644 --- a/src/multirust-dist/src/manifestation.rs +++ b/src/rustup-dist/src/manifestation.rs @@ -7,7 +7,7 @@ use dist::{download_and_check, DownloadCfg, TargetTriple}; use component::{Components, Transaction, TarGzPackage, Package}; use temp; use errors::*; -use multirust_utils::utils; +use rustup_utils::utils; use prefix::InstallPrefix; use openssl::crypto::hash::{Type, Hasher}; use itertools::Itertools; diff --git a/src/multirust-dist/src/prefix.rs b/src/rustup-dist/src/prefix.rs similarity index 100% rename from src/multirust-dist/src/prefix.rs rename to src/rustup-dist/src/prefix.rs diff --git a/src/multirust-dist/src/temp.rs b/src/rustup-dist/src/temp.rs similarity index 98% rename from src/multirust-dist/src/temp.rs rename to src/rustup-dist/src/temp.rs index d249752c7e..826b666ed5 100644 --- a/src/multirust-dist/src/temp.rs +++ b/src/rustup-dist/src/temp.rs @@ -4,9 +4,9 @@ use std::path::{Path, PathBuf}; use std::io; use std::ops; use std::fmt::{self, Display}; -use multirust_utils::raw; +use rustup_utils::raw; -use multirust_utils::notify::{self, NotificationLevel, Notifyable}; +use rustup_utils::notify::{self, NotificationLevel, Notifyable}; #[derive(Debug)] pub enum Error { diff --git a/src/multirust-dist/src/toml_utils.rs b/src/rustup-dist/src/toml_utils.rs similarity index 100% rename from src/multirust-dist/src/toml_utils.rs rename to src/rustup-dist/src/toml_utils.rs diff --git a/src/multirust-dist/tests/channel-rust-nightly-example.toml b/src/rustup-dist/tests/channel-rust-nightly-example.toml similarity index 100% rename from src/multirust-dist/tests/channel-rust-nightly-example.toml rename to src/rustup-dist/tests/channel-rust-nightly-example.toml diff --git a/src/multirust-dist/tests/channel-rust-nightly-example2.toml b/src/rustup-dist/tests/channel-rust-nightly-example2.toml similarity index 100% rename from src/multirust-dist/tests/channel-rust-nightly-example2.toml rename to src/rustup-dist/tests/channel-rust-nightly-example2.toml diff --git a/src/multirust-dist/tests/dist.rs b/src/rustup-dist/tests/dist.rs similarity index 98% rename from src/multirust-dist/tests/dist.rs rename to src/rustup-dist/tests/dist.rs index 554d0af64f..833e7e0ef3 100644 --- a/src/multirust-dist/tests/dist.rs +++ b/src/rustup-dist/tests/dist.rs @@ -1,9 +1,9 @@ // Tests of installation and updates from a v2 Rust distribution // server (mocked on the file system) -extern crate multirust_dist; -extern crate multirust_utils; -extern crate multirust_mock; +extern crate rustup_dist; +extern crate rustup_utils; +extern crate rustup_mock; extern crate tempdir; extern crate tar; extern crate openssl; @@ -13,17 +13,17 @@ extern crate walkdir; extern crate itertools; extern crate hyper; -use multirust_mock::dist::*; -use multirust_mock::{MockCommand, MockInstallerBuilder}; -use multirust_dist::prefix::InstallPrefix; -use multirust_dist::{Error, NotifyHandler}; -use multirust_dist::dist::{ToolchainDesc, TargetTriple}; -use multirust_dist::download::DownloadCfg; -use multirust_utils::utils; -use multirust_utils::raw as utils_raw; -use multirust_dist::temp; -use multirust_dist::manifestation::{Manifestation, UpdateStatus, Changes}; -use multirust_dist::manifest::{Manifest, Component}; +use rustup_mock::dist::*; +use rustup_mock::{MockCommand, MockInstallerBuilder}; +use rustup_dist::prefix::InstallPrefix; +use rustup_dist::{Error, NotifyHandler}; +use rustup_dist::dist::{ToolchainDesc, TargetTriple}; +use rustup_dist::download::DownloadCfg; +use rustup_utils::utils; +use rustup_utils::raw as utils_raw; +use rustup_dist::temp; +use rustup_dist::manifestation::{Manifestation, UpdateStatus, Changes}; +use rustup_dist::manifest::{Manifest, Component}; use hyper::Url; use std::fs; use std::io::Write; diff --git a/src/multirust-dist/tests/install.rs b/src/rustup-dist/tests/install.rs similarity index 96% rename from src/multirust-dist/tests/install.rs rename to src/rustup-dist/tests/install.rs index dd17b745cf..158d20121d 100644 --- a/src/multirust-dist/tests/install.rs +++ b/src/rustup-dist/tests/install.rs @@ -1,19 +1,19 @@ -extern crate multirust_dist; -extern crate multirust_utils; -extern crate multirust_mock; +extern crate rustup_dist; +extern crate rustup_utils; +extern crate rustup_mock; extern crate tempdir; -use multirust_dist::component::Components; -use multirust_dist::component::{DirectoryPackage, Package}; -use multirust_dist::component::Transaction; -use multirust_dist::temp; -use multirust_utils::utils; -use multirust_dist::NotifyHandler; -use multirust_dist::prefix::InstallPrefix; +use rustup_dist::component::Components; +use rustup_dist::component::{DirectoryPackage, Package}; +use rustup_dist::component::Transaction; +use rustup_dist::temp; +use rustup_utils::utils; +use rustup_dist::NotifyHandler; +use rustup_dist::prefix::InstallPrefix; use std::fs::File; use std::io::Write; use tempdir::TempDir; -use multirust_mock::{MockInstallerBuilder, MockCommand}; +use rustup_mock::{MockInstallerBuilder, MockCommand}; // Just testing that the mocks work #[test] @@ -261,7 +261,7 @@ fn component_bad_version() { // Can't open components now let e = Components::open(prefix.clone()).unwrap_err(); - if let multirust_dist::Error::BadInstalledMetadataVersion(_) = e { } else { panic!() } + if let rustup_dist::Error::BadInstalledMetadataVersion(_) = e { } else { panic!() } } // Directories should be 0755, normal files 0644, files that come diff --git a/src/multirust-dist/tests/manifest.rs b/src/rustup-dist/tests/manifest.rs similarity index 95% rename from src/multirust-dist/tests/manifest.rs rename to src/rustup-dist/tests/manifest.rs index a92f047a06..cdd004865b 100644 --- a/src/multirust-dist/tests/manifest.rs +++ b/src/rustup-dist/tests/manifest.rs @@ -1,8 +1,8 @@ -extern crate multirust_dist; +extern crate rustup_dist; -use multirust_dist::manifest::Manifest; -use multirust_dist::Error; -use multirust_dist::dist::TargetTriple; +use rustup_dist::manifest::Manifest; +use rustup_dist::Error; +use rustup_dist::dist::TargetTriple; // Example manifest from https://public.etherpad-mozilla.org/p/Rust-infra-work-week static EXAMPLE: &'static str = include_str!("channel-rust-nightly-example.toml"); diff --git a/src/multirust-dist/tests/transactions.rs b/src/rustup-dist/tests/transactions.rs similarity index 98% rename from src/multirust-dist/tests/transactions.rs rename to src/rustup-dist/tests/transactions.rs index a128fab0e7..7ac7357246 100644 --- a/src/multirust-dist/tests/transactions.rs +++ b/src/rustup-dist/tests/transactions.rs @@ -1,14 +1,14 @@ -extern crate multirust_dist; -extern crate multirust_utils; +extern crate rustup_dist; +extern crate rustup_utils; extern crate tempdir; -use multirust_dist::NotifyHandler; -use multirust_dist::prefix::InstallPrefix; -use multirust_dist::component::Transaction; -use multirust_dist::temp; -use multirust_utils::utils; -use multirust_utils::raw as utils_raw; -use multirust_dist::Error; +use rustup_dist::NotifyHandler; +use rustup_dist::prefix::InstallPrefix; +use rustup_dist::component::Transaction; +use rustup_dist::temp; +use rustup_utils::utils; +use rustup_utils::raw as utils_raw; +use rustup_dist::Error; use tempdir::TempDir; use std::fs; use std::io::Write; diff --git a/src/multirust-mock/Cargo.toml b/src/rustup-mock/Cargo.toml similarity index 95% rename from src/multirust-mock/Cargo.toml rename to src/rustup-mock/Cargo.toml index cbc8dbcbf3..1207211c51 100644 --- a/src/multirust-mock/Cargo.toml +++ b/src/rustup-mock/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "multirust-mock" +name = "rustup-mock" version = "0.1.6" authors = [ "Diggory Blake " ] description = "Test mocks for multirust" diff --git a/src/multirust-mock/src/clitools.rs b/src/rustup-mock/src/clitools.rs similarity index 100% rename from src/multirust-mock/src/clitools.rs rename to src/rustup-mock/src/clitools.rs diff --git a/src/multirust-mock/src/dist.rs b/src/rustup-mock/src/dist.rs similarity index 100% rename from src/multirust-mock/src/dist.rs rename to src/rustup-mock/src/dist.rs diff --git a/src/multirust-mock/src/lib.rs b/src/rustup-mock/src/lib.rs similarity index 100% rename from src/multirust-mock/src/lib.rs rename to src/rustup-mock/src/lib.rs diff --git a/src/multirust-utils/Cargo.toml b/src/rustup-utils/Cargo.toml similarity index 98% rename from src/multirust-utils/Cargo.toml rename to src/rustup-utils/Cargo.toml index 4ddd6133c9..eb4a8b16a4 100644 --- a/src/multirust-utils/Cargo.toml +++ b/src/rustup-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "multirust-utils" +name = "rustup-utils" version = "0.1.6" authors = [ "Diggory Blake " ] description = "multirust in rust - manage multiple rust installations with ease" diff --git a/src/multirust-utils/src/errors.rs b/src/rustup-utils/src/errors.rs similarity index 100% rename from src/multirust-utils/src/errors.rs rename to src/rustup-utils/src/errors.rs diff --git a/src/multirust-utils/src/lib.rs b/src/rustup-utils/src/lib.rs similarity index 100% rename from src/multirust-utils/src/lib.rs rename to src/rustup-utils/src/lib.rs diff --git a/src/multirust-utils/src/notify.rs b/src/rustup-utils/src/notify.rs similarity index 100% rename from src/multirust-utils/src/notify.rs rename to src/rustup-utils/src/notify.rs diff --git a/src/multirust-utils/src/raw.rs b/src/rustup-utils/src/raw.rs similarity index 100% rename from src/multirust-utils/src/raw.rs rename to src/rustup-utils/src/raw.rs diff --git a/src/multirust-utils/src/utils.rs b/src/rustup-utils/src/utils.rs similarity index 100% rename from src/multirust-utils/src/utils.rs rename to src/rustup-utils/src/utils.rs diff --git a/src/multirust/config.rs b/src/rustup/config.rs similarity index 98% rename from src/multirust/config.rs rename to src/rustup/config.rs index 075f4ec723..1d78bdb021 100644 --- a/src/multirust/config.rs +++ b/src/rustup/config.rs @@ -8,8 +8,8 @@ use std::fmt::{self, Display}; use itertools::Itertools; use errors::*; -use multirust_dist::{temp, dist}; -use multirust_utils::utils; +use rustup_dist::{temp, dist}; +use rustup_utils::utils; use override_db::OverrideDB; use toolchain::{Toolchain, UpdateStatus}; @@ -180,7 +180,7 @@ impl Cfg { for dir in dirs { let dir = try!(dir.map_err(|e| Error::UpgradeIoError(e))); try!(utils::remove_dir("toolchain", &dir.path(), - ::multirust_utils::NotifyHandler::some(&self.notify_handler))); + ::rustup_utils::NotifyHandler::some(&self.notify_handler))); } // Also delete the update hashes diff --git a/src/multirust/env_var.rs b/src/rustup/env_var.rs similarity index 100% rename from src/multirust/env_var.rs rename to src/rustup/env_var.rs diff --git a/src/multirust/errors.rs b/src/rustup/errors.rs similarity index 94% rename from src/multirust/errors.rs rename to src/rustup/errors.rs index efb9549594..5e337d26ee 100644 --- a/src/multirust/errors.rs +++ b/src/rustup/errors.rs @@ -3,15 +3,15 @@ use std::error; use std::fmt::{self, Display}; use std::io; -use multirust_dist::{self, temp}; -use multirust_utils; -use multirust_utils::notify::{self, NotificationLevel, Notifyable}; -use multirust_dist::manifest::Component; +use rustup_dist::{self, temp}; +use rustup_utils; +use rustup_utils::notify::{self, NotificationLevel, Notifyable}; +use rustup_dist::manifest::Component; #[derive(Debug)] pub enum Notification<'a> { - Install(multirust_dist::Notification<'a>), - Utils(multirust_utils::Notification<'a>), + Install(rustup_dist::Notification<'a>), + Utils(rustup_utils::Notification<'a>), Temp(temp::Notification<'a>), SetDefaultToolchain(&'a str), @@ -37,8 +37,8 @@ pub enum Notification<'a> { #[derive(Debug)] pub enum Error { - Install(multirust_dist::Error), - Utils(multirust_utils::Error), + Install(rustup_dist::Error), + Utils(rustup_utils::Error), Temp(temp::Error), UnknownMetadataVersion(String), @@ -71,12 +71,12 @@ pub type Result = ::std::result::Result; pub type NotifyHandler<'a> = notify::NotifyHandler<'a, for<'b> Notifyable>>; pub type SharedNotifyHandler = notify::SharedNotifyHandler Notifyable>>; -extend_error!(Error: multirust_dist::Error, e => Error::Install(e)); -extend_error!(Error: multirust_utils::Error, e => Error::Utils(e)); +extend_error!(Error: rustup_dist::Error, e => Error::Install(e)); +extend_error!(Error: rustup_utils::Error, e => Error::Utils(e)); extend_error!(Error: temp::Error, e => Error::Temp(e)); -extend_notification!(Notification: multirust_dist::Notification, n => Notification::Install(n)); -extend_notification!(Notification: multirust_utils::Notification, n => Notification::Utils(n)); +extend_notification!(Notification: rustup_dist::Notification, n => Notification::Install(n)); +extend_notification!(Notification: rustup_utils::Notification, n => Notification::Utils(n)); extend_notification!(Notification: temp::Notification, n => Notification::Temp(n)); impl<'a> Notification<'a> { diff --git a/src/multirust/install.rs b/src/rustup/install.rs similarity index 91% rename from src/multirust/install.rs rename to src/rustup/install.rs index b735591893..5a3c237ce0 100644 --- a/src/multirust/install.rs +++ b/src/rustup/install.rs @@ -1,12 +1,12 @@ //! Installation and upgrade of both distribution-managed and local //! toolchains -use multirust_dist::{NotifyHandler, Notification}; -use multirust_dist::prefix::InstallPrefix; -use multirust_utils::utils; -use multirust_dist::temp; -use multirust_dist::dist; -use multirust_dist::component::{Components, TarGzPackage, Transaction, Package}; +use rustup_dist::{NotifyHandler, Notification}; +use rustup_dist::prefix::InstallPrefix; +use rustup_utils::utils; +use rustup_dist::temp; +use rustup_dist::dist; +use rustup_dist::component::{Components, TarGzPackage, Transaction, Package}; use errors::Result; use std::path::Path; diff --git a/src/multirust/lib.rs b/src/rustup/lib.rs similarity index 70% rename from src/multirust/lib.rs rename to src/rustup/lib.rs index d5744833a1..8c9858a867 100644 --- a/src/multirust/lib.rs +++ b/src/rustup/lib.rs @@ -1,6 +1,6 @@ -extern crate multirust_dist; +extern crate rustup_dist; #[macro_use] -extern crate multirust_utils; +extern crate rustup_utils; extern crate hyper; extern crate regex; extern crate itertools; @@ -9,7 +9,7 @@ pub use errors::*; pub use config::*; pub use toolchain::*; pub use override_db::*; -pub use multirust_utils::{utils, notify}; +pub use rustup_utils::{utils, notify}; mod errors; mod override_db; diff --git a/src/multirust/override_db.rs b/src/rustup/override_db.rs similarity index 98% rename from src/multirust/override_db.rs rename to src/rustup/override_db.rs index 6c3a957f47..5c5c4a52e0 100644 --- a/src/multirust/override_db.rs +++ b/src/rustup/override_db.rs @@ -1,8 +1,8 @@ use std::path::{Path, PathBuf}; use errors::*; -use multirust_dist::temp; -use multirust_utils::utils; +use rustup_dist::temp; +use rustup_utils::utils; pub const DB_DELIMITER: &'static str = ";"; diff --git a/src/multirust/rust-key.gpg.ascii b/src/rustup/rust-key.gpg.ascii similarity index 100% rename from src/multirust/rust-key.gpg.ascii rename to src/rustup/rust-key.gpg.ascii diff --git a/src/multirust/toolchain.rs b/src/rustup/toolchain.rs similarity index 97% rename from src/multirust/toolchain.rs rename to src/rustup/toolchain.rs index 38e85fb795..c2000a1fe1 100644 --- a/src/multirust/toolchain.rs +++ b/src/rustup/toolchain.rs @@ -1,10 +1,10 @@ use errors::*; -use multirust_dist::dist; -use multirust_utils::utils; -use multirust_dist::prefix::InstallPrefix; -use multirust_dist::dist::{ToolchainDesc}; -use multirust_dist::manifestation::{Manifestation, Changes}; -use multirust_dist::manifest::Component; +use rustup_dist::dist; +use rustup_utils::utils; +use rustup_dist::prefix::InstallPrefix; +use rustup_dist::dist::{ToolchainDesc}; +use rustup_dist::manifestation::{Manifestation, Changes}; +use rustup_dist::manifest::Component; use config::Cfg; use env_var; use install::{self, InstallMethod}; @@ -162,7 +162,7 @@ impl<'a> Toolchain<'a> { fn ensure_custom(&self) -> Result<()> { if !self.is_custom() { - Err(Error::Install(::multirust_dist::Error::InvalidCustomToolchainName(self.name.to_string()))) + Err(Error::Install(::rustup_dist::Error::InvalidCustomToolchainName(self.name.to_string()))) } else { Ok(()) } diff --git a/tests/cli-exact.rs b/tests/cli-exact.rs index 1d3a9df40c..f8789e1194 100644 --- a/tests/cli-exact.rs +++ b/tests/cli-exact.rs @@ -1,10 +1,10 @@ //! Yet more cli test cases. These are testing that the output //! is exactly as expected. -extern crate multirust_dist; -extern crate multirust_mock; +extern crate rustup_dist; +extern crate rustup_mock; -use multirust_mock::clitools::{self, Config, Scenario, +use rustup_mock::clitools::{self, Config, Scenario, expect_ok, expect_ok_ex, expect_err_ex, this_host_triple}; diff --git a/tests/cli-misc.rs b/tests/cli-misc.rs index 81033db908..4d100852d5 100644 --- a/tests/cli-misc.rs +++ b/tests/cli-misc.rs @@ -1,11 +1,11 @@ //! Test cases of the multirust command that do not depend on the //! dist server, mostly derived from multirust/test-v2.sh -extern crate multirust_dist; -extern crate multirust_utils; -extern crate multirust_mock; +extern crate rustup_dist; +extern crate rustup_utils; +extern crate rustup_mock; -use multirust_mock::clitools::{self, Config, Scenario, +use rustup_mock::clitools::{self, Config, Scenario, expect_stdout_ok, expect_stderr_ok, expect_ok, expect_err, run, this_host_triple}; @@ -492,7 +492,7 @@ fn running_with_v2_metadata() { setup(&|config| { expect_ok(config, &["multirust", "default", "nightly"]); // Replace the metadata version - multirust_utils::raw::write_file(&config.rustupdir.join("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`"); @@ -506,7 +506,7 @@ fn running_with_v2_metadata_rustup() { setup(&|config| { expect_ok(config, &["rustup", "default", "nightly"]); // Replace the metadata version - multirust_utils::raw::write_file(&config.rustupdir.join("version"), + rustup_utils::raw::write_file(&config.rustupdir.join("version"), "2").unwrap(); expect_err(config, &["rustup", "default", "nightly"], "rustup's metadata is out of date. run `rustup self upgrade-data`"); @@ -523,7 +523,7 @@ fn upgrade_v2_metadata_to_v12() { setup(&|config| { expect_ok(config, &["multirust", "default", "nightly"]); // Replace the metadata version - multirust_utils::raw::write_file(&config.rustupdir.join("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"); @@ -545,7 +545,7 @@ fn upgrade_v2_metadata_to_v12_rustup() { setup(&|config| { expect_ok(config, &["rustup", "default", "nightly"]); // Replace the metadata version - multirust_utils::raw::write_file(&config.rustupdir.join("version"), + rustup_utils::raw::write_file(&config.rustupdir.join("version"), "2").unwrap(); expect_stderr_ok(config, &["rustup", "self", "upgrade-data"], "warning: this upgrade will remove all existing toolchains. you will need to reinstall them"); diff --git a/tests/cli-rustup.rs b/tests/cli-rustup.rs index e37f472f0e..353d48b5a0 100644 --- a/tests/cli-rustup.rs +++ b/tests/cli-rustup.rs @@ -1,11 +1,11 @@ //! Test cases for new rustup UI -extern crate multirust_dist; -extern crate multirust_utils; -extern crate multirust_mock; +extern crate rustup_dist; +extern crate rustup_utils; +extern crate rustup_mock; extern crate tempdir; -use multirust_mock::clitools::{self, Config, Scenario, +use rustup_mock::clitools::{self, Config, Scenario, expect_ok, expect_ok_ex, expect_stdout_ok, expect_err_ex, diff --git a/tests/cli-self-update.rs b/tests/cli-self-update.rs index 3d55b66052..fcb7ed1e8f 100644 --- a/tests/cli-self-update.rs +++ b/tests/cli-self-update.rs @@ -1,7 +1,7 @@ //! Testing self install, uninstall and update -extern crate multirust_mock; -extern crate multirust_utils; +extern crate rustup_mock; +extern crate rustup_utils; #[macro_use] extern crate lazy_static; extern crate tempdir; @@ -19,15 +19,15 @@ use std::env::consts::EXE_SUFFIX; use std::path::Path; use std::fs; use std::process::Command; -use multirust_mock::clitools::{self, Config, Scenario, +use rustup_mock::clitools::{self, Config, Scenario, expect_ok, expect_ok_ex, expect_stdout_ok, expect_err, expect_err_ex, this_host_triple}; #[cfg(windows)] -use multirust_mock::clitools::expect_stderr_ok; -use multirust_mock::dist::{create_hash, calc_hash}; -use multirust_utils::raw; +use rustup_mock::clitools::expect_stderr_ok; +use rustup_mock::dist::{create_hash, calc_hash}; +use rustup_utils::raw; macro_rules! for_host { ($s: expr) => (&format!($s, this_host_triple())) } @@ -403,7 +403,7 @@ fn restore_path(p: &Option) { use winreg::{RegKey, RegValue}; use winreg::enums::RegType; use winapi::*; - use multirust_utils::utils; + use rustup_utils::utils; let root = RegKey::predef(HKEY_CURRENT_USER); let environment = root.open_subkey_with_flags("Environment", KEY_READ | KEY_WRITE).unwrap(); diff --git a/tests/cli-v1.rs b/tests/cli-v1.rs index 9071cbf31f..69eb0dfd24 100644 --- a/tests/cli-v1.rs +++ b/tests/cli-v1.rs @@ -1,14 +1,14 @@ //! Test cases of the multirust command, using v1 manifests, mostly //! derived from multirust/test-v2.sh -extern crate multirust_dist; -extern crate multirust_utils; -extern crate multirust_mock; +extern crate rustup_dist; +extern crate rustup_utils; +extern crate rustup_mock; extern crate tempdir; use std::fs; use tempdir::TempDir; -use multirust_mock::clitools::{self, Config, Scenario, +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}; @@ -166,11 +166,11 @@ fn remove_override_toolchain_error_handling() { fn bad_sha_on_manifest() { setup(&|config| { let sha_file = config.distdir.join("dist/channel-rust-nightly.sha256"); - let sha_str = multirust_utils::raw::read_file(&sha_file).unwrap(); + let sha_str = rustup_utils::raw::read_file(&sha_file).unwrap(); let mut sha_bytes = sha_str.into_bytes(); &mut sha_bytes[..10].clone_from_slice(b"aaaaaaaaaa"); let sha_str = String::from_utf8(sha_bytes).unwrap(); - multirust_utils::raw::write_file(&sha_file, &sha_str).unwrap(); + rustup_utils::raw::write_file(&sha_file, &sha_str).unwrap(); expect_err(config, &["multirust", "default", "nightly"], "checksum failed"); }); @@ -183,7 +183,7 @@ fn bad_sha_on_installer() { for file in fs::read_dir(&dir).unwrap() { let file = file.unwrap(); if file.path().to_string_lossy().ends_with(".tar.gz") { - multirust_utils::raw::write_file(&file.path(), "xxx").unwrap(); + rustup_utils::raw::write_file(&file.path(), "xxx").unwrap(); } } expect_err(config, &["multirust", "default", "nightly"], diff --git a/tests/cli-v2.rs b/tests/cli-v2.rs index b72e3d8878..3b89468a62 100644 --- a/tests/cli-v2.rs +++ b/tests/cli-v2.rs @@ -1,19 +1,19 @@ //! Test cases of the multirust command, using v2 manifests, mostly //! derived from multirust/test-v2.sh -extern crate multirust_dist; -extern crate multirust_utils; -extern crate multirust_mock; +extern crate rustup_dist; +extern crate rustup_utils; +extern crate rustup_mock; extern crate tempdir; use std::fs; use tempdir::TempDir; -use multirust_mock::clitools::{self, Config, Scenario, +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}; -use multirust_dist::dist::TargetTriple; +use rustup_dist::dist::TargetTriple; macro_rules! for_host { ($s: expr) => (&format!($s, this_host_triple())) } @@ -169,11 +169,11 @@ fn bad_sha_on_manifest() { setup(&|config| { // Corrupt the sha let sha_file = config.distdir.join("dist/channel-rust-nightly.toml.sha256"); - let sha_str = multirust_utils::raw::read_file(&sha_file).unwrap(); + let sha_str = rustup_utils::raw::read_file(&sha_file).unwrap(); let mut sha_bytes = sha_str.into_bytes(); &mut sha_bytes[..10].clone_from_slice(b"aaaaaaaaaa"); let sha_str = String::from_utf8(sha_bytes).unwrap(); - multirust_utils::raw::write_file(&sha_file, &sha_str).unwrap(); + rustup_utils::raw::write_file(&sha_file, &sha_str).unwrap(); expect_err(config, &["multirust", "default", "nightly"], "checksum failed"); }); @@ -187,7 +187,7 @@ fn bad_sha_on_installer() { for file in fs::read_dir(&dir).unwrap() { let file = file.unwrap(); if file.path().to_string_lossy().ends_with(".tar.gz") { - multirust_utils::raw::write_file(&file.path(), "xxx").unwrap(); + rustup_utils::raw::write_file(&file.path(), "xxx").unwrap(); } } expect_err(config, &["multirust", "default", "nightly"], @@ -691,11 +691,11 @@ fn remove_target_host() { } fn make_component_unavailable(config: &Config, name: &str, target: &TargetTriple) { - use multirust_dist::manifest::Manifest; - use multirust_mock::dist::create_hash; + use rustup_dist::manifest::Manifest; + use rustup_mock::dist::create_hash; let ref manifest_path = config.distdir.join("dist/channel-rust-nightly.toml"); - let ref manifest_str = multirust_utils::raw::read_file(manifest_path).unwrap(); + let ref manifest_str = rustup_utils::raw::read_file(manifest_path).unwrap(); let mut manifest = Manifest::parse(manifest_str).unwrap(); { let mut std_pkg = manifest.packages.get_mut(name).unwrap(); @@ -703,7 +703,7 @@ fn make_component_unavailable(config: &Config, name: &str, target: &TargetTriple target_pkg.available = false; } let ref manifest_str = manifest.stringify(); - multirust_utils::raw::write_file(manifest_path, manifest_str).unwrap(); + rustup_utils::raw::write_file(manifest_path, manifest_str).unwrap(); // Have to update the hash too let ref hash_path = manifest_path.with_extension("toml.sha256"); From c4417ff0b7e5a4847b13e0ab0a96b3cb15d8d40b Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 14 Apr 2016 00:14:47 +0000 Subject: [PATCH 2/2] 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)); }); }