Skip to content

Raise the file descriptor limits when running compiletest #8943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/compiletest/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
extern mod extra;

use std::os;
use std::rt;
use std::f64;

use extra::getopts;
Expand Down Expand Up @@ -223,6 +224,10 @@ pub fn mode_str(mode: mode) -> ~str {
pub fn run_tests(config: &config) {
let opts = test_opts(config);
let tests = make_tests(config);
// sadly osx needs some file descriptor limits raised for running tests in
// parallel (especially when we have lots and lots of child processes).
// For context, see #8904
rt::test::prepare_for_lots_of_tests();
let res = test::run_tests_console(&opts, tests);
if !res { fail!("Some tests failed"); }
}
Expand Down
10 changes: 8 additions & 2 deletions src/libstd/rt/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ mod darwin_fd_limit {
pub unsafe fn raise_fd_limit() {}
}

#[doc(hidden)]
pub fn prepare_for_lots_of_tests() {
// Bump the fd limit on OS X. See darwin_fd_limit for an explanation.
unsafe { darwin_fd_limit::raise_fd_limit() }
}

/// Create more than one scheduler and run a function in a task
/// in one of the schedulers. The schedulers will stay alive
/// until the function `f` returns.
Expand All @@ -153,8 +159,8 @@ pub fn run_in_mt_newsched_task(f: ~fn()) {
use rt::sched::Shutdown;
use rt::util;

// Bump the fd limit on OS X. See darwin_fd_limit for an explanation.
unsafe { darwin_fd_limit::raise_fd_limit() }
// see comment in other function (raising fd limits)
prepare_for_lots_of_tests();

let f = Cell::new(f);

Expand Down