the test suite assumes a libstd with full MIR; run test suite on xargo-built foreign libstds
This commit is contained in:
29
.travis.yml
29
.travis.yml
@@ -20,36 +20,35 @@ before_script:
|
|||||||
else
|
else
|
||||||
RUST_TOOLCHAIN=$(cat rust-version)
|
RUST_TOOLCHAIN=$(cat rust-version)
|
||||||
fi
|
fi
|
||||||
|
- |
|
||||||
|
if [ "$TRAVIS_OS_NAME" == osx ]; then
|
||||||
|
export MIRI_SYSROOT_BASE=~/Library/Caches/miri.miri.miri/
|
||||||
|
else
|
||||||
|
export MIRI_SYSROOT_BASE=~/.cache/miri/HOST
|
||||||
|
fi
|
||||||
# install Rust
|
# install Rust
|
||||||
- curl https://build.travis-ci.org/files/rustup-init.sh -sSf | sh -s -- -y --default-toolchain "$RUST_TOOLCHAIN"
|
- curl https://build.travis-ci.org/files/rustup-init.sh -sSf | sh -s -- -y --default-toolchain "$RUST_TOOLCHAIN"
|
||||||
- export PATH=$HOME/.cargo/bin:$PATH
|
- export PATH=$HOME/.cargo/bin:$PATH
|
||||||
- rustc --version
|
- rustc --version
|
||||||
# customize installation
|
|
||||||
- rustup target add i686-unknown-linux-gnu
|
|
||||||
- rustup target add i686-pc-windows-gnu
|
|
||||||
- rustup target add i686-pc-windows-msvc
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- set -e
|
- set -e
|
||||||
- |
|
- |
|
||||||
# Test and install plain miri
|
# Build and install miri
|
||||||
cargo build --release --all-features --all-targets &&
|
cargo build --release --all-features --all-targets &&
|
||||||
cargo test --release --all-features &&
|
|
||||||
cargo install --all-features --force --path .
|
cargo install --all-features --force --path .
|
||||||
- |
|
- |
|
||||||
# Get ourselves a MIR-full libstd, and use it henceforth
|
# Get ourselves a MIR-full libstd
|
||||||
cargo miri setup &&
|
cargo miri setup &&
|
||||||
if [ "$TRAVIS_OS_NAME" == osx ]; then
|
cargo miri setup --target i686-unknown-linux-gnu &&
|
||||||
export MIRI_SYSROOT=~/Library/Caches/miri.miri.miri/HOST
|
cargo miri setup --target i686-apple-darwin
|
||||||
else
|
|
||||||
export MIRI_SYSROOT=~/.cache/miri/HOST
|
|
||||||
fi
|
|
||||||
- |
|
- |
|
||||||
# Test miri with full MIR
|
# Test miri with full MIR, on the host and other architectures
|
||||||
cargo test --release --all-features
|
MIRI_SYSROOT=$MIRI_SYSROOT_BASE/HOST cargo test --release --all-features &&
|
||||||
|
MIRI_SYSROOT=$MIRI_SYSROOT_BASE cargo test --release --all-features
|
||||||
- |
|
- |
|
||||||
# Test cargo integration
|
# Test cargo integration
|
||||||
(cd cargo-miri-test && ./run-test.py)
|
(cd test-cargo-miri && MIRI_SYSROOT=$MIRI_SYSROOT_BASE/HOST ./run-test.py)
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#![feature(slice_concat_ext, custom_test_frameworks)]
|
#![feature(slice_concat_ext, custom_test_frameworks)]
|
||||||
|
// Custom test runner, to avoid libtest being wrapped around compiletest which wraps libtest.
|
||||||
#![test_runner(test_runner)]
|
#![test_runner(test_runner)]
|
||||||
|
|
||||||
use std::slice::SliceConcatExt;
|
use std::slice::SliceConcatExt;
|
||||||
@@ -24,11 +25,6 @@ fn rustc_lib_path() -> PathBuf {
|
|||||||
option_env!("RUSTC_LIB_PATH").unwrap().into()
|
option_env!("RUSTC_LIB_PATH").unwrap().into()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn have_fullmir() -> bool {
|
|
||||||
// We assume we have full MIR when MIRI_SYSROOT is set or when we are in rustc
|
|
||||||
std::env::var("MIRI_SYSROOT").is_ok() || rustc_test_suite().is_some()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn mk_config(mode: &str) -> compiletest::common::ConfigWithTemp {
|
fn mk_config(mode: &str) -> compiletest::common::ConfigWithTemp {
|
||||||
let mut config = compiletest::Config::default().tempdir();
|
let mut config = compiletest::Config::default().tempdir();
|
||||||
config.mode = mode.parse().expect("Invalid mode");
|
config.mode = mode.parse().expect("Invalid mode");
|
||||||
@@ -41,16 +37,7 @@ fn mk_config(mode: &str) -> compiletest::common::ConfigWithTemp {
|
|||||||
config
|
config
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compile_fail(sysroot: &Path, path: &str, target: &str, host: &str, need_fullmir: bool, opt: bool) {
|
fn compile_fail(sysroot: &Path, path: &str, target: &str, host: &str, opt: bool) {
|
||||||
if need_fullmir && !have_fullmir() {
|
|
||||||
eprintln!("{}\n", format!(
|
|
||||||
"## Skipping compile-fail tests in {} against miri for target {} due to missing mir",
|
|
||||||
path,
|
|
||||||
target
|
|
||||||
).yellow().bold());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let opt_str = if opt { " with optimizations" } else { "" };
|
let opt_str = if opt { " with optimizations" } else { "" };
|
||||||
eprintln!("{}", format!(
|
eprintln!("{}", format!(
|
||||||
"## Running compile-fail tests in {} against miri for target {}{}",
|
"## Running compile-fail tests in {} against miri for target {}{}",
|
||||||
@@ -78,16 +65,7 @@ fn compile_fail(sysroot: &Path, path: &str, target: &str, host: &str, need_fullm
|
|||||||
compiletest::run_tests(&config);
|
compiletest::run_tests(&config);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn miri_pass(sysroot: &Path, path: &str, target: &str, host: &str, need_fullmir: bool, opt: bool) {
|
fn miri_pass(sysroot: &Path, path: &str, target: &str, host: &str, opt: bool) {
|
||||||
if need_fullmir && !have_fullmir() {
|
|
||||||
eprintln!("{}\n", format!(
|
|
||||||
"## Skipping run-pass tests in {} against miri for target {} due to missing mir",
|
|
||||||
path,
|
|
||||||
target
|
|
||||||
).yellow().bold());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let opt_str = if opt { " with optimizations" } else { "" };
|
let opt_str = if opt { " with optimizations" } else { "" };
|
||||||
eprintln!("{}", format!(
|
eprintln!("{}", format!(
|
||||||
"## Running run-pass tests in {} against miri for target {}{}",
|
"## Running run-pass tests in {} against miri for target {}{}",
|
||||||
@@ -105,10 +83,6 @@ fn miri_pass(sysroot: &Path, path: &str, target: &str, host: &str, need_fullmir:
|
|||||||
// whitelist.
|
// whitelist.
|
||||||
flags.push("-Zmir-opt-level=1".to_owned());
|
flags.push("-Zmir-opt-level=1".to_owned());
|
||||||
}
|
}
|
||||||
if !have_fullmir() {
|
|
||||||
// FIXME: Validation relies on the EscapeToRaw statements being emitted
|
|
||||||
flags.push("-Zmiri-disable-validation".to_owned());
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut config = mk_config("ui");
|
let mut config = mk_config("ui");
|
||||||
config.src_base = PathBuf::from(path);
|
config.src_base = PathBuf::from(path);
|
||||||
@@ -132,7 +106,7 @@ fn target_has_std<P: Into<PathBuf>>(path: P) -> bool {
|
|||||||
.map(|entry| entry.unwrap())
|
.map(|entry| entry.unwrap())
|
||||||
.filter(|entry| entry.file_type().unwrap().is_file())
|
.filter(|entry| entry.file_type().unwrap().is_file())
|
||||||
.filter_map(|entry| entry.file_name().into_string().ok())
|
.filter_map(|entry| entry.file_name().into_string().ok())
|
||||||
.any(|file_name| file_name.starts_with("libstd") && file_name.ends_with(".rlib"))
|
.any(|file_name| file_name == "libstd.rlib")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -186,18 +160,17 @@ fn run_pass_miri(opt: bool) {
|
|||||||
let host = get_host();
|
let host = get_host();
|
||||||
|
|
||||||
for_all_targets(&sysroot, |target| {
|
for_all_targets(&sysroot, |target| {
|
||||||
miri_pass(&sysroot, "tests/run-pass", &target, &host, false, opt);
|
miri_pass(&sysroot, "tests/run-pass", &target, &host, opt);
|
||||||
});
|
});
|
||||||
miri_pass(&sysroot, "tests/run-pass-fullmir", &host, &host, true, opt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compile_fail_miri(opt: bool) {
|
fn compile_fail_miri(opt: bool) {
|
||||||
let sysroot = get_sysroot();
|
let sysroot = get_sysroot();
|
||||||
let host = get_host();
|
let host = get_host();
|
||||||
|
|
||||||
// FIXME: run tests for other targets, too
|
for_all_targets(&sysroot, |target| {
|
||||||
compile_fail(&sysroot, "tests/compile-fail", &host, &host, false, opt);
|
compile_fail(&sysroot, "tests/compile-fail", &target, &host, opt);
|
||||||
compile_fail(&sysroot, "tests/compile-fail-fullmir", &host, &host, true, opt);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_runner(_tests: &[&()]) {
|
fn test_runner(_tests: &[&()]) {
|
||||||
|
|||||||
Reference in New Issue
Block a user