From bd2c76824de8c22b1ed7a4f8d693143538f7a9ec Mon Sep 17 00:00:00 2001 From: Philipp Hansch Date: Fri, 9 Nov 2018 07:13:34 +0100 Subject: [PATCH 1/7] Stop allowing failures in Travis windows build --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ee990111af96..2d1d363d090e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -81,9 +81,6 @@ matrix: if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try) - env: INTEGRATION=chronotope/chrono if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try) - allow_failures: - - os: windows - env: CARGO_INCREMENTAL=0 BASE_TESTS=true # prevent these jobs with default env vars exclude: - os: linux From ac6e52a91c1baf8eaaaf1fedcae6267fb16128fd Mon Sep 17 00:00:00 2001 From: Philipp Hansch Date: Wed, 28 Nov 2018 07:29:05 +0100 Subject: [PATCH 2/7] Change conditional Maybe uname == Linux was true on the windows VM? This could be a way to avoid the secret environment variable issue with Travis CI. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2d1d363d090e..2e8e205d43b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -101,7 +101,7 @@ script: after_success: | #!/bin/bash - if [ $(uname) == Linux ]; then + if [ "$TRAVIS_OS_NAME" == "linux" ]; then set -ex if [ -z ${INTEGRATION} ]; then ./.github/deploy.sh From 2991f31c171f88e9feeb3e4fea157d89edb41dd4 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Fri, 12 Jul 2019 10:58:06 +0200 Subject: [PATCH 3/7] Add master toolchain binaries to the PATH --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2e8e205d43b2..b2ad9d5b7e59 100644 --- a/.travis.yml +++ b/.travis.yml @@ -91,7 +91,11 @@ script: - | rm rust-toolchain ./setup-toolchain.sh - export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib + if [ "$TRAVIS_OS_NAME" == "windows" ]; then + export PATH=$PATH:$(rustc --print sysroot)/bin + else + export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib + fi - | if [ -z ${INTEGRATION} ]; then travis_wait 30 ./ci/base-tests.sh && sleep 5 From 6b8ebcc0c8a441a7f871cab1b69c2433be42d5e2 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Fri, 12 Jul 2019 12:12:53 +0200 Subject: [PATCH 4/7] Don't re-set the LD_LIBRARY_PATH in base_tests.sh --- ci/base-tests.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/ci/base-tests.sh b/ci/base-tests.sh index c5d3eb3c902d..34bc9a8eca2c 100755 --- a/ci/base-tests.sh +++ b/ci/base-tests.sh @@ -27,8 +27,6 @@ export CARGO_TARGET_DIR=`pwd`/target/ # Check running clippy-driver without cargo ( - export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib - # Check sysroot handling sysroot=$(./target/debug/clippy-driver --print sysroot) test $sysroot = $(rustc --print sysroot) From c100c70822aa960aa9ee0abff002ce313403e902 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Fri, 12 Jul 2019 14:13:15 +0200 Subject: [PATCH 5/7] Build sys_root in driver with PathBuf instead of String --- src/driver.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/driver.rs b/src/driver.rs index e6b04bf0cfdd..545c43f9a45f 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -12,7 +12,7 @@ extern crate rustc_plugin; use rustc_interface::interface; use rustc_tools_util::*; -use std::path::Path; +use std::path::{Path, PathBuf}; use std::process::{exit, Command}; mod lintlist; @@ -270,12 +270,19 @@ pub fn main() { let sys_root_arg = arg_value(&orig_args, "--sysroot", |_| true); let have_sys_root_arg = sys_root_arg.is_some(); let sys_root = sys_root_arg - .map(std::string::ToString::to_string) - .or_else(|| std::env::var("SYSROOT").ok()) + .map(PathBuf::from) + .or_else(|| std::env::var("SYSROOT").ok().map(PathBuf::from)) .or_else(|| { let home = option_env!("RUSTUP_HOME").or(option_env!("MULTIRUST_HOME")); let toolchain = option_env!("RUSTUP_TOOLCHAIN").or(option_env!("MULTIRUST_TOOLCHAIN")); - home.and_then(|home| toolchain.map(|toolchain| format!("{}/toolchains/{}", home, toolchain))) + home.and_then(|home| { + toolchain.map(|toolchain| { + let mut path = PathBuf::from(home); + path.push("toolchains"); + path.push(toolchain); + path + }) + }) }) .or_else(|| { Command::new("rustc") @@ -284,9 +291,10 @@ pub fn main() { .output() .ok() .and_then(|out| String::from_utf8(out.stdout).ok()) - .map(|s| s.trim().to_owned()) + .map(|s| PathBuf::from(s.trim())) }) - .or_else(|| option_env!("SYSROOT").map(String::from)) + .or_else(|| option_env!("SYSROOT").map(PathBuf::from)) + .map(|pb| pb.to_string_lossy().to_string()) .expect("need to specify SYSROOT env var during clippy compilation, or use rustup or multirust"); // Setting RUSTC_WRAPPER causes Cargo to pass 'rustc' as the first argument. From 4817c2c38139b4bac85f201e93cb718d4f04e9d1 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Sat, 13 Jul 2019 11:42:44 +0200 Subject: [PATCH 6/7] Test with different sysroots dependent on the OS --- .travis.yml | 2 +- ci/base-tests.sh | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index b2ad9d5b7e59..3f7c856a7f76 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,7 +45,7 @@ matrix: - os: linux env: BASE_TESTS=true - os: windows - env: CARGO_INCREMENTAL=0 BASE_TESTS=true + env: CARGO_INCREMENTAL=0 BASE_TESTS=true OS_WINDOWS=true # Builds that are only executed when a PR is r+ed or a try build is started # We don't want to run these always because they go towards diff --git a/ci/base-tests.sh b/ci/base-tests.sh index 34bc9a8eca2c..a53a0ea52be6 100755 --- a/ci/base-tests.sh +++ b/ci/base-tests.sh @@ -31,11 +31,16 @@ export CARGO_TARGET_DIR=`pwd`/target/ sysroot=$(./target/debug/clippy-driver --print sysroot) test $sysroot = $(rustc --print sysroot) - sysroot=$(./target/debug/clippy-driver --sysroot /tmp --print sysroot) - test $sysroot = /tmp - - sysroot=$(SYSROOT=/tmp ./target/debug/clippy-driver --print sysroot) - test $sysroot = /tmp + if [ -z $OS_WINDOWS ]; then + desired_sysroot=/tmp + else + desired_sysroot=C:/tmp + fi + sysroot=$(./target/debug/clippy-driver --sysroot $desired_sysroot --print sysroot) + test $sysroot = $desired_sysroot + + sysroot=$(SYSROOT=$desired_sysroot ./target/debug/clippy-driver --print sysroot) + test $sysroot = $desired_sysroot # Make sure this isn't set - clippy-driver should cope without it unset CARGO_MANIFEST_DIR From 876a7e1f01cb14a63eee54cb44524a87161d5454 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Sat, 13 Jul 2019 13:26:26 +0200 Subject: [PATCH 7/7] Remove `CARGO_INCREMENTAL=0` from windows build --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3f7c856a7f76..eb3d4803b3b7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,7 +45,7 @@ matrix: - os: linux env: BASE_TESTS=true - os: windows - env: CARGO_INCREMENTAL=0 BASE_TESTS=true OS_WINDOWS=true + env: BASE_TESTS=true OS_WINDOWS=true # Builds that are only executed when a PR is r+ed or a try build is started # We don't want to run these always because they go towards