Merge pull request #415 from RalfJung/cargo-miri
test `cargo miri` output
This commit is contained in:
commit
79d0a01fa5
14
.travis.yml
14
.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 ..
|
||||
- |
|
||||
|
1
cargo-miri-test/.gitignore
vendored
Normal file
1
cargo-miri-test/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.real
|
@ -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");
|
||||
}
|
||||
|
1
cargo-miri-test/stderr.ref
Normal file
1
cargo-miri-test/stderr.ref
Normal file
@ -0,0 +1 @@
|
||||
standard error
|
0
cargo-miri-test/stdout.ref
Normal file
0
cargo-miri-test/stdout.ref
Normal 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."
|
||||
);
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user