Skip to content

Commit df8ae53

Browse files
committed
Add normalization for thread IDs in panic messages
So we don't need to add normalization to every test that includes a panic message, add a global normalization to compiletest.
1 parent 8829bd5 commit df8ae53

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/tools/compiletest/src/runtest.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2413,6 +2413,11 @@ impl<'test> TestCx<'test> {
24132413
})
24142414
.into_owned();
24152415

2416+
// Normalize thread IDs in panic messages
2417+
normalized = static_regex!(r"thread '(?P<name>.*?)' \(\d+\) panicked")
2418+
.replace_all(&normalized, "thread '$name' ($$TID) panicked")
2419+
.into_owned();
2420+
24162421
normalized = normalized.replace("\t", "\\t"); // makes tabs visible
24172422

24182423
// Remove test annotations like `//~ ERROR text` from the output,

src/tools/miri/tests/ui.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,8 @@ regexes! {
251251
// erase alloc ids
252252
"alloc[0-9]+" => "ALLOC",
253253
// erase thread ids
254-
r"unnamed-[0-9]+" => "unnamed-ID",
254+
r"unnamed-[0-9]+" => "unnamed-ID",
255+
r"thread '(?P<name>.*?)' \(\d+\) panicked" => "thread '$name' ($$TID) panicked",
255256
// erase borrow tags
256257
"<[0-9]+>" => "<TAG>",
257258
"<[0-9]+=" => "<TAG=",

0 commit comments

Comments
 (0)