diff --git a/.travis.yml b/.travis.yml index 9aa632da05e..d05661a4848 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,9 +30,19 @@ script: RUST_BACKTRACE=1 cargo test --release --all-features --all && cargo install --all-features --force - | - # Test cargo miri + # Test `cargo miri` cd cargo-miri-test && - cargo miri && + if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + MIRI_SYSROOT=~/.xargo/HOST cargo miri -q -- -Zmiri-start-fn + else + MIRI_SYSROOT=~/.xargo/HOST cargo miri -q -- -Zmiri-start-fn >stdout.real 2>stderr.real && + cat stdout.real stderr.real && + # Test `cargo miri` output. Not on mac because output redirecting doesn't + # work. There is no error. It just stops CI. + diff -u stdout.ref stdout.real && + diff -u stderr.ref stderr.real + fi && + # Test `cargo miri test` #cargo miri test && cd .. - | diff --git a/cargo-miri-test/.gitignore b/cargo-miri-test/.gitignore new file mode 100644 index 00000000000..56f307a7fb1 --- /dev/null +++ b/cargo-miri-test/.gitignore @@ -0,0 +1 @@ +*.real diff --git a/cargo-miri-test/src/main.rs b/cargo-miri-test/src/main.rs index 07b0e4cee4e..3fb265f6a7b 100644 --- a/cargo-miri-test/src/main.rs +++ b/cargo-miri-test/src/main.rs @@ -6,4 +6,6 @@ fn main() { let buf = &[1,2,3,4]; let n = ::read_u32(buf); assert_eq!(n, 0x01020304); + //println!("{:#x}", n); FIXME enable once memrchr works in miri + eprintln!("standard error"); } diff --git a/cargo-miri-test/stderr.ref b/cargo-miri-test/stderr.ref new file mode 100644 index 00000000000..aa7d1a2bdec --- /dev/null +++ b/cargo-miri-test/stderr.ref @@ -0,0 +1 @@ +standard error diff --git a/cargo-miri-test/stdout.ref b/cargo-miri-test/stdout.ref new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/fn_call.rs b/src/fn_call.rs index 31b3b4b18d1..9dfff9f5539 100644 --- a/src/fn_call.rs +++ b/src/fn_call.rs @@ -612,7 +612,7 @@ fn call_foreign_item( // Stub out all the other pthread calls to just return 0 link_name if link_name.starts_with("pthread_") => { - info!("ignoring C ABI call: {}", link_name); + debug!("ignoring C ABI call: {}", link_name); self.write_null(dest, dest_ty)?; } @@ -759,7 +759,8 @@ fn call_missing_fn( match &path[..] { // A Rust function is missing, which means we are running with MIR missing for libstd (or other dependencies). // Still, we can make many things mostly work by "emulating" or ignoring some functions. - "std::io::_print" => { + "std::io::_print" | + "std::io::_eprint" => { warn!( "Ignoring output. To run programs that print, make sure you have a libstd with full MIR." ); diff --git a/tests/compiletest.rs b/tests/compiletest.rs index 38d80696728..82a2144a337 100644 --- a/tests/compiletest.rs +++ b/tests/compiletest.rs @@ -8,7 +8,6 @@ use std::slice::SliceConcatExt; use std::path::{PathBuf, Path}; use std::io::Write; -use std::env; macro_rules! eprintln { ($($arg:tt)*) => { @@ -111,9 +110,6 @@ fn miri_pass(sysroot: &Path, path: &str, target: &str, host: &str, need_fullmir: // For now, only validate without optimizations. Inlining breaks validation. flags.push("-Zmir-emit-validate=1".to_owned()); } - // Control miri logging. This is okay despite concurrent test execution as all tests - // will set this env var to the same value. - env::set_var("MIRI_LOG", "warn"); config.target_rustcflags = Some(flags.join(" ")); compiletest::run_tests(&config); }