Skip to content

Commit

Permalink
add a single-threaded mode to the test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
liquidev committed Oct 30, 2023
1 parent 43d426c commit d29a98f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,10 @@ struct Arguments {
/// Include tests marked with `@ignore`.
#[clap(long)]
include_ignored: bool,

/// Single-threaded mode; prevents tests from running in parallel.
#[clap(long)]
single_threaded: bool,
}

fn main() -> ExitCode {
Expand All @@ -455,8 +459,11 @@ fn main() -> ExitCode {

let tests = collect_all_tests("tests");
let start_time = Instant::now();
let outcomes: Vec<_> =
tests.par_iter().map(|test| (test.run(args.include_ignored), test)).collect();
let outcomes: Vec<_> = if args.single_threaded {
tests.iter().map(|test| (test.run(args.include_ignored), test)).collect()
} else {
tests.par_iter().map(|test| (test.run(args.include_ignored), test)).collect()
};
let end_time = Instant::now();

let total = outcomes.len();
Expand Down

0 comments on commit d29a98f

Please sign in to comment.