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)
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"
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 &&
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
notifications:
.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");
} 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));
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()
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};