let mut search_path = if is_host {
let mut search_path = vec![self.plugins_dylib_path.clone()];
- search_path.push(self.host_dylib_path.iter().collect());
+ search_path.extend(self.host_dylib_path.clone());
search_path
} else {
let mut search_path =
&self.root_output);
search_path.push(self.root_output.clone());
search_path.push(self.deps_output.clone());
- search_path.push(self.target_dylib_path.iter().collect());
+ search_path.extend(self.target_dylib_path.clone());
search_path
};
use std::fs::{self, File};
use std::io::prelude::*;
+use cargo::util::paths::dylib_path_envvar;
use cargo::util::process;
use cargotest::{is_nightly, rustc_host, sleep_ms};
use cargotest::support::paths::{CargoPathExt,root};
execs().with_status(0));
}
+// Regression test for #4277
+#[test]
+fn crate_library_path_env_var() {
+ let mut p = project("foo");
+
+ p = p.file("Cargo.toml", r#"
+ [project]
+ name = "foo"
+ version = "0.0.1"
+ authors = []
+ "#)
+ .file("src/main.rs", &format!(r##"
+ fn main() {{
+ let search_path = env!("{}");
+ let paths = std::env::split_paths(&search_path).collect::<Vec<_>>();
+ assert!(!paths.contains(&"".into()));
+ }}
+ "##, dylib_path_envvar()));
+
+ assert_that(p.cargo_process("run"), execs().with_status(0));
+}
+
+// Regression test for #4277
+#[test]
+fn build_with_fake_libc_not_loading() {
+ let p = project("foo")
+ .file("Cargo.toml", r#"
+ [package]
+ name = "foo"
+ version = "0.0.1"
+ authors = []
+ "#)
+ .file("src/main.rs", r#"
+ fn main() {}
+ "#)
+ .file("src/lib.rs", r#" "#)
+ .file("libc.so.6", r#""#);
+
+ assert_that(p.cargo_process("build"), execs().with_status(0));
+}
+
// this is testing that src/<pkg-name>.rs still works (for now)
#[test]
fn many_crate_types_old_style_lib_location() {