Skip to content

Commit

Permalink
Auto merge of #3085 - RalfJung:test-norm, r=RalfJung
Browse files Browse the repository at this point in the history
fix normalization in backtrace-api tests

also remove a normalization rule that doesn't seem to apply
  • Loading branch information
bors committed Sep 25, 2023
2 parents 914a10d + d7b8b2f commit 1a82975
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 5 deletions.
4 changes: 1 addition & 3 deletions tests/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ regexes! {
r" +at (.*\.rs)" => " at $1",
// erase generics in backtraces
"([0-9]+: .*)::<.*>" => "$1",
// erase addresses in backtraces
"([0-9]+: ) +0x[0-9a-f]+ - (.*)" => "$1$2",
// erase long hexadecimals
r"0x[0-9a-fA-F]+[0-9a-fA-F]{2,2}" => "$$HEX",
// erase specific alignments
Expand All @@ -192,7 +190,7 @@ regexes! {
// Windows file paths
r"\\" => "/",
// erase Rust stdlib path
"[^ `]*/(rust[^/]*|checkout)/library/" => "RUSTLIB/",
"[^ \n`]*/(rust[^/]*|checkout)/library/" => "RUSTLIB/",
// erase platform file paths
"sys/[a-z]+/" => "sys/PLATFORM/",
// erase paths into the crate registry
Expand Down
2 changes: 2 additions & 0 deletions tests/pass/backtrace/backtrace-api-v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ fn main() {
eprintln!("{}", out);
// Print the 'main' frame (and everything before it) to stdout, skipping
// the printing of internal (and possibly fragile) libstd frames.
// Stdout is less normalized so we see more, but it also means we can print less
// as platform differences would lead to test suite failures.
if !seen_main {
println!("{}", out);
seen_main = name == "main";
Expand Down
15 changes: 14 additions & 1 deletion tests/pass/backtrace/backtrace-api-v0.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,17 @@ $DIR/backtrace-api-v0.rs:LL:CC (func_d)
$DIR/backtrace-api-v0.rs:LL:CC (func_c)
$DIR/backtrace-api-v0.rs:LL:CC (func_b)
$DIR/backtrace-api-v0.rs:LL:CC (func_a)
$DIR/backtrace-api-v0.rs:LL:CC RUSTLIB/core/src/ops/function.rs:LL:CC (<fn() as std::ops::FnOnce<()>>::call_once - RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC (std::sys_common::backtrace::__rust_begin_short_backtrace)
$DIR/backtrace-api-v0.rs:LL:CC (main)
RUSTLIB/core/src/ops/function.rs:LL:CC (<fn() as std::ops::FnOnce<()>>::call_once - shim(fn()))
RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC (std::sys_common::backtrace::__rust_begin_short_backtrace)
RUSTLIB/std/src/rt.rs:LL:CC (std::rt::lang_start::{closure#0})
RUSTLIB/core/src/ops/function.rs:LL:CC (std::ops::function::impls::call_once)
RUSTLIB/std/src/panicking.rs:LL:CC (std::panicking::r#try::do_call)
RUSTLIB/std/src/panicking.rs:LL:CC (std::panicking::r#try)
RUSTLIB/std/src/panic.rs:LL:CC (std::panic::catch_unwind)
RUSTLIB/std/src/rt.rs:LL:CC (std::rt::lang_start_internal::{closure#2})
RUSTLIB/std/src/panicking.rs:LL:CC (std::panicking::r#try::do_call)
RUSTLIB/std/src/panicking.rs:LL:CC (std::panicking::r#try)
RUSTLIB/std/src/panic.rs:LL:CC (std::panic::catch_unwind)
RUSTLIB/std/src/rt.rs:LL:CC (std::rt::lang_start_internal)
RUSTLIB/std/src/rt.rs:LL:CC (std::rt::lang_start)
2 changes: 2 additions & 0 deletions tests/pass/backtrace/backtrace-api-v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ fn main() {
eprintln!("{}", out);
// Print the 'main' frame (and everything before it) to stdout, skipping
// the printing of internal (and possibly fragile) libstd frames.
// Stdout is less normalized so we see more, but it also means we can print less
// as platform differences would lead to test suite failures.
if !seen_main {
println!("{}", out);
seen_main = name == "main";
Expand Down
15 changes: 14 additions & 1 deletion tests/pass/backtrace/backtrace-api-v1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,17 @@ $DIR/backtrace-api-v1.rs:LL:CC (func_d)
$DIR/backtrace-api-v1.rs:LL:CC (func_c)
$DIR/backtrace-api-v1.rs:LL:CC (func_b)
$DIR/backtrace-api-v1.rs:LL:CC (func_a)
$DIR/backtrace-api-v1.rs:LL:CC RUSTLIB/core/src/ops/function.rs:LL:CC (<fn() as std::ops::FnOnce<()>>::call_once - RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC (std::sys_common::backtrace::__rust_begin_short_backtrace)
$DIR/backtrace-api-v1.rs:LL:CC (main)
RUSTLIB/core/src/ops/function.rs:LL:CC (<fn() as std::ops::FnOnce<()>>::call_once - shim(fn()))
RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC (std::sys_common::backtrace::__rust_begin_short_backtrace)
RUSTLIB/std/src/rt.rs:LL:CC (std::rt::lang_start::{closure#0})
RUSTLIB/core/src/ops/function.rs:LL:CC (std::ops::function::impls::call_once)
RUSTLIB/std/src/panicking.rs:LL:CC (std::panicking::r#try::do_call)
RUSTLIB/std/src/panicking.rs:LL:CC (std::panicking::r#try)
RUSTLIB/std/src/panic.rs:LL:CC (std::panic::catch_unwind)
RUSTLIB/std/src/rt.rs:LL:CC (std::rt::lang_start_internal::{closure#2})
RUSTLIB/std/src/panicking.rs:LL:CC (std::panicking::r#try::do_call)
RUSTLIB/std/src/panicking.rs:LL:CC (std::panicking::r#try)
RUSTLIB/std/src/panic.rs:LL:CC (std::panic::catch_unwind)
RUSTLIB/std/src/rt.rs:LL:CC (std::rt::lang_start_internal)
RUSTLIB/std/src/rt.rs:LL:CC (std::rt::lang_start)

0 comments on commit 1a82975

Please sign in to comment.