diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-07-25 18:07:25 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-07-29 21:07:03 -0700 |
| commit | 96a629d2fa5144ccba39cc0e4258b6e0fe2da283 (patch) | |
| tree | a31f83ca4f26b8bdb4365241223fc0b49bbf3ac2 | |
| parent | 9dbe6941c45571fb401719fa7b6a811a4ff0e80d (diff) | |
| download | rust-96a629d2fa5144ccba39cc0e4258b6e0fe2da283.tar.gz rust-96a629d2fa5144ccba39cc0e4258b6e0fe2da283.zip | |
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.
| -rw-r--r-- | src/lib/test.rs | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/lib/test.rs b/src/lib/test.rs index d751cceb265..7ee3c62c291 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 |
