Skip to content

Commit

Permalink
Fix race condition in panic_abort_tests (#15169)
Browse files Browse the repository at this point in the history
This fixes a race condition in the `panic_abort_tests` test which can
randomly fail. Prior to #14226
the test would check the lines individually (which was also kinda broken
for the same reason, but wouldn't actually fail).
  • Loading branch information
epage authored Feb 10, 2025
2 parents 3939918 + be6598b commit e3fa31e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/testsuite/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5009,7 +5009,11 @@ fn panic_abort_tests() {
.file("a/src/lib.rs", "pub fn foo() {}")
.build();

p.cargo("test -Z panic-abort-tests -v")
// This uses -j1 because of a race condition. Otherwise it will build the
// two copies of `foo` in parallel, and which one is first is random. If
// `--test` is first, then the first line with `[..]` will match, and the
// second line with `--test` will fail.
p.cargo("test -Z panic-abort-tests -v -j1")
.with_stderr_data(
str![[r#"
[RUNNING] `[..]--crate-name a [..]-C panic=abort[..]`
Expand Down

0 comments on commit e3fa31e

Please sign in to comment.