about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2023-05-10 20:22:17 +0200
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2023-05-11 13:59:38 +0200
commitcac7e42b5278ad46214c741f01e537dff1fa9372 (patch)
tree534009df4d4df06e18c509f586fd46d70d348349
parentcba14074bb4cc12bfe918eabd0d52a3999b2a461 (diff)
downloadrust-cac7e42b5278ad46214c741f01e537dff1fa9372.tar.gz
rust-cac7e42b5278ad46214c741f01e537dff1fa9372.zip
Fix backtrace normalization in ice-bug-report-url.rs
This test case currently fails on s390x, and probably other
platforms where the last line of a backtrace does not contain
and " at <source location>" specification.

The problem with the existing normalization lines
// normalize-stderr-test "\s*\d{1,}: .*\n" -> ""
// normalize-stderr-test "\s at .*\n" -> ""
is that \s matches all whitespace, including newlines, so the
first (but not second) of these regexes may merge multiple
lines.  Thus the output differs depending on which of these
matches on the last line of a backtrace.

As the whitespace used in backtraces is just normal space
characters, change both regexes to just match at least one
space character instead:
// normalize-stderr-test " +\d{1,}: .*\n" -> ""
// normalize-stderr-test " + at .*\n" -> ""
-rw-r--r--tests/rustdoc-ui/ice-bug-report-url.rs4
-rw-r--r--tests/rustdoc-ui/ice-bug-report-url.stderr1
2 files changed, 3 insertions, 2 deletions
diff --git a/tests/rustdoc-ui/ice-bug-report-url.rs b/tests/rustdoc-ui/ice-bug-report-url.rs
index cc066447d31..8ede91cf8f4 100644
--- a/tests/rustdoc-ui/ice-bug-report-url.rs
+++ b/tests/rustdoc-ui/ice-bug-report-url.rs
@@ -6,8 +6,8 @@
 // normalize-stderr-test "note: compiler flags.*\n\n" -> ""
 // normalize-stderr-test "note: rustc.*running on.*" -> "note: rustc {version} running on {platform}"
 // normalize-stderr-test "thread.*panicked at .*, compiler.*" -> "thread panicked at 'aborting due to `-Z treat-err-as-bug`'"
-// normalize-stderr-test "\s*\d{1,}: .*\n" -> ""
-// normalize-stderr-test "\s at .*\n" -> ""
+// normalize-stderr-test " +\d{1,}: .*\n" -> ""
+// normalize-stderr-test " + at .*\n" -> ""
 // normalize-stderr-test ".*note: Some details are omitted.*\n" -> ""
 
 fn wrong()
diff --git a/tests/rustdoc-ui/ice-bug-report-url.stderr b/tests/rustdoc-ui/ice-bug-report-url.stderr
index cfb73a9b919..98c08b9a894 100644
--- a/tests/rustdoc-ui/ice-bug-report-url.stderr
+++ b/tests/rustdoc-ui/ice-bug-report-url.stderr
@@ -6,6 +6,7 @@ LL | fn wrong()
 
 thread panicked at 'aborting due to `-Z treat-err-as-bug`'
 stack backtrace:
+
 error: the compiler unexpectedly panicked. this is a bug.
 
 note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-rustdoc&template=ice.md