Skip to content

Commit

Permalink
Auto merge of #38945 - battisti:fix_thread_num, r=alexcrichton
Browse files Browse the repository at this point in the history
treat setting the number of test-threads to 0 as an error

It is currently possible to call `cargo test -- --test-threads=0` which will cause cargo to hang until aborted. This change will fix that and will report an appropriate error to the user.
  • Loading branch information
bors committed Feb 12, 2017
2 parents ba7cf7c + 0a4c268 commit 912bc14
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/libtest/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,8 @@ pub fn parse_opts(args: &[String]) -> Option<OptRes> {
let test_threads = match matches.opt_str("test-threads") {
Some(n_str) =>
match n_str.parse::<usize>() {
Ok(0) =>
return Some(Err(format!("argument for --test-threads must not be 0"))),
Ok(n) => Some(n),
Err(e) =>
return Some(Err(format!("argument for --test-threads must be a number > 0 \
Expand Down

0 comments on commit 912bc14

Please sign in to comment.