Skip to content

Commit 5aef423

Browse files
committed
Update tests for windows-gnu
1 parent a2b791a commit 5aef423

File tree

6 files changed

+38
-6
lines changed

6 files changed

+38
-6
lines changed

crates/cargo-test-support/src/cross_compile.rs

+2
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ pub fn alternate() -> &'static str {
190190
"i686-unknown-linux-gnu"
191191
} else if cfg!(all(target_os = "windows", target_env = "msvc")) {
192192
"i686-pc-windows-msvc"
193+
} else if cfg!(all(target_os = "windows", target_env = "gnu")) {
194+
"i686-pc-windows-gnu"
193195
} else {
194196
panic!("This test should be gated on cross_compile::disabled.");
195197
}

tests/testsuite/build.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -3769,7 +3769,11 @@ fn cdylib_not_lifted() {
37693769
p.cargo("build").run();
37703770

37713771
let files = if cfg!(windows) {
3772-
vec!["foo.dll.lib", "foo.dll.exp", "foo.dll"]
3772+
if cfg!(target_env = "msvc") {
3773+
vec!["foo.dll.lib", "foo.dll.exp", "foo.dll"]
3774+
} else {
3775+
vec!["libfoo.dll.a", "foo.dll"]
3776+
}
37733777
} else if cfg!(target_os = "macos") {
37743778
vec!["libfoo.dylib"]
37753779
} else {
@@ -3803,7 +3807,12 @@ fn cdylib_final_outputs() {
38033807
p.cargo("build").run();
38043808

38053809
let files = if cfg!(windows) {
3806-
vec!["foo_bar.dll.lib", "foo_bar.dll"]
3810+
if cfg!(target_env = "msvc") {
3811+
vec!["foo_bar.dll.lib", "foo_bar.dll"]
3812+
} else {
3813+
// FIXME https://github.com/rust-lang/cargo/pull/6875
3814+
vec!["foo_bar.dll"]
3815+
}
38073816
} else if cfg!(target_os = "macos") {
38083817
vec!["libfoo_bar.dylib"]
38093818
} else {

tests/testsuite/build_script.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1663,7 +1663,8 @@ fn build_script_with_dynamic_native_dependency() {
16631663
let src = root.join(&file);
16641664
let dst = out_dir.join(&file);
16651665
fs::copy(src, dst).unwrap();
1666-
if cfg!(windows) {
1666+
// FIXME https://github.com/rust-lang/cargo/pull/6875
1667+
if cfg!(target_env = "msvc") {
16671668
fs::copy(root.join("builder.dll.lib"),
16681669
out_dir.join("builder.dll.lib")).unwrap();
16691670
}

tests/testsuite/out_dir.rs

+15-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ fn binary_with_debug() {
2020
&["foo"],
2121
&["foo", "foo.dSYM"],
2222
&["foo.exe", "foo.pdb"],
23+
&["foo.exe"],
2324
);
2425
}
2526

@@ -55,6 +56,7 @@ fn static_library_with_debug() {
5556
&["libfoo.a"],
5657
&["libfoo.a"],
5758
&["foo.lib"],
59+
&["libfoo.a"],
5860
);
5961
}
6062

@@ -90,6 +92,8 @@ fn dynamic_library_with_debug() {
9092
&["libfoo.so"],
9193
&["libfoo.dylib"],
9294
&["foo.dll", "foo.dll.lib"],
95+
// FIXME https://github.com/rust-lang/cargo/pull/6875
96+
&["foo.dll"],
9397
);
9498
}
9599

@@ -124,6 +128,7 @@ fn rlib_with_debug() {
124128
&["libfoo.rlib"],
125129
&["libfoo.rlib"],
126130
&["libfoo.rlib"],
131+
&["libfoo.rlib"],
127132
);
128133
}
129134

@@ -167,6 +172,7 @@ fn include_only_the_binary_from_the_current_package() {
167172
&["foo"],
168173
&["foo", "foo.dSYM"],
169174
&["foo.exe", "foo.pdb"],
175+
&["foo.exe"],
170176
);
171177
}
172178

@@ -242,6 +248,7 @@ fn avoid_build_scripts() {
242248
&["a", "b"],
243249
&["a", "a.dSYM", "b", "b.dSYM"],
244250
&["a.exe", "a.pdb", "b.exe", "b.pdb"],
251+
&["a.exe", "b.exe"],
245252
);
246253
}
247254

@@ -266,17 +273,23 @@ fn cargo_build_out_dir() {
266273
&["foo"],
267274
&["foo", "foo.dSYM"],
268275
&["foo.exe", "foo.pdb"],
276+
&["foo.exe"],
269277
);
270278
}
271279

272280
fn check_dir_contents(
273281
out_dir: &Path,
274282
expected_linux: &[&str],
275283
expected_mac: &[&str],
276-
expected_win: &[&str],
284+
expected_win_msvc: &[&str],
285+
expected_win_gnu: &[&str],
277286
) {
278287
let expected = if cfg!(target_os = "windows") {
279-
expected_win
288+
if cfg!(target_env = "msvc") {
289+
expected_win_msvc
290+
} else {
291+
expected_win_gnu
292+
}
280293
} else if cfg!(target_os = "macos") {
281294
expected_mac
282295
} else {

tests/testsuite/plugins.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ fn plugin_with_dynamic_native_dependency() {
180180
let src = root.join(&file);
181181
let dst = out_dir.join(&file);
182182
fs::copy(src, dst).unwrap();
183-
if cfg!(windows) {
183+
// FIXME https://github.com/rust-lang/cargo/pull/6875
184+
if cfg!(target_env = "msvc") {
184185
fs::copy(root.join("builder.dll.lib"),
185186
out_dir.join("builder.dll.lib")).unwrap();
186187
}

tests/testsuite/standard_lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ fn setup() -> Option<Setup> {
2121
return None;
2222
}
2323

24+
if cfg!(all(target_os = "windows", target_env = "gnu")) {
25+
// FIXME: contains object files that we don't handle yet:
26+
// https://github.com/rust-lang/wg-cargo-std-aware/issues/46
27+
return None;
28+
}
29+
2430
// Our mock sysroot requires a few packages from crates.io, so make sure
2531
// they're "published" to crates.io. Also edit their code a bit to make sure
2632
// that they have access to our custom crates with custom apis.

0 commit comments

Comments
 (0)