about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-02-12 00:54:57 +0000
committerbors <bors@rust-lang.org>2017-02-12 00:54:57 +0000
commit912bc14a6b25bac66822766b09dcfb3c6263757d (patch)
tree856d6dd9325579154db32d8092984212a8167b8f
parentba7cf7cc5daefb9f28371b8be87dc262fb55937c (diff)
parent0a4c268a6b3e003e5339863c5be2f1b9d0c594de (diff)
downloadrust-912bc14a6b25bac66822766b09dcfb3c6263757d.tar.gz
rust-912bc14a6b25bac66822766b09dcfb3c6263757d.zip
Auto merge of #38945 - battisti:fix_thread_num, r=alexcrichton
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.
-rw-r--r--src/libtest/lib.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
index cfbc284de4d..112bf61cf97 100644
--- a/src/libtest/lib.rs
+++ b/src/libtest/lib.rs
@@ -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 \