From c63b206675489479e3f9b35f07551eb9dbf2ece4 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 10 Dec 2018 10:19:44 +0100 Subject: [PATCH] WIP: fix CI --- .travis.yml | 16 +++++++++++----- appveyor.yml | 7 +++---- src/bin/cargo-miri.rs | 11 +++++------ src/fn_call.rs | 2 ++ 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index ac3f16ce13..1d49394e29 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,13 +9,16 @@ cache: os: - linux - osx +dist: xenial before_script: +# install extra stuff for cross-compilation +- if [[ "$TRAVIS_OS_NAME" == linux ]]; then sudo apt update && sudo apt install gcc-multilib; fi # macOS weirdness (/~https://github.com/travis-ci/travis-ci/issues/6307, /~https://github.com/travis-ci/travis-ci/issues/10165) - if [[ "$TRAVIS_OS_NAME" == osx ]]; then rvm get stable; fi # Compute the rust version we use. We do not use "language: rust" to have more control here. - | - if [ "$TRAVIS_EVENT_TYPE" = cron ]; then + if [[ "$TRAVIS_EVENT_TYPE" == cron ]]; then RUST_TOOLCHAIN=nightly else RUST_TOOLCHAIN=$(cat rust-version) @@ -24,7 +27,7 @@ before_script: if [ "$TRAVIS_OS_NAME" == osx ]; then export MIRI_SYSROOT_BASE=~/Library/Caches/miri.miri.miri/ else - export MIRI_SYSROOT_BASE=~/.cache/miri/HOST + export MIRI_SYSROOT_BASE=~/.cache/miri/ fi # install Rust - curl https://build.travis-ci.org/files/rustup-init.sh -sSf | sh -s -- -y --default-toolchain "$RUST_TOOLCHAIN" @@ -38,10 +41,13 @@ script: cargo build --release --all-features --all-targets && cargo install --all-features --force --path . - | - # Get ourselves a MIR-full libstd + # Get ourselves a MIR-full libstd for the host and a foreign architecture cargo miri setup && - cargo miri setup --target i686-unknown-linux-gnu && - cargo miri setup --target i686-apple-darwin + if [[ "$TRAVIS_OS_NAME" == osx ]]; then + cargo miri setup --target i686-apple-darwin + else + cargo miri setup --target i686-unknown-linux-gnu + fi - | # Test miri with full MIR, on the host and other architectures MIRI_SYSROOT=$MIRI_SYSROOT_BASE/HOST cargo test --release --all-features && diff --git a/appveyor.yml b/appveyor.yml index 1f38b848c0..7de28545e4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -25,16 +25,15 @@ install: build: false test_script: - - set RUSTFLAGS=-g - set RUST_BACKTRACE=1 - # Test plain miri + # Build miri - cargo build --release --all-features --all-targets - - cargo test --release --all-features # Get ourselves a MIR-full libstd, and use it henceforth - cargo run --release --all-features --bin cargo-miri -- miri setup - set MIRI_SYSROOT=%USERPROFILE%\AppData\Local\miri\miri\cache\HOST - # Test miri with full MIR + # Test miri - cargo test --release --all-features + - cargo run --release --all-features --bin cargo-miri -- miri run --manifest-path=test-cargo-miri/Cargo.toml notifications: - provider: Email diff --git a/src/bin/cargo-miri.rs b/src/bin/cargo-miri.rs index 8a1a9d0554..ebbfbda980 100644 --- a/src/bin/cargo-miri.rs +++ b/src/bin/cargo-miri.rs @@ -342,11 +342,11 @@ fn main() { .collect() }; args.splice(0..0, miri::miri_default_args().iter().map(ToString::to_string)); - + args.extend_from_slice(&["--cfg".to_owned(), r#"feature="cargo-miri""#.to_owned()]); + // this check ensures that dependencies are built but not interpreted and the final crate is // interpreted but not built let miri_enabled = std::env::args().any(|s| s == "--emit=dep-info,metadata"); - let mut command = if miri_enabled { let mut path = std::env::current_exe().expect("current executable path invalid"); path.set_file_name("miri"); @@ -354,10 +354,9 @@ fn main() { } else { Command::new("rustc") }; + command.args(&args); - args.extend_from_slice(&["--cfg".to_owned(), r#"feature="cargo-miri""#.to_owned()]); - - match command.args(&args).status() { + match command.status() { Ok(exit) => { if !exit.success() { std::process::exit(exit.code().unwrap_or(42)); @@ -388,7 +387,7 @@ where args.push(r#"feature="cargo-miri""#.to_owned()); let path = std::env::current_exe().expect("current executable path invalid"); - let exit_status = std::process::Command::new("cargo") + let exit_status = Command::new("cargo") .args(&args) .env("RUSTC", path) .spawn() diff --git a/src/fn_call.rs b/src/fn_call.rs index e9d3255a5b..701dc8ca92 100644 --- a/src/fn_call.rs +++ b/src/fn_call.rs @@ -113,6 +113,8 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx, 'mir> for super::MiriEvalCo Some(name) => name.as_str(), None => self.tcx.item_name(def_id).as_str(), }; + // Strip linker suffixes (seen on 32bit macOS) + let link_name = link_name.trim_end_matches("$UNIX2003"); let tcx = &{self.tcx.tcx};