From bd2c76824de8c22b1ed7a4f8d693143538f7a9ec Mon Sep 17 00:00:00 2001 From: Philipp Hansch <dev@phansch.net> Date: Fri, 9 Nov 2018 07:13:34 +0100 Subject: [PATCH 1/9] Stop allowing failures in Travis windows build --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ee990111af9..2d1d363d090 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 <dev@phansch.net> Date: Wed, 28 Nov 2018 07:29:05 +0100 Subject: [PATCH 2/9] 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 2d1d363d090..2e8e205d43b 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 <hello@philkrones.com> Date: Fri, 12 Jul 2019 10:58:06 +0200 Subject: [PATCH 3/9] 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 2e8e205d43b..b2ad9d5b7e5 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 <hello@philkrones.com> Date: Fri, 12 Jul 2019 12:12:53 +0200 Subject: [PATCH 4/9] 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 c5d3eb3c902..34bc9a8eca2 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 <hello@philkrones.com> Date: Fri, 12 Jul 2019 14:13:15 +0200 Subject: [PATCH 5/9] 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 e6b04bf0cfd..545c43f9a45 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 <hello@philkrones.com> Date: Sat, 13 Jul 2019 11:42:44 +0200 Subject: [PATCH 6/9] Test with different sysroots dependent on the OS --- .travis.yml | 2 +- ci/base-tests.sh | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index b2ad9d5b7e5..3f7c856a7f7 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 34bc9a8eca2..a53a0ea52be 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 + 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=/tmp ./target/debug/clippy-driver --print sysroot) - test $sysroot = /tmp + 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 <hello@philkrones.com> Date: Sat, 13 Jul 2019 13:26:26 +0200 Subject: [PATCH 7/9] 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 3f7c856a7f7..eb3d4803b3b 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 From 625051d3e7d3a3f1f9d7ac9818b10ed93eb31481 Mon Sep 17 00:00:00 2001 From: flip1995 <hello@philkrones.com> Date: Sun, 14 Jul 2019 15:13:47 +0200 Subject: [PATCH 8/9] Revert "Remove `CARGO_INCREMENTAL=0` from windows build" This reverts commit 876a7e1f01cb14a63eee54cb44524a87161d5454. Using incremental build on windows increases the build time on travis by about 8 minutes. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index eb3d4803b3b..3f7c856a7f7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,7 +45,7 @@ matrix: - os: linux env: BASE_TESTS=true - os: windows - env: BASE_TESTS=true OS_WINDOWS=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 From ce2a7b0160ea8220249d73a386edd0ca85015f66 Mon Sep 17 00:00:00 2001 From: flip1995 <hello@philkrones.com> Date: Sun, 14 Jul 2019 15:21:50 +0200 Subject: [PATCH 9/9] Disable dogfood on windows for faster build time on travis --- tests/dogfood.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/dogfood.rs b/tests/dogfood.rs index 4153c9ef06e..1f03ba3950a 100644 --- a/tests/dogfood.rs +++ b/tests/dogfood.rs @@ -1,6 +1,6 @@ #[test] fn dogfood() { - if option_env!("RUSTC_TEST_SUITE").is_some() { + if option_env!("RUSTC_TEST_SUITE").is_some() || cfg!(windows) { return; } let root_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")); @@ -30,7 +30,7 @@ fn dogfood() { #[test] fn dogfood_tests() { - if option_env!("RUSTC_TEST_SUITE").is_some() { + if option_env!("RUSTC_TEST_SUITE").is_some() || cfg!(windows) { return; } let root_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));