Merge pull request #415 from RalfJung/cargo-miri

test `cargo miri` output
This commit is contained in:
Ralf Jung 2018-07-26 18:27:44 +02:00 committed by GitHub
commit 79d0a01fa5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 8 deletions

View File

@ -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 ..
- |

1
cargo-miri-test/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.real

View File

@ -6,4 +6,6 @@ fn main() {
let buf = &[1,2,3,4];
let n = <BigEndian as ByteOrder>::read_u32(buf);
assert_eq!(n, 0x01020304);
//println!("{:#x}", n); FIXME enable once memrchr works in miri
eprintln!("standard error");
}

View File

@ -0,0 +1 @@
standard error

View File

View File

@ -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."
);

View File

@ -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);
}