1 extern crate compiletest_rs as compiletest;
3 use std::path::PathBuf;
5 fn run_mode(mode: &'static str) {
6 // FIXME: read directories in sysroot/lib/rustlib and generate the test targets from that
7 let targets = &["x86_64-unknown-linux-gnu", "i686-unknown-linux-gnu"];
9 for &target in targets {
10 let mut config = compiletest::default_config();
11 config.rustc_path = "target/debug/miri".into();
12 let path = std::env::var("RUST_SYSROOT").expect("env variable `RUST_SYSROOT` not set");
13 config.run_lib_path = format!("{}/lib/rustlib/{}/lib", path, target);
14 let path = format!("--sysroot {}", path);
15 config.target_rustcflags = Some(path.clone());
16 config.host_rustcflags = Some(path);
17 let cfg_mode = mode.parse().ok().expect("Invalid mode");
19 config.mode = cfg_mode;
20 config.src_base = PathBuf::from(format!("tests/{}", mode));
21 config.target = target.to_owned();
22 compiletest::run_tests(&config);
28 run_mode("compile-fail");