@@ -7,6 +7,7 @@ use std::env;
7
7
use std:: fs:: { self , File } ;
8
8
use std:: io:: prelude:: * ;
9
9
10
+ use cargo:: util:: paths:: dylib_path_envvar;
10
11
use cargo:: util:: process;
11
12
use cargotest:: { is_nightly, rustc_host, sleep_ms} ;
12
13
use cargotest:: support:: paths:: { CargoPathExt , root} ;
@@ -984,6 +985,47 @@ fn crate_authors_env_vars() {
984
985
execs ( ) . with_status ( 0 ) ) ;
985
986
}
986
987
988
+ // Regression test for #4277
989
+ #[ test]
990
+ fn crate_library_path_env_var ( ) {
991
+ let mut p = project ( "foo" ) ;
992
+
993
+ p = p. file ( "Cargo.toml" , r#"
994
+ [project]
995
+ name = "foo"
996
+ version = "0.0.1"
997
+ authors = []
998
+ "# )
999
+ . file ( "src/main.rs" , & format ! ( r##"
1000
+ fn main() {{
1001
+ let search_path = env!("{}");
1002
+ let paths = std::env::split_paths(&search_path).collect::<Vec<_>>();
1003
+ assert!(!paths.contains(&"".into()));
1004
+ }}
1005
+ "## , dylib_path_envvar( ) ) ) ;
1006
+
1007
+ assert_that ( p. cargo_process ( "run" ) , execs ( ) . with_status ( 0 ) ) ;
1008
+ }
1009
+
1010
+ // Regression test for #4277
1011
+ #[ test]
1012
+ fn build_with_fake_libc_not_loading ( ) {
1013
+ let p = project ( "foo" )
1014
+ . file ( "Cargo.toml" , r#"
1015
+ [package]
1016
+ name = "foo"
1017
+ version = "0.0.1"
1018
+ authors = []
1019
+ "# )
1020
+ . file ( "src/main.rs" , r#"
1021
+ fn main() {}
1022
+ "# )
1023
+ . file ( "src/lib.rs" , r#" "# )
1024
+ . file ( "libc.so.6" , r#""# ) ;
1025
+
1026
+ assert_that ( p. cargo_process ( "build" ) , execs ( ) . with_status ( 0 ) ) ;
1027
+ }
1028
+
987
1029
// this is testing that src/<pkg-name>.rs still works (for now)
988
1030
#[ test]
989
1031
fn many_crate_types_old_style_lib_location ( ) {
0 commit comments