Add a build script to inform the binary about its profile, and use that in the test suite
This commit is contained in:
parent
f7bc6ab162
commit
de1376f923
@ -5,6 +5,7 @@ license = "MIT/Apache-2.0"
|
||||
name = "miri"
|
||||
repository = "https://github.com/solson/miri"
|
||||
version = "0.1.0"
|
||||
build = "build.rs"
|
||||
|
||||
[[bin]]
|
||||
doc = false
|
||||
|
6
build.rs
Normal file
6
build.rs
Normal file
@ -0,0 +1,6 @@
|
||||
use std::env;
|
||||
|
||||
fn main() {
|
||||
// Forward the profile to the main compilation
|
||||
println!("cargo:rustc-env=PROFILE={}", env::var("PROFILE").unwrap());
|
||||
}
|
@ -13,16 +13,15 @@ macro_rules! eprintln {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
const MIRI_PATH: &str = "target/debug/miri";
|
||||
#[cfg(not(debug_assertions))]
|
||||
const MIRI_PATH: &str = "target/release/miri";
|
||||
fn miri_path() -> String {
|
||||
format!("target/{}/miri", env!("PROFILE"))
|
||||
}
|
||||
|
||||
fn compile_fail(sysroot: &Path, path: &str, target: &str, host: &str, fullmir: bool) {
|
||||
eprintln!("## Running compile-fail tests in {} against miri for target {}", path, target);
|
||||
let mut config = compiletest::default_config();
|
||||
config.mode = "compile-fail".parse().expect("Invalid mode");
|
||||
config.rustc_path = MIRI_PATH.into();
|
||||
config.rustc_path = miri_path().into();
|
||||
if fullmir {
|
||||
if host != target {
|
||||
// skip fullmir on nonhost
|
||||
@ -61,7 +60,7 @@ fn miri_pass(path: &str, target: &str, host: &str, fullmir: bool, opt: bool) {
|
||||
config.src_base = PathBuf::from(path);
|
||||
config.target = target.to_owned();
|
||||
config.host = host.to_owned();
|
||||
config.rustc_path = MIRI_PATH.into();
|
||||
config.rustc_path = miri_path().into();
|
||||
let mut flags = Vec::new();
|
||||
if fullmir {
|
||||
if host != target {
|
||||
|
Loading…
x
Reference in New Issue
Block a user