From 96a629d2fa5144ccba39cc0e4258b6e0fe2da283 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Mon, 25 Jul 2011 18:07:25 -0700 Subject: [PATCH] Base test concurrency on the number of scheduler threads. Ideally we would just spawn every test and collect the results but I'm not entirely comfortable doing that yet for reasons that I'm too tired to remember right now. Urgh. --- src/lib/test.rs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/lib/test.rs b/src/lib/test.rs index d751cceb2652..7ee3c62c291b 100644 --- a/src/lib/test.rs +++ b/src/lib/test.rs @@ -24,6 +24,12 @@ export test_to_task; export default_test_to_task; export configure_test_task; +native "rust" mod rustrt { + fn hack_allow_leaks(); + fn sched_threads() -> uint; +} + + // The name of a test. By convention this follows the rules for rust // paths, i.e it should be a series of identifiers seperated by double // colons. This way if some test runner wants to arrange the tests @@ -236,15 +242,7 @@ fn run_tests(opts: &test_opts, tests: &test_desc[], } } -fn get_concurrency() -> uint { - alt getenv("RUST_THREADS") { - option::some(t) { - let threads = uint::parse_buf(str::bytes(t), 10u); - threads > 0u ? threads : 1u - } - option::none. { 1u } - } -} +fn get_concurrency() -> uint { rustrt::sched_threads() } fn filter_tests(opts: &test_opts, tests: &test_desc[]) -> test_desc[] { let filtered = tests; @@ -329,10 +327,6 @@ fn run_test(test: &test_desc, to_task: &test_to_task) -> test_future { } } -native "rust" mod rustrt { - fn hack_allow_leaks(); -} - // We need to run our tests in another task in order to trap test failures. // But, at least currently, functions can't be used as spawn arguments so // we've got to treat our test functions as unsafe pointers. This function