Skip to content

Commit

Permalink
WIP: fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Dec 10, 2018
1 parent b8e6af4 commit c63b206
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
16 changes: 11 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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"
Expand All @@ -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 &&
Expand Down
7 changes: 3 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 5 additions & 6 deletions src/bin/cargo-miri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,22 +342,21 @@ 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");
Command::new(path)
} 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));
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions src/fn_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down

0 comments on commit c63b206

Please sign in to comment.