Skip to content

Commit 97d39ae

Browse files
committed
Auto merge of #8139 - mati865:patch-1, r=ehuss
Add windows-gnu CI and fix tests One remaining failure: ``` ---- features::feature_off_dylib stdout ---- running `d:\a\1\s\target\debug\cargo.exe build --features f1` running `d:\a\1\s\target\debug\cargo.exe run -p bar` thread 'features::feature_off_dylib' panicked at ' Expected: execs but: exited with exit code: 101 --- stdout --- stderr Compiling foo v0.0.1 (D:\a\1\s\target\cit\t663\foo) Compiling bar v0.0.1 (D:\a\1\s\target\cit\t663\foo\bar) Finished dev [unoptimized + debuginfo] target(s) in 0.69s Running `target\debug\bar.exe` thread 'main' panicked at 'assertion failed: `(left == right)` left: `"f1"`, right: `"no f1"`', bar\src\main.rs:5:17 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace error: process didn't exit successfully: `target\debug\bar.exe` (exit code: 101) ', crates\cargo-test-support\src\lib.rs:833:13 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace failures: features::feature_off_dylib ``` I disassembled the dylibs and `cargo run -p bar` correctly rebuilt it inside `target/debug/deps/` but did not copy it to `target/debug`. To further confirm, calling `cp target/debug/deps/foo.dll target/debug/` manually solved the issue. Any idea? ---- I left `FIXME` in places where import lib should be added with #6875. `TOOLCHAIN: nightly-x86_64-pc-windows-gnu` can be replaced with beta on Thursday.
2 parents 9d84c0c + 2dd0b0d commit 97d39ae

File tree

9 files changed

+43
-8
lines changed

9 files changed

+43
-8
lines changed

azure-pipelines.yml

+3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ jobs:
4141
x86_64-msvc:
4242
TOOLCHAIN: stable-x86_64-pc-windows-msvc
4343
OTHER_TARGET: i686-pc-windows-msvc
44+
x86_64-gnu:
45+
TOOLCHAIN: nightly-x86_64-pc-windows-gnu
46+
OTHER_TARGET: i686-pc-windows-gnu
4447

4548
- job: rustfmt
4649
pool:

ci/azure-install-rust.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ steps:
44
rustup set profile minimal
55
rustup component remove --toolchain=$TOOLCHAIN rust-docs || echo "already removed"
66
rustup update --no-self-update $TOOLCHAIN
7-
if [ "$TOOLCHAIN" = "nightly" ]; then
7+
if [[ "$TOOLCHAIN" == "nightly"* ]]; then
88
rustup component add --toolchain=$TOOLCHAIN rustc-dev
99
fi
1010
rustup default $TOOLCHAIN

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
}

src/cargo/core/compiler/context/compilation_files.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg> {
332332
// we don't want to link it up.
333333
if out_dir.ends_with("deps") {
334334
// Don't lift up library dependencies.
335-
if unit.target.is_bin() || self.roots.contains(unit) {
335+
if unit.target.is_bin() || self.roots.contains(unit) || unit.target.is_dylib() {
336336
Some((
337337
out_dir.parent().unwrap().to_owned(),
338338
if unit.mode.is_any_test() {

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)