Skip to content

Commit 0c8b387

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 7d82b83 commit 0c8b387

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
@@ -2567,6 +2567,11 @@ impl<'test> TestCx<'test> {
25672567
})
25682568
.into_owned();
25692569

2570+
// Normalize thread IDs in panic messages
2571+
normalized = static_regex!(r"thread '(?P<name>.*?)' \((rtid )?\d+\) panicked")
2572+
.replace_all(&normalized, "thread '$name' ($$TID) panicked")
2573+
.into_owned();
2574+
25702575
normalized = normalized.replace("\t", "\\t"); // makes tabs visible
25712576

25722577
// 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
@@ -248,7 +248,8 @@ regexes! {
248248
// erase alloc ids
249249
"alloc[0-9]+" => "ALLOC",
250250
// erase thread ids
251-
r"unnamed-[0-9]+" => "unnamed-ID",
251+
r"unnamed-[0-9]+" => "unnamed-ID",
252+
r"thread '(?P<name>.*?)' \(\d+\) panicked" => "thread '$name' ($$TID) panicked",
252253
// erase borrow tags
253254
"<[0-9]+>" => "<TAG>",
254255
"<[0-9]+=" => "<TAG=",

0 commit comments

Comments
 (0)