Merge branch 'master' into sanity_checks

This commit is contained in:
Ralf Jung 2018-07-30 08:51:34 +02:00 committed by GitHub
commit bb6e7c8243
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 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx> for EvalContext<'a, 'mir, '
// 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 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx> for EvalContext<'a, 'mir, '
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 colored::*;
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);
}