diff --git a/appveyor.yml b/appveyor.yml index 74c51dce68d..7c3597b042d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -28,8 +28,7 @@ install: - if defined MINGW_URL 7z x -y %MINGW_ARCHIVE% > nul - if defined MINGW_URL set PATH=%CD%\%MINGW_DIR%\bin;C:\msys64\usr\bin;%PATH% - # FIXME(#3394) use master rustup - - curl -sSfO https://static.rust-lang.org/rustup/archive/0.6.5/x86_64-pc-windows-msvc/rustup-init.exe + - appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe - rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain nightly-2017-03-03 - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin - if NOT "%TARGET%" == "x86_64-pc-windows-msvc" rustup target add %TARGET% diff --git a/tests/cargotest/lib.rs b/tests/cargotest/lib.rs index 15dc956cae8..8446fa829ea 100644 --- a/tests/cargotest/lib.rs +++ b/tests/cargotest/lib.rs @@ -18,11 +18,12 @@ extern crate url; #[cfg(windows)] extern crate kernel32; #[cfg(windows)] extern crate winapi; -use cargo::util::Rustc; use std::ffi::OsStr; use std::time::Duration; -use std::path::PathBuf; -use std::env; +use std::path::{Path, PathBuf}; + +use cargo::util::Rustc; +use cargo::util::paths; pub mod support; pub mod install; @@ -69,31 +70,21 @@ fn _process(t: &OsStr) -> cargo::util::ProcessBuilder { // We'll need dynamic libraries at some point in this test suite, so ensure // that the rustc libdir is somewhere in LD_LIBRARY_PATH as appropriate. - // Note that this isn't needed on Windows as we assume the bindir (with - // dlls) is in PATH. - if cfg!(unix) { - let var = if cfg!(target_os = "macos") { - "DYLD_LIBRARY_PATH" - } else { - "LD_LIBRARY_PATH" - }; - let rustc = RUSTC.with(|r| r.path.clone()); - let path = env::var_os("PATH").unwrap_or(Default::default()); - let rustc = env::split_paths(&path) - .map(|p| p.join(&rustc)) - .find(|p| p.exists()) - .unwrap(); - let mut libdir = rustc.clone(); - libdir.pop(); - libdir.pop(); - libdir.push("lib"); - let prev = env::var_os(&var).unwrap_or(Default::default()); - let mut paths = env::split_paths(&prev).collect::>(); - println!("libdir: {:?}", libdir); - if !paths.contains(&libdir) { - paths.push(libdir); - p.env(var, env::join_paths(&paths).unwrap()); - } + let mut rustc = RUSTC.with(|r| r.process()); + let output = rustc.arg("--print").arg("sysroot").exec_with_output().unwrap(); + let libdir = String::from_utf8(output.stdout).unwrap(); + let libdir = Path::new(libdir.trim()); + let libdir = if cfg!(windows) { + libdir.join("bin") + } else { + libdir.join("lib") + }; + let mut paths = paths::dylib_path(); + println!("libdir: {:?}", libdir); + if !paths.contains(&libdir) { + paths.push(libdir); + p.env(paths::dylib_path_envvar(), + paths::join_paths(&paths, paths::dylib_path_envvar()).unwrap()); } return p }