Skip to content

Commit abb761a

Browse files
committed
feat(cargo): Enable the test thread pool for --parallel-mutants runs
Dynamic, parallel scheduling of mutations (--parallel-mutants) requires a test thread pool. This change ensures that cargo-mutest sets the `--use-thread-pool` flag for all `--parallel-mutants` evaluations.
1 parent 850f348 commit abb761a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

cargo-mutest/src/main.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ fn main() {
137137
.get_matches_from(&args);
138138

139139
let embedded = matches.get_flag("Zembedded");
140+
let parallel_mutants = matches.get_flag("parallel-mutants");
140141

141142
let (cargo_subcommand, cargo_args, mutest_driver_subcommand, passed_args, inspect_opts): (_, &[&str], _, _, _) = match matches.subcommand() {
142143
Some(("print", _)) => ("check", &["--profile", "test"], "print", None, None),
@@ -182,7 +183,8 @@ fn main() {
182183

183184
if !embedded {
184185
if let Some(isolation_mode) = matches.get_one::<String>("isolate") { passed_args.push(format!("--isolate={isolation_mode}")); }
185-
if matches.get_flag("use-thread-pool") { passed_args.push("--use-thread-pool".to_owned()); }
186+
// NOTE: `--parallel-mutants` requires the test thread pool, so we automatically set it.
187+
if matches.get_flag("use-thread-pool") || parallel_mutants { passed_args.push("--use-thread-pool".to_owned()); }
186188
}
187189

188190
let mut print_names = matches.get_many::<String>("print").map(|print| print.map(String::as_str).collect::<HashSet<_>>()).unwrap_or_default();

0 commit comments

Comments
 (0)