Skip to content

Commit 5ccabc8

Browse files
committed
Re-enable some MSVC tests.
1 parent a429e8c commit 5ccabc8

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

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

+2
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,8 @@ fn compute_metadata<'a, 'cfg>(
476476
//
477477
// No metadata for bin because of an issue:
478478
// - wasm32 rustc/emcc encodes the `.wasm` name in the `.js` (rust-lang/cargo#4535).
479+
// - msvc: The path to the PDB is embedded in the executable, and we don't
480+
// want the PDB path to include the hash in it.
479481
//
480482
// Two exceptions:
481483
// 1) Upstream dependencies (we aren't exporting + need to resolve name conflict),

tests/testsuite/collisions.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#[cfg(not(target_env = "msvc"))]
21
use cargo_test_support::basic_manifest;
32
use cargo_test_support::project;
43
use std::env;
@@ -56,7 +55,6 @@ This may become a hard error in the future; see <https://github.com/rust-lang/ca
5655
}
5756

5857
#[cargo_test]
59-
#[cfg(not(target_env = "msvc"))]
6058
fn collision_example() {
6159
// Examples in a workspace can easily collide.
6260
let p = project()
@@ -73,7 +71,9 @@ fn collision_example() {
7371
.file("b/examples/ex1.rs", "fn main() {}")
7472
.build();
7573

76-
p.cargo("build --examples")
74+
// `j=1` is required because on Windows you'll get an error due to
75+
// two processes writing to the file at the same time.
76+
p.cargo("build --examples -j=1")
7777
.with_stderr_contains("\
7878
[WARNING] output filename collision.
7979
The example target `ex1` in package `b v1.0.0 ([..]/foo/b)` has the same output filename as the example target `ex1` in package `a v1.0.0 ([..]/foo/a)`.

tests/testsuite/freshness.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,6 @@ fn changing_bin_paths_common_target_features_caches_targets() {
423423
}
424424

425425
#[cargo_test]
426-
#[cfg(not(target_env = "msvc"))]
427426
fn changing_bin_features_caches_targets() {
428427
let p = project()
429428
.file(
@@ -471,22 +470,23 @@ fn changing_bin_features_caches_targets() {
471470

472471
/* Targets should be cached from the first build */
473472

474-
p.cargo("build")
475-
.with_stderr(
476-
"\
477-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
478-
",
479-
)
480-
.run();
473+
let mut e = p.cargo("build");
474+
// MSVC does not include hash in binary filename, so it gets recompiled.
475+
if cfg!(target_env = "msvc") {
476+
e.with_stderr("[COMPILING] foo[..]\n[FINISHED] dev[..]");
477+
} else {
478+
e.with_stderr("[FINISHED] dev[..]");
479+
}
480+
e.run();
481481
p.rename_run("foo", "off2").with_stdout("feature off").run();
482482

483-
p.cargo("build --features foo")
484-
.with_stderr(
485-
"\
486-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
487-
",
488-
)
489-
.run();
483+
let mut e = p.cargo("build --features foo");
484+
if cfg!(target_env = "msvc") {
485+
e.with_stderr("[COMPILING] foo[..]\n[FINISHED] dev[..]");
486+
} else {
487+
e.with_stderr("[FINISHED] dev[..]");
488+
}
489+
e.run();
490490
p.rename_run("foo", "on2").with_stdout("feature on").run();
491491
}
492492

0 commit comments

Comments
 (0)