From 9f742466f178bc7d1a2952053fd5f62a663e8494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= Date: Mon, 20 Apr 2020 18:57:56 +0200 Subject: [PATCH] Update tests for windows-gnu --- crates/cargo-test-support/src/cross_compile.rs | 2 ++ tests/testsuite/build.rs | 13 +++++++++++-- tests/testsuite/build_script.rs | 3 ++- tests/testsuite/out_dir.rs | 17 +++++++++++++++-- tests/testsuite/plugins.rs | 3 ++- tests/testsuite/standard_lib.rs | 6 ++++++ 6 files changed, 38 insertions(+), 6 deletions(-) diff --git a/crates/cargo-test-support/src/cross_compile.rs b/crates/cargo-test-support/src/cross_compile.rs index 771a5228405..7d3ec335301 100644 --- a/crates/cargo-test-support/src/cross_compile.rs +++ b/crates/cargo-test-support/src/cross_compile.rs @@ -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."); } diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index 6adb4d7458e..b116635b3d9 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -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 { @@ -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 { diff --git a/tests/testsuite/build_script.rs b/tests/testsuite/build_script.rs index 701852c1eb4..eb79675f79b 100644 --- a/tests/testsuite/build_script.rs +++ b/tests/testsuite/build_script.rs @@ -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(); } diff --git a/tests/testsuite/out_dir.rs b/tests/testsuite/out_dir.rs index f3301a0a088..d68bf27bdb7 100644 --- a/tests/testsuite/out_dir.rs +++ b/tests/testsuite/out_dir.rs @@ -20,6 +20,7 @@ fn binary_with_debug() { &["foo"], &["foo", "foo.dSYM"], &["foo.exe", "foo.pdb"], + &["foo.exe"], ); } @@ -55,6 +56,7 @@ fn static_library_with_debug() { &["libfoo.a"], &["libfoo.a"], &["foo.lib"], + &["libfoo.a"], ); } @@ -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"], ); } @@ -124,6 +128,7 @@ fn rlib_with_debug() { &["libfoo.rlib"], &["libfoo.rlib"], &["libfoo.rlib"], + &["libfoo.rlib"], ); } @@ -167,6 +172,7 @@ fn include_only_the_binary_from_the_current_package() { &["foo"], &["foo", "foo.dSYM"], &["foo.exe", "foo.pdb"], + &["foo.exe"], ); } @@ -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"], ); } @@ -266,6 +273,7 @@ fn cargo_build_out_dir() { &["foo"], &["foo", "foo.dSYM"], &["foo.exe", "foo.pdb"], + &["foo.exe"], ); } @@ -273,10 +281,15 @@ 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 { diff --git a/tests/testsuite/plugins.rs b/tests/testsuite/plugins.rs index 7bd5b7772ab..f714399f892 100644 --- a/tests/testsuite/plugins.rs +++ b/tests/testsuite/plugins.rs @@ -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(); } diff --git a/tests/testsuite/standard_lib.rs b/tests/testsuite/standard_lib.rs index bfaad60a50c..74205d9cfc9 100644 --- a/tests/testsuite/standard_lib.rs +++ b/tests/testsuite/standard_lib.rs @@ -21,6 +21,12 @@ fn setup() -> Option { 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.