mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 21:15:18 +03:00
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.
This commit is contained in:
+7
-13
@@ -24,6 +24,12 @@
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user