Skip to content

Commit 5bba21a

Browse files
committed
Fix the test on Windows
1 parent fc5840d commit 5bba21a

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

tests/testsuite/build_script.rs

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! Tests for build.rs scripts.
22
3-
use cargo_test_support::project_in_home;
43
use cargo_test_support::registry::Package;
54
use cargo_test_support::{basic_manifest, cross_compile, is_coarse_mtime, project};
65
use cargo_test_support::{lines_match, paths::CargoPathExt};
@@ -2608,41 +2607,35 @@ fn generate_good_d_files() {
26082607
// this is here to stop regression on an issue where build.rs rerun-if-changed paths aren't
26092608
// made absolute properly, which in turn interacts poorly with the dep-info-basedir setting,
26102609
// 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()
26122611
.file(
2613-
"Cargo.toml",
2612+
"awoo/Cargo.toml",
26142613
r#"
26152614
[project]
26162615
name = "awoo"
26172616
version = "0.5.0"
26182617
build = "build.rs"
26192618
"#,
26202619
)
2621-
.file("src/lib.rs", "")
2620+
.file("awoo/src/lib.rs", "")
26222621
.file(
2623-
"build.rs",
2622+
"awoo/build.rs",
26242623
r#"
26252624
fn main() {
26262625
println!("cargo:rerun-if-changed=build.rs");
26272626
println!("cargo:rerun-if-changed=barkbarkbark");
26282627
}
26292628
"#,
26302629
)
2631-
.build();
2632-
2633-
let p = project_in_home("meow")
26342630
.file(
26352631
"Cargo.toml",
2636-
&format!(
2637-
r#"
2632+
r#"
26382633
[project]
26392634
name = "meow"
26402635
version = "0.5.0"
26412636
[dependencies]
2642-
awoo = {{ path = "{path}" }}
2637+
awoo = { path = "awoo" }
26432638
"#,
2644-
path = dep.root().to_str().unwrap(),
2645-
),
26462639
)
26472640
.file("src/main.rs", "fn main() {}")
26482641
.build();
@@ -2666,7 +2659,9 @@ fn generate_good_d_files() {
26662659
);
26672660

26682661
// 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"));
26702665

26712666
p.change_file(
26722667
".cargo/config.toml",
@@ -2683,16 +2678,18 @@ fn generate_good_d_files() {
26832678

26842679
assert!(
26852680
lines_match(
2686-
"target/debug/meow: [..]/awoo/barkbarkbark [..]/awoo/build.rs[..]",
2681+
"target/debug/meow: [..]awoo/barkbarkbark [..]awoo/build.rs[..]",
26872682
&dot_d
26882683
) || lines_match(
2689-
"target/debug/meow: [..]/awoo/build.rs [..]/awoo/barkbarkbark[..]",
2684+
"target/debug/meow: [..]awoo/build.rs [..]awoo/barkbarkbark[..]",
26902685
&dot_d
26912686
)
26922687
);
26932688

26942689
// 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"));
26962693
}
26972694

26982695
#[cargo_test]

0 commit comments

Comments
 (0)