Skip to content

use ui test mode rather than mir-opt #343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions miri/fn_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator>
Err(_) => -1,
}
} else {
info!("Ignored output to FD {}", fd);
warn!("Ignored output to FD {}", fd);
n as isize // pretend it all went well
}; // now result is the value we return back to the program
self.write_primval(
Expand Down Expand Up @@ -456,7 +456,7 @@ impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator>

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

Expand Down Expand Up @@ -616,7 +616,7 @@ impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator>
// 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" => {
trace!(
warn!(
"Ignoring output. To run programs that print, make sure you have a libstd with full MIR."
);
}
Expand Down
9 changes: 5 additions & 4 deletions tests/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ extern crate compiletest_rs as compiletest;
use std::slice::SliceConcatExt;
use std::path::{PathBuf, Path};
use std::io::Write;
use std::env;

macro_rules! eprintln {
($($arg:tt)*) => {
Expand Down Expand Up @@ -90,7 +91,7 @@ fn miri_pass(path: &str, target: &str, host: &str, fullmir: bool, opt: bool) {
opt_str
);
let mut config = compiletest::Config::default().tempdir();
config.mode = "mir-opt".parse().expect("Invalid mode");
config.mode = "ui".parse().expect("Invalid mode");
config.src_base = PathBuf::from(path);
config.target = target.to_owned();
config.host = host.to_owned();
Expand All @@ -100,6 +101,9 @@ fn miri_pass(path: &str, target: &str, host: &str, fullmir: bool, opt: bool) {
config.compile_lib_path = rustc_lib_path();
}
let mut flags = Vec::new();
// 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");
// if we are building as part of the rustc test suite, we already have fullmir for everything
if fullmir && rustc_test_suite().is_none() {
if host != target {
Expand All @@ -122,9 +126,6 @@ fn miri_pass(path: &str, target: &str, host: &str, fullmir: bool, opt: bool) {
flags.push("--miri_host_target".to_owned());
}
config.target_rustcflags = Some(flags.join(" "));
// don't actually execute the final binary, it might be for other targets and we only care
// about running miri, not the binary.
config.runtool = Some("echo \"\" || ".to_owned());
compiletest::run_tests(&config);
}

Expand Down
4 changes: 1 addition & 3 deletions tests/run-pass-fullmir/catch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ use std::panic::{catch_unwind, AssertUnwindSafe};
fn main() {
let mut i = 3;
let _ = catch_unwind(AssertUnwindSafe(|| {i -= 2;} ));
for _ in 0..i {
println!("I");
}
println!("{}", i);
}
1 change: 1 addition & 0 deletions tests/run-pass-fullmir/catch.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
File renamed without changes.
1 change: 1 addition & 0 deletions tests/run-pass-fullmir/format.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello 13
File renamed without changes.
1 change: 1 addition & 0 deletions tests/run-pass-fullmir/hello.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello, world!
File renamed without changes.
2 changes: 2 additions & 0 deletions tests/run-pass-fullmir/issue-3794.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
S { s: 5 }
S { s: 5 }