Skip to content

Commit bda5051

Browse files
committed
Auto merge of #7956 - ehuss:fix-collision-test, r=alexcrichton
Fix rare failure in collision_export test. Seen once on CI in #7952 (https://dev.azure.com/rust-lang/cargo/_build/results?buildId=22112&view=logs&j=a5e52b91-c83f-5429-4a68-c246fc63a4f7&t=d4864165-4be3-5e34-b483-a6b05303aa68). I was able to reproduce it locally, though it is rare. There seems to be some kind of race issue on macOS with two processes trying to symlink the same directory at the same time. The solution is to serialize the build so they don't run at the same time.
2 parents ac2eb69 + f2c8070 commit bda5051

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tests/testsuite/collisions.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ This may become a hard error in the future; see <https://github.com/rust-lang/ca
9191
}
9292

9393
#[cargo_test]
94+
// --out-dir and examples are currently broken on MSVC.
95+
// See https://github.com/rust-lang/cargo/issues/7493
9496
#[cfg(not(target_env = "msvc"))]
9597
fn collision_export() {
9698
// `--out-dir` combines some things which can cause conflicts.
@@ -100,7 +102,9 @@ fn collision_export() {
100102
.file("src/main.rs", "fn main() {}")
101103
.build();
102104

103-
p.cargo("build --out-dir=out -Z unstable-options --bins --examples")
105+
// -j1 to avoid issues with two processes writing to the same file at the
106+
// same time.
107+
p.cargo("build -j1 --out-dir=out -Z unstable-options --bins --examples")
104108
.masquerade_as_nightly_cargo()
105109
.with_stderr_contains("\
106110
[WARNING] `--out-dir` filename collision.

0 commit comments

Comments
 (0)