diff options
| author | Trevor Gross <tmgross@umich.edu> | 2025-06-13 20:31:34 +0000 |
|---|---|---|
| committer | Trevor Gross <tmgross@umich.edu> | 2025-08-06 23:59:46 +0000 |
| commit | 0c8b3870bd9ec60093b478b318858fdb220846b7 (patch) | |
| tree | bb12db76aa2cd3d2bac763904ce25d2cf83039e2 | |
| parent | 7d82b83ed57d188ab3f2441a765a6419685a88a3 (diff) | |
| download | rust-0c8b3870bd9ec60093b478b318858fdb220846b7.tar.gz rust-0c8b3870bd9ec60093b478b318858fdb220846b7.zip | |
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.
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 5 | ||||
| -rw-r--r-- | src/tools/miri/tests/ui.rs | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 84c6df5c744..f283a625f97 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2567,6 +2567,11 @@ impl<'test> TestCx<'test> { }) .into_owned(); + // Normalize thread IDs in panic messages + normalized = static_regex!(r"thread '(?P<name>.*?)' \((rtid )?\d+\) panicked") + .replace_all(&normalized, "thread '$name' ($$TID) panicked") + .into_owned(); + normalized = normalized.replace("\t", "\\t"); // makes tabs visible // Remove test annotations like `//~ ERROR text` from the output, diff --git a/src/tools/miri/tests/ui.rs b/src/tools/miri/tests/ui.rs index 73fbe2cc020..f021d5194cd 100644 --- a/src/tools/miri/tests/ui.rs +++ b/src/tools/miri/tests/ui.rs @@ -248,7 +248,8 @@ regexes! { // erase alloc ids "alloc[0-9]+" => "ALLOC", // erase thread ids - r"unnamed-[0-9]+" => "unnamed-ID", + r"unnamed-[0-9]+" => "unnamed-ID", + r"thread '(?P<name>.*?)' \(\d+\) panicked" => "thread '$name' ($$TID) panicked", // erase borrow tags "<[0-9]+>" => "<TAG>", "<[0-9]+=" => "<TAG=", |
