From 8d4acd911cc0c52bdadd7c1035fc43e52833b0d6 Mon Sep 17 00:00:00 2001 From: reedlepee Date: Mon, 4 Nov 2013 02:15:39 +0530 Subject: [PATCH 1/3] use a single test task when valgrinding #1921 --- src/libextra/test.rs | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/libextra/test.rs b/src/libextra/test.rs index 070108ddf2e8e..bf8ea332f3dd5 100644 --- a/src/libextra/test.rs +++ b/src/libextra/test.rs @@ -36,6 +36,7 @@ use std::task; use std::to_str::ToStr; use std::f64; use std::os; +use std::unstable::running_on_valgrind; // The name of a test. By convention this follows the rules for rust @@ -775,16 +776,21 @@ fn run_tests(opts: &TestOpts, fn get_concurrency() -> uint { use std::rt; - match os::getenv("RUST_TEST_TASKS") { - Some(s) => { - let opt_n: Option = FromStr::from_str(s); - match opt_n { - Some(n) if n > 0 => n, - _ => fail!("RUST_TEST_TASKS is `{}`, should be a positive integer.", s) + if running_on_valgrind() { + 1 + } + else{ + match os::getenv("RUST_TEST_TASKS") { + Some(s) => { + let opt_n: Option = FromStr::from_str(s); + match opt_n { + Some(n) if n > 0 => n, + _ => fail!("RUST_TEST_TASKS is `{}`, should be a positive integer.", s) + } + } + None => { + rt::default_sched_threads() } - } - None => { - rt::default_sched_threads() } } } From 79edf386b8ff97435e197675c53ccdcae73565a9 Mon Sep 17 00:00:00 2001 From: reedlepee Date: Mon, 4 Nov 2013 03:21:16 +0530 Subject: [PATCH 2/3] formatting #1921 --- src/libextra/test.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libextra/test.rs b/src/libextra/test.rs index bf8ea332f3dd5..23a805d8aec41 100644 --- a/src/libextra/test.rs +++ b/src/libextra/test.rs @@ -778,8 +778,7 @@ fn get_concurrency() -> uint { use std::rt; if running_on_valgrind() { 1 - } - else{ + } else{ match os::getenv("RUST_TEST_TASKS") { Some(s) => { let opt_n: Option = FromStr::from_str(s); From d92f96d1419125fbcac78b50595e7e8ce6112b72 Mon Sep 17 00:00:00 2001 From: reedlepee Date: Mon, 4 Nov 2013 03:42:30 +0530 Subject: [PATCH 3/3] Formatting #1921 --- src/libextra/test.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libextra/test.rs b/src/libextra/test.rs index 23a805d8aec41..d2b57301d0909 100644 --- a/src/libextra/test.rs +++ b/src/libextra/test.rs @@ -778,7 +778,7 @@ fn get_concurrency() -> uint { use std::rt; if running_on_valgrind() { 1 - } else{ + } else { match os::getenv("RUST_TEST_TASKS") { Some(s) => { let opt_n: Option = FromStr::from_str(s);