Skip to content

Commit 0943b5c

Browse files
author
Greg Morenz
committed
Modify test to work on windows
1 parent 2771674 commit 0943b5c

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

tests/testsuite/build_script.rs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5828,6 +5828,25 @@ fn links_overrides_with_target_applies_to_host() {
58285828
.with_status(0)
58295829
.run();
58305830

5831+
// The name is different on windows because ".dll" is not automatically
5832+
// appenended like the extension on other OSes is, despite being needed.
5833+
5834+
// The path is different on windows because we need the "name.dll.lib" file
5835+
// to link to it, and as per #3934 that only lives in `target/{profile}/deps`
5836+
// and isn't copied to `target/{profile}` like the .dll is. #3951 removed the
5837+
// hash mentioned in #3934 but did not change the directory of the .lib file.
5838+
5839+
// Meanwhile on other operating systems everything we need to link (which is
5840+
// just the linux .so/the macos .dylib) is copied to `target/{profile}` from
5841+
// `deps` and as the blessed output artifact that seems to be the appropriate
5842+
// version to use.
5843+
let mylib_name = if cfg!(windows) { "mylib.dll" } else { "mylib" };
5844+
let mylib_path = if cfg!(windows) {
5845+
"mylib-c/target/debug/deps"
5846+
} else {
5847+
"mylib-c/target/debug"
5848+
};
5849+
58315850
p.cargo("build")
58325851
.masquerade_as_nightly_cargo(&["target-applies-to-host"])
58335852
.args(&[
@@ -5837,10 +5856,13 @@ fn links_overrides_with_target_applies_to_host() {
58375856
])
58385857
.args(&[
58395858
"--config",
5840-
&format!(r#"target.{}.mylib.rustc-link-lib=["mylib"]"#, rustc_host()),
5859+
&format!(
5860+
r#"target.{}.mylib.rustc-link-lib=["{mylib_name}"]"#,
5861+
rustc_host()
5862+
),
58415863
"--config",
58425864
&format!(
5843-
r#"target.{}.mylib.rustc-link-search=["mylib-c/target/debug"]"#,
5865+
r#"target.{}.mylib.rustc-link-search=["{mylib_path}"]"#,
58445866
rustc_host()
58455867
),
58465868
])

0 commit comments

Comments
 (0)