Get the tests one step further

This commit is contained in:
Oliver Schneider 2018-03-18 13:18:41 +01:00
parent a3a01ba5b7
commit cd89e56f15
No known key found for this signature in database
GPG key ID: 1D5CB4FC597C3004
2 changed files with 9 additions and 7 deletions

View file

@ -106,7 +106,7 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx> for EvalContext<'a, 'mir, '
let def_id = instance.def_id();
let item_path = self.tcx.absolute_item_path_str(def_id);
if item_path.starts_with("std::") {
println!("{}", item_path);
//println!("{}", item_path);
}
match &*item_path {
"std::sys::unix::thread::guard::init" | "std::sys::unix::thread::guard::current" => {
@ -118,7 +118,9 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx> for EvalContext<'a, 'mir, '
let none_variant_index = adt_def.variants.iter().enumerate().find(|&(_i, ref def)| {
def.name.as_str() == "None"
}).expect("No None variant").0;
write_discriminant_value(self, ret_ty, destination.unwrap().0, none_variant_index)?;
let (return_place, return_to_block) = destination.unwrap();
write_discriminant_value(self, ret_ty, return_place, none_variant_index)?;
self.goto_block(return_to_block);
return Ok(true);
}
_ => panic!("Unexpected return type for {}", item_path)

View file

@ -53,10 +53,10 @@ fn compile_fail(sysroot: &Path, path: &str, target: &str, host: &str, fullmir: b
let sysroot = std::env::home_dir().unwrap()
.join(".xargo")
.join("HOST");
config.target_rustcflags = Some(format!("--sysroot {}", sysroot.to_str().unwrap()));
flags.push(format!("--sysroot {}", sysroot.to_str().unwrap()));
config.src_base = PathBuf::from(path.to_string());
} else {
config.target_rustcflags = Some(format!("--sysroot {}", sysroot.to_str().unwrap()));
flags.push(format!("--sysroot {}", sysroot.to_str().unwrap()));
config.src_base = PathBuf::from(path.to_string());
}
flags.push("-Zmir-emit-validate=1".to_owned());
@ -206,8 +206,8 @@ fn compile_fail_miri() {
let sysroot = get_sysroot();
let host = get_host();
for_all_targets(&sysroot, |target| {
compile_fail(&sysroot, "tests/compile-fail", &target, &host, false);
});
// FIXME: run tests for other targets, too
compile_fail(&sysroot, "tests/compile-fail", &host, &host, true);
compile_fail(&sysroot, "tests/compile-fail-fullmir", &host, &host, true);
}