Skip to content

Commit

Permalink
Re-enable some MSVC tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Oct 8, 2019
1 parent a429e8c commit 5ccabc8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
2 changes: 2 additions & 0 deletions src/cargo/core/compiler/context/compilation_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,8 @@ fn compute_metadata<'a, 'cfg>(
//
// No metadata for bin because of an issue:
// - wasm32 rustc/emcc encodes the `.wasm` name in the `.js` (rust-lang/cargo#4535).
// - msvc: The path to the PDB is embedded in the executable, and we don't
// want the PDB path to include the hash in it.
//
// Two exceptions:
// 1) Upstream dependencies (we aren't exporting + need to resolve name conflict),
Expand Down
6 changes: 3 additions & 3 deletions tests/testsuite/collisions.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[cfg(not(target_env = "msvc"))]
use cargo_test_support::basic_manifest;
use cargo_test_support::project;
use std::env;
Expand Down Expand Up @@ -56,7 +55,6 @@ This may become a hard error in the future; see <https://github.com/rust-lang/ca
}

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

p.cargo("build --examples")
// `j=1` is required because on Windows you'll get an error due to
// two processes writing to the file at the same time.
p.cargo("build --examples -j=1")
.with_stderr_contains("\
[WARNING] output filename collision.
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)`.
Expand Down
30 changes: 15 additions & 15 deletions tests/testsuite/freshness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,6 @@ fn changing_bin_paths_common_target_features_caches_targets() {
}

#[cargo_test]
#[cfg(not(target_env = "msvc"))]
fn changing_bin_features_caches_targets() {
let p = project()
.file(
Expand Down Expand Up @@ -471,22 +470,23 @@ fn changing_bin_features_caches_targets() {

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

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

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

Expand Down

0 comments on commit 5ccabc8

Please sign in to comment.