From d7b8b2f2b51d8ad746018d0e344f24f1a5f136b2 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 25 Sep 2023 13:38:26 +0200 Subject: [PATCH] fix normalization in backtrace-api tests also remove a normalization rule that doesn't seem to apply --- tests/compiletest.rs | 4 +--- tests/pass/backtrace/backtrace-api-v0.rs | 2 ++ tests/pass/backtrace/backtrace-api-v0.stderr | 15 ++++++++++++++- tests/pass/backtrace/backtrace-api-v1.rs | 2 ++ tests/pass/backtrace/backtrace-api-v1.stderr | 15 ++++++++++++++- 5 files changed, 33 insertions(+), 5 deletions(-) diff --git a/tests/compiletest.rs b/tests/compiletest.rs index fe799216f0..035846f0ef 100644 --- a/tests/compiletest.rs +++ b/tests/compiletest.rs @@ -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 @@ -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 diff --git a/tests/pass/backtrace/backtrace-api-v0.rs b/tests/pass/backtrace/backtrace-api-v0.rs index 5cd12959ca..8d3173da40 100644 --- a/tests/pass/backtrace/backtrace-api-v0.rs +++ b/tests/pass/backtrace/backtrace-api-v0.rs @@ -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"; diff --git a/tests/pass/backtrace/backtrace-api-v0.stderr b/tests/pass/backtrace/backtrace-api-v0.stderr index ee556b3e4a..bc24d6de73 100644 --- a/tests/pass/backtrace/backtrace-api-v0.stderr +++ b/tests/pass/backtrace/backtrace-api-v0.stderr @@ -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 (>::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 (>::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) diff --git a/tests/pass/backtrace/backtrace-api-v1.rs b/tests/pass/backtrace/backtrace-api-v1.rs index 1e35574b39..ad05271ca5 100644 --- a/tests/pass/backtrace/backtrace-api-v1.rs +++ b/tests/pass/backtrace/backtrace-api-v1.rs @@ -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"; diff --git a/tests/pass/backtrace/backtrace-api-v1.stderr b/tests/pass/backtrace/backtrace-api-v1.stderr index 7dc281af31..246e54becd 100644 --- a/tests/pass/backtrace/backtrace-api-v1.stderr +++ b/tests/pass/backtrace/backtrace-api-v1.stderr @@ -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 (>::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 (>::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)