Skip to content

Commit

Permalink
Rollup merge of rust-lang#134781 - Zalathar:backtrace, r=SparrowLii,j…
Browse files Browse the repository at this point in the history
…ieyouxu

Add more `begin_panic` normalizations to panic backtrace tests

Since rust-lang#123244, these tests have started failing locally on some systems (rust-lang#133997) due to minor variations in how `begin_panic` is printed in the backtrace.

The variation appears to occur on macOS when `rust.debuginfo-level = "line-tables-only"` is set, which is the default in `config.compiler.toml`. It does not occur when the debuginfo level is set to 1.

The variation doesn't seem relevant to these tests, so this PR simply adds another custom normalization rule to account for the variation.

---

Will conflict with rust-lang#134759.
  • Loading branch information
jieyouxu authored Dec 26, 2024
2 parents 3664e2b + 1511de3 commit 684ec10
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions tests/ui/panics/issue-47429-short-backtraces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
// This is needed to avoid test output differences across std being built with v0 symbols vs legacy
// symbols.
//@ normalize-stderr-test: "begin_panic::<&str>" -> "begin_panic"
// This variant occurs on macOS with `rust.debuginfo-level = "line-tables-only"` (#133997)
//@ normalize-stderr-test: " begin_panic<&str>" -> " std::panicking::begin_panic"
// And this is for differences between std with and without debuginfo.
//@ normalize-stderr-test: "\n +at [^\n]+" -> ""

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/panics/issue-47429-short-backtraces.run.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
thread 'main' panicked at $DIR/issue-47429-short-backtraces.rs:24:5:
thread 'main' panicked at $DIR/issue-47429-short-backtraces.rs:26:5:
explicit panic
stack backtrace:
0: std::panicking::begin_panic
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/panics/runtime-switch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
// This is needed to avoid test output differences across std being built with v0 symbols vs legacy
// symbols.
//@ normalize-stderr-test: "begin_panic::<&str>" -> "begin_panic"
// This variant occurs on macOS with `rust.debuginfo-level = "line-tables-only"` (#133997)
//@ normalize-stderr-test: " begin_panic<&str>" -> " std::panicking::begin_panic"
// And this is for differences between std with and without debuginfo.
//@ normalize-stderr-test: "\n +at [^\n]+" -> ""

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/panics/runtime-switch.run.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
thread 'main' panicked at $DIR/runtime-switch.rs:27:5:
thread 'main' panicked at $DIR/runtime-switch.rs:29:5:
explicit panic
stack backtrace:
0: std::panicking::begin_panic
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/panics/short-ice-remove-middle-frames-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// This is needed to avoid test output differences across std being built with v0 symbols vs legacy
// symbols.
//@ normalize-stderr-test: "begin_panic::<&str>" -> "begin_panic"
// This variant occurs on macOS with `rust.debuginfo-level = "line-tables-only"` (#133997)
//@ normalize-stderr-test: " begin_panic<&str>" -> " std::panicking::begin_panic"
// And this is for differences between std with and without debuginfo.
//@ normalize-stderr-test: "\n +at [^\n]+" -> ""

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
thread 'main' panicked at $DIR/short-ice-remove-middle-frames-2.rs:61:5:
thread 'main' panicked at $DIR/short-ice-remove-middle-frames-2.rs:63:5:
debug!!!
stack backtrace:
0: std::panicking::begin_panic
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/panics/short-ice-remove-middle-frames.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// This is needed to avoid test output differences across std being built with v0 symbols vs legacy
// symbols.
//@ normalize-stderr-test: "begin_panic::<&str>" -> "begin_panic"
// This variant occurs on macOS with `rust.debuginfo-level = "line-tables-only"` (#133997)
//@ normalize-stderr-test: " begin_panic<&str>" -> " std::panicking::begin_panic"
// And this is for differences between std with and without debuginfo.
//@ normalize-stderr-test: "\n +at [^\n]+" -> ""

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/panics/short-ice-remove-middle-frames.run.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
thread 'main' panicked at $DIR/short-ice-remove-middle-frames.rs:57:5:
thread 'main' panicked at $DIR/short-ice-remove-middle-frames.rs:59:5:
debug!!!
stack backtrace:
0: std::panicking::begin_panic
Expand Down

0 comments on commit 684ec10

Please sign in to comment.