1
1
//! Tests for build.rs scripts.
2
2
3
- use cargo_test_support:: project_in_home;
4
3
use cargo_test_support:: registry:: Package ;
5
4
use cargo_test_support:: { basic_manifest, cross_compile, is_coarse_mtime, project} ;
6
5
use cargo_test_support:: { lines_match, paths:: CargoPathExt } ;
@@ -2608,41 +2607,35 @@ fn generate_good_d_files() {
2608
2607
// this is here to stop regression on an issue where build.rs rerun-if-changed paths aren't
2609
2608
// made absolute properly, which in turn interacts poorly with the dep-info-basedir setting,
2610
2609
// and the dep-info files have other-crate-relative paths spat out in them
2611
- let dep = project_in_home ( "awoo" )
2610
+ let p = project ( )
2612
2611
. file (
2613
- "Cargo.toml" ,
2612
+ "awoo/ Cargo.toml" ,
2614
2613
r#"
2615
2614
[project]
2616
2615
name = "awoo"
2617
2616
version = "0.5.0"
2618
2617
build = "build.rs"
2619
2618
"# ,
2620
2619
)
2621
- . file ( "src/lib.rs" , "" )
2620
+ . file ( "awoo/ src/lib.rs" , "" )
2622
2621
. file (
2623
- "build.rs" ,
2622
+ "awoo/ build.rs" ,
2624
2623
r#"
2625
2624
fn main() {
2626
2625
println!("cargo:rerun-if-changed=build.rs");
2627
2626
println!("cargo:rerun-if-changed=barkbarkbark");
2628
2627
}
2629
2628
"# ,
2630
2629
)
2631
- . build ( ) ;
2632
-
2633
- let p = project_in_home ( "meow" )
2634
2630
. file (
2635
2631
"Cargo.toml" ,
2636
- & format ! (
2637
- r#"
2632
+ r#"
2638
2633
[project]
2639
2634
name = "meow"
2640
2635
version = "0.5.0"
2641
2636
[dependencies]
2642
- awoo = {{ path = "{path}" } }
2637
+ awoo = { path = "awoo" }
2643
2638
"# ,
2644
- path = dep. root( ) . to_str( ) . unwrap( ) ,
2645
- ) ,
2646
2639
)
2647
2640
. file ( "src/main.rs" , "fn main() {}" )
2648
2641
. build ( ) ;
@@ -2666,7 +2659,9 @@ fn generate_good_d_files() {
2666
2659
) ;
2667
2660
2668
2661
// paths relative to dependency roots should not be allowed
2669
- assert ! ( !dot_d. split_whitespace( ) . any( |v| v == "build.rs" ) ) ;
2662
+ assert ! ( !dot_d
2663
+ . split_whitespace( )
2664
+ . any( |v| v == "barkbarkbark" || v == "build.rs" ) ) ;
2670
2665
2671
2666
p. change_file (
2672
2667
".cargo/config.toml" ,
@@ -2683,16 +2678,18 @@ fn generate_good_d_files() {
2683
2678
2684
2679
assert ! (
2685
2680
lines_match(
2686
- "target/debug/meow: [..]/ awoo/barkbarkbark [..]/ awoo/build.rs[..]" ,
2681
+ "target/debug/meow: [..]awoo/barkbarkbark [..]awoo/build.rs[..]" ,
2687
2682
& dot_d
2688
2683
) || lines_match(
2689
- "target/debug/meow: [..]/ awoo/build.rs [..]/ awoo/barkbarkbark[..]" ,
2684
+ "target/debug/meow: [..]awoo/build.rs [..]awoo/barkbarkbark[..]" ,
2690
2685
& dot_d
2691
2686
)
2692
2687
) ;
2693
2688
2694
2689
// paths relative to dependency roots should not be allowed
2695
- assert ! ( !dot_d. split_whitespace( ) . any( |v| v == "build.rs" ) ) ;
2690
+ assert ! ( !dot_d
2691
+ . split_whitespace( )
2692
+ . any( |v| v == "barkbarkbark" || v == "build.rs" ) ) ;
2696
2693
}
2697
2694
2698
2695
#[ cargo_test]
0 commit comments