X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=tests%2Fintegration.rs;h=a78273ce0da41238ae7a2f5ee4842b001cc8a61b;hb=e820a03d1c905d58b27d7ac6d85f450f9754ba79;hp=d14ced8ad4e739feae06da4a39775ea82830dfb4;hpb=f5b896451ac44fc45bdc78656176f2846f44891a;p=rust.git diff --git a/tests/integration.rs b/tests/integration.rs index d14ced8ad4e..a78273ce0da 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -1,8 +1,7 @@ #![cfg(feature = "integration")] -use git2::Repository; - use std::env; +use std::ffi::OsStr; use std::process::Command; #[cfg_attr(feature = "integration", test)] @@ -14,12 +13,19 @@ fn integration_test() { .nth(1) .expect("repo name should have format `/`"); - let repo_dir = tempfile::tempdir() - .expect("couldn't create temp dir") - .path() - .join(crate_name); + let mut repo_dir = tempfile::tempdir().expect("couldn't create temp dir").into_path(); + repo_dir.push(crate_name); - Repository::clone(&repo_url, &repo_dir).expect("clone of repo failed"); + let st = Command::new("git") + .args(&[ + OsStr::new("clone"), + OsStr::new("--depth=1"), + OsStr::new(&repo_url), + OsStr::new(&repo_dir), + ]) + .status() + .expect("unable to run git"); + assert!(st.success()); let root_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")); let target_dir = std::path::Path::new(&root_dir).join("target"); @@ -58,17 +64,19 @@ fn integration_test() { } else if stderr.contains("query stack during panic") { panic!("query stack during panic in the output"); } else if stderr.contains("E0463") { + // Encountering E0463 (can't find crate for `x`) did _not_ cause the build to fail in the + // past. Even though it should have. That's why we explicitly panic here. + // See PR #3552 and issue #3523 for more background. panic!("error: E0463"); + } else if stderr.contains("E0514") { + panic!("incompatible crate versions"); + } else if stderr.contains("failed to run `rustc` to learn about target-specific information") { + panic!("couldn't find librustc_driver, consider setting `LD_LIBRARY_PATH`"); } match output.status.code() { - Some(code) => { - if code == 0 { - println!("Compilation successful"); - } else { - eprintln!("Compilation failed. Exit code: {}", code); - } - }, + Some(0) => println!("Compilation successful"), + Some(code) => eprintln!("Compilation failed. Exit code: {}", code), None => panic!("Process terminated by signal"), } }