]> git.lizzy.rs Git - rust.git/blob - tests/run-fail/inception.rs
25eb72aa04c23ce5b63bf4eb4423ed459bdcedda
[rust.git] / tests / run-fail / inception.rs
1 // error-pattern:no mir for DefId
2
3 use std::env;
4 use std::process::{Command, Output};
5
6 fn run_miri(file: &str, sysroot: &str) -> Output {
7     let path = env::current_dir().unwrap();
8     let libpath = path.join("target").join("debug");
9     let libpath = libpath.to_str().unwrap();
10     let libpath2 = path.join("target").join("debug").join("deps");
11     let libpath2 = libpath2.to_str().unwrap();
12     Command::new("cargo")
13         .args(&[
14             "run", "--",
15             "--sysroot", sysroot,
16             "-L", libpath,
17             "-L", libpath2,
18             file
19         ])
20         .output()
21         .unwrap_or_else(|e| panic!("failed to execute process: {}", e))
22 }
23
24 fn main() {
25     let sysroot = env::var("RUST_SYSROOT").expect("env variable `RUST_SYSROOT` not set");
26     let test_run = run_miri("src/bin/miri.rs", &sysroot);
27
28     if test_run.status.code().unwrap_or(-1) != 0 {
29         println!("{}", String::from_utf8(test_run.stdout).unwrap());
30         panic!("{}", String::from_utf8(test_run.stderr).unwrap());
31     }
32 }