Skip to content

Commit

Permalink
Update tests for windows-gnu
Browse files Browse the repository at this point in the history
  • Loading branch information
mati865 committed Apr 20, 2020
1 parent a2b791a commit 5aef423
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 6 deletions.
2 changes: 2 additions & 0 deletions crates/cargo-test-support/src/cross_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ pub fn alternate() -> &'static str {
"i686-unknown-linux-gnu"
} else if cfg!(all(target_os = "windows", target_env = "msvc")) {
"i686-pc-windows-msvc"
} else if cfg!(all(target_os = "windows", target_env = "gnu")) {
"i686-pc-windows-gnu"
} else {
panic!("This test should be gated on cross_compile::disabled.");
}
Expand Down
13 changes: 11 additions & 2 deletions tests/testsuite/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3769,7 +3769,11 @@ fn cdylib_not_lifted() {
p.cargo("build").run();

let files = if cfg!(windows) {
vec!["foo.dll.lib", "foo.dll.exp", "foo.dll"]
if cfg!(target_env = "msvc") {
vec!["foo.dll.lib", "foo.dll.exp", "foo.dll"]
} else {
vec!["libfoo.dll.a", "foo.dll"]
}
} else if cfg!(target_os = "macos") {
vec!["libfoo.dylib"]
} else {
Expand Down Expand Up @@ -3803,7 +3807,12 @@ fn cdylib_final_outputs() {
p.cargo("build").run();

let files = if cfg!(windows) {
vec!["foo_bar.dll.lib", "foo_bar.dll"]
if cfg!(target_env = "msvc") {
vec!["foo_bar.dll.lib", "foo_bar.dll"]
} else {
// FIXME https://github.com/rust-lang/cargo/pull/6875
vec!["foo_bar.dll"]
}
} else if cfg!(target_os = "macos") {
vec!["libfoo_bar.dylib"]
} else {
Expand Down
3 changes: 2 additions & 1 deletion tests/testsuite/build_script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1663,7 +1663,8 @@ fn build_script_with_dynamic_native_dependency() {
let src = root.join(&file);
let dst = out_dir.join(&file);
fs::copy(src, dst).unwrap();
if cfg!(windows) {
// FIXME https://github.com/rust-lang/cargo/pull/6875
if cfg!(target_env = "msvc") {
fs::copy(root.join("builder.dll.lib"),
out_dir.join("builder.dll.lib")).unwrap();
}
Expand Down
17 changes: 15 additions & 2 deletions tests/testsuite/out_dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fn binary_with_debug() {
&["foo"],
&["foo", "foo.dSYM"],
&["foo.exe", "foo.pdb"],
&["foo.exe"],
);
}

Expand Down Expand Up @@ -55,6 +56,7 @@ fn static_library_with_debug() {
&["libfoo.a"],
&["libfoo.a"],
&["foo.lib"],
&["libfoo.a"],
);
}

Expand Down Expand Up @@ -90,6 +92,8 @@ fn dynamic_library_with_debug() {
&["libfoo.so"],
&["libfoo.dylib"],
&["foo.dll", "foo.dll.lib"],
// FIXME https://github.com/rust-lang/cargo/pull/6875
&["foo.dll"],
);
}

Expand Down Expand Up @@ -124,6 +128,7 @@ fn rlib_with_debug() {
&["libfoo.rlib"],
&["libfoo.rlib"],
&["libfoo.rlib"],
&["libfoo.rlib"],
);
}

Expand Down Expand Up @@ -167,6 +172,7 @@ fn include_only_the_binary_from_the_current_package() {
&["foo"],
&["foo", "foo.dSYM"],
&["foo.exe", "foo.pdb"],
&["foo.exe"],
);
}

Expand Down Expand Up @@ -242,6 +248,7 @@ fn avoid_build_scripts() {
&["a", "b"],
&["a", "a.dSYM", "b", "b.dSYM"],
&["a.exe", "a.pdb", "b.exe", "b.pdb"],
&["a.exe", "b.exe"],
);
}

Expand All @@ -266,17 +273,23 @@ fn cargo_build_out_dir() {
&["foo"],
&["foo", "foo.dSYM"],
&["foo.exe", "foo.pdb"],
&["foo.exe"],
);
}

fn check_dir_contents(
out_dir: &Path,
expected_linux: &[&str],
expected_mac: &[&str],
expected_win: &[&str],
expected_win_msvc: &[&str],
expected_win_gnu: &[&str],
) {
let expected = if cfg!(target_os = "windows") {
expected_win
if cfg!(target_env = "msvc") {
expected_win_msvc
} else {
expected_win_gnu
}
} else if cfg!(target_os = "macos") {
expected_mac
} else {
Expand Down
3 changes: 2 additions & 1 deletion tests/testsuite/plugins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ fn plugin_with_dynamic_native_dependency() {
let src = root.join(&file);
let dst = out_dir.join(&file);
fs::copy(src, dst).unwrap();
if cfg!(windows) {
// FIXME https://github.com/rust-lang/cargo/pull/6875
if cfg!(target_env = "msvc") {
fs::copy(root.join("builder.dll.lib"),
out_dir.join("builder.dll.lib")).unwrap();
}
Expand Down
6 changes: 6 additions & 0 deletions tests/testsuite/standard_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ fn setup() -> Option<Setup> {
return None;
}

if cfg!(all(target_os = "windows", target_env = "gnu")) {
// FIXME: contains object files that we don't handle yet:
// https://github.com/rust-lang/wg-cargo-std-aware/issues/46
return None;
}

// Our mock sysroot requires a few packages from crates.io, so make sure
// they're "published" to crates.io. Also edit their code a bit to make sure
// that they have access to our custom crates with custom apis.
Expand Down

0 comments on commit 5aef423

Please sign in to comment.