Skip to content

Commit d7bfbf3

Browse files
Paolo TranquilliCopilot
andcommitted
Rust: Test proc-macro server pool sizing
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b558906 commit d7bfbf3

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

‎rust/extractor/src/config.rs‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,3 +309,26 @@ fn join_path_buf(lhs: &AbsPath, rhs: &Path) -> AbsPathBuf {
309309
};
310310
lhs.join(path)
311311
}
312+
313+
#[cfg(test)]
314+
mod tests {
315+
use super::*;
316+
317+
#[test]
318+
fn proc_macro_processes_follow_threads_up_to_cap() {
319+
let dir = AbsPathBuf::assert_utf8(std::env::temp_dir());
320+
// explicit sysroot paths avoid toolchain discovery
321+
let config = Config {
322+
sysroot: Some(dir.clone().into()),
323+
sysroot_src: Some(dir.clone().into()),
324+
..Default::default()
325+
};
326+
for (threads, expected) in [(0, 1), (1, 1), (2, 2), (4, 4), (32, 4)] {
327+
let (_, load_config) = config.to_cargo_config(&dir, threads);
328+
assert_eq!(
329+
load_config.proc_macro_processes, expected,
330+
"{threads} threads"
331+
);
332+
}
333+
}
334+
}

0 commit comments

Comments
 (0)