Skip to content
This repository was archived by the owner on Apr 8, 2024. It is now read-only.

Commit ac1799e

Browse files
committed
Name the snapshot threads
1 parent e54b2b6 commit ac1799e

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/bin/snapshots.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ fn to_debug_str(debug: &dyn Debug) -> String {
1515

1616
macro_rules! snapshot {
1717
($production:ident, $src:expr) => {{
18-
let tts = $src.parse::<proc_macro2::TokenStream>().expect("tokenization");
18+
let tts = $src
19+
.parse::<proc_macro2::TokenStream>()
20+
.expect("tokenization");
1921
to_debug_str(&parse::$production::parse(tts))
2022
}};
2123
}
@@ -74,10 +76,15 @@ fn test_snapshot(file: walkdir::DirEntry) {
7476
assert_snapshot_matches!(file_name, forest);
7577
}
7678

77-
fn spawn_panicking(stack_size: usize, f: impl FnOnce() + Send + 'static) -> Result<(), ()> {
79+
fn spawn_panicking(
80+
name: String,
81+
stack_size: usize,
82+
f: impl FnOnce() + Send + 'static,
83+
) -> Result<(), ()> {
7884
crossbeam::scope(|scope: &crossbeam::thread::Scope<'_>| {
7985
scope
8086
.builder()
87+
.name(name)
8188
.stack_size(stack_size)
8289
.spawn(|_| f())
8390
.unwrap()
@@ -98,7 +105,13 @@ fn main() {
98105
// Parse and snapshot each file
99106
let snapshots = files
100107
// .par_bridge() // parallel will interleave output, unfortunately
101-
.map(|f| spawn_panicking(32 * 1024 * 1024, || test_snapshot(f))); // 32 MiB
108+
.map(|f| {
109+
spawn_panicking(
110+
f.file_name().to_string_lossy().into_owned(),
111+
32 * 1024 * 1024, // 32 MiB
112+
|| test_snapshot(f),
113+
)
114+
});
102115

103116
// Collect failures
104117
let failures: Vec<_> = snapshots.filter_map(Result::err).collect();

0 commit comments

Comments
 (0)