]> git.lizzy.rs Git - rust.git/commitdiff
fallout because compiletest tried to use rustc's log crate
authorOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>
Tue, 31 May 2016 14:41:26 +0000 (16:41 +0200)
committerOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>
Wed, 1 Jun 2016 09:47:55 +0000 (11:47 +0200)
tests/run-fail/inception.rs

index 25eb72aa04c23ce5b63bf4eb4423ed459bdcedda..f0fb4113f1f76debdd50bb533ec848af17ea4b69 100644 (file)
@@ -9,14 +9,32 @@ fn run_miri(file: &str, sysroot: &str) -> Output {
     let libpath = libpath.to_str().unwrap();
     let libpath2 = path.join("target").join("debug").join("deps");
     let libpath2 = libpath2.to_str().unwrap();
+    let mut args = vec![
+        "run".to_string(), "--".to_string(),
+        "--sysroot".to_string(), sysroot.to_string(),
+        "-L".to_string(), libpath.to_string(),
+        "-L".to_string(), libpath2.to_string(),
+        file.to_string()
+    ];
+    for file in std::fs::read_dir("target/debug/deps").unwrap() {
+        let file = file.unwrap();
+        if file.file_type().unwrap().is_file() {
+            let path = file.path();
+            if let Some(ext) = path.extension() {
+                if ext == "rlib" {
+                    let name = path.file_stem().unwrap().to_str().unwrap();
+                    if let Some(dash) = name.rfind('-') {
+                        if name.starts_with("lib") {
+                            args.push("--extern".to_string());
+                            args.push(format!("{}={}", &name[3..dash], path.to_str().unwrap()));
+                        }
+                    }
+                }
+            }
+        }
+    }
     Command::new("cargo")
-        .args(&[
-            "run", "--",
-            "--sysroot", sysroot,
-            "-L", libpath,
-            "-L", libpath2,
-            file
-        ])
+        .args(&args)
         .output()
         .unwrap_or_else(|e| panic!("failed to execute process: {}", e))
 }