re-enable auxiliary tests for the host only

This commit is contained in:
Oliver Schneider
2016-12-19 15:46:03 +01:00
parent 3a658e09e8
commit 32cd8efb97
3 changed files with 24 additions and 8 deletions
+10 -1
View File
@@ -21,7 +21,10 @@ fn build_controller(&mut self, _: &Session, _: &getopts::Matches) -> CompileCont
let mut control = CompileController::basic();
control.after_hir_lowering.callback = Box::new(after_hir_lowering);
control.after_analysis.callback = Box::new(after_analysis);
control.after_analysis.stop = Compilation::Stop;
if std::env::var("MIRI_HOST_TARGET") != Ok("yes".to_owned()) {
// only fully compile targets on the host
control.after_analysis.stop = Compilation::Stop;
}
control
}
}
@@ -136,6 +139,12 @@ fn main() {
args.push(sysroot_flag);
args.push(find_sysroot());
}
// we run the optimization passes inside miri
// if we ran them twice we'd get funny failures due to borrowck ElaborateDrops only working on
// unoptimized MIR
// FIXME: add an after-mir-passes hook to rustc driver
args.push("-Zmir-opt-level=0".to_owned());
// for auxilary builds in unit tests
args.push("-Zalways-encode-mir".to_owned());
rustc_driver::run_compiler(&args, &mut MiriCompilerCalls, None, None);
+11 -3
View File
@@ -27,13 +27,20 @@ fn run_pass() {
compiletest::run_tests(&config);
}
fn miri_pass(path: &str, target: &str) {
fn miri_pass(path: &str, target: &str, host: &str) {
let mut config = compiletest::default_config();
config.mode = "mir-opt".parse().expect("Invalid mode");
config.src_base = PathBuf::from(path);
config.target = target.to_owned();
config.rustc_path = PathBuf::from("target/debug/miri");
// 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());
if target == host {
std::env::set_var("MIRI_HOST_TARGET", "yes");
}
compiletest::run_tests(&config);
std::env::set_var("MIRI_HOST_TARGET", "");
}
fn is_target_dir<P: Into<PathBuf>>(path: P) -> bool {
@@ -65,10 +72,11 @@ fn compile_test() {
.to_owned(),
};
run_pass();
let host = toolchain.unwrap().splitn(2, '-').skip(1).next().unwrap();
for_all_targets(&sysroot, |target| {
miri_pass("tests/run-pass", &target);
miri_pass("tests/run-pass", &target, host);
if let Ok(path) = std::env::var("MIRI_RUSTC_TEST") {
miri_pass(&path, &target);
miri_pass(&path, &target, host);
}
});
compile_fail(&sysroot);
+3 -4
View File
@@ -1,9 +1,8 @@
// aux-build:dep.rs
// ignore-cross-compile
// FIXME: Auxiliary builds are currently broken.
// extern crate dep;
extern crate dep;
fn main() {
// FIXME: Auxiliary builds are currently broken.
// dep::foo();
dep::foo();
}