Skip to content

Commit 605c82b

Browse files
authored
Merge pull request rust-lang#343 from RalfJung/tests
use ui test mode rather than mir-opt
2 parents 6d4840e + e7b0637 commit 605c82b

File tree

10 files changed

+14
-10
lines changed

10 files changed

+14
-10
lines changed

miri/fn_call.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator>
340340
Err(_) => -1,
341341
}
342342
} else {
343-
info!("Ignored output to FD {}", fd);
343+
warn!("Ignored output to FD {}", fd);
344344
n as isize // pretend it all went well
345345
}; // now result is the value we return back to the program
346346
self.write_primval(
@@ -456,7 +456,7 @@ impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator>
456456

457457
// Stub out all the other pthread calls to just return 0
458458
link_name if link_name.starts_with("pthread_") => {
459-
warn!("ignoring C ABI call: {}", link_name);
459+
info!("ignoring C ABI call: {}", link_name);
460460
self.write_null(dest, dest_ty)?;
461461
}
462462

@@ -616,7 +616,7 @@ impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator>
616616
// A Rust function is missing, which means we are running with MIR missing for libstd (or other dependencies).
617617
// Still, we can make many things mostly work by "emulating" or ignoring some functions.
618618
"std::io::_print" => {
619-
trace!(
619+
warn!(
620620
"Ignoring output. To run programs that print, make sure you have a libstd with full MIR."
621621
);
622622
}

tests/compiletest.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ extern crate compiletest_rs as compiletest;
55
use std::slice::SliceConcatExt;
66
use std::path::{PathBuf, Path};
77
use std::io::Write;
8+
use std::env;
89

910
macro_rules! eprintln {
1011
($($arg:tt)*) => {
@@ -90,7 +91,7 @@ fn miri_pass(path: &str, target: &str, host: &str, fullmir: bool, opt: bool) {
9091
opt_str
9192
);
9293
let mut config = compiletest::Config::default().tempdir();
93-
config.mode = "mir-opt".parse().expect("Invalid mode");
94+
config.mode = "ui".parse().expect("Invalid mode");
9495
config.src_base = PathBuf::from(path);
9596
config.target = target.to_owned();
9697
config.host = host.to_owned();
@@ -100,6 +101,9 @@ fn miri_pass(path: &str, target: &str, host: &str, fullmir: bool, opt: bool) {
100101
config.compile_lib_path = rustc_lib_path();
101102
}
102103
let mut flags = Vec::new();
104+
// Control miri logging. This is okay despite concurrent test execution as all tests
105+
// will set this env var to the same value.
106+
env::set_var("MIRI_LOG", "warn");
103107
// if we are building as part of the rustc test suite, we already have fullmir for everything
104108
if fullmir && rustc_test_suite().is_none() {
105109
if host != target {
@@ -122,9 +126,6 @@ fn miri_pass(path: &str, target: &str, host: &str, fullmir: bool, opt: bool) {
122126
flags.push("--miri_host_target".to_owned());
123127
}
124128
config.target_rustcflags = Some(flags.join(" "));
125-
// don't actually execute the final binary, it might be for other targets and we only care
126-
// about running miri, not the binary.
127-
config.runtool = Some("echo \"\" || ".to_owned());
128129
compiletest::run_tests(&config);
129130
}
130131

tests/run-pass-fullmir/catch.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,5 @@ use std::panic::{catch_unwind, AssertUnwindSafe};
33
fn main() {
44
let mut i = 3;
55
let _ = catch_unwind(AssertUnwindSafe(|| {i -= 2;} ));
6-
for _ in 0..i {
7-
println!("I");
8-
}
6+
println!("{}", i);
97
}

tests/run-pass-fullmir/catch.stdout

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1
File renamed without changes.

tests/run-pass-fullmir/format.stdout

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello 13
File renamed without changes.

tests/run-pass-fullmir/hello.stdout

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello, world!
File renamed without changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
S { s: 5 }
2+
S { s: 5 }

0 commit comments

Comments
 (0)