about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-09-03 22:05:59 -0700
committerbors <bors@rust-lang.org>2013-09-03 22:05:59 -0700
commit1611e7b72a33ece8a05fdb274e20e14143f52015 (patch)
tree938913207953881c3954a0800b6589e682e60b82
parent523701aad00570b1f1632df25673872ffd9be7e8 (diff)
parentaeb2f88a4872edb38549a73f6003477d1d7b5928 (diff)
downloadrust-1611e7b72a33ece8a05fdb274e20e14143f52015.tar.gz
rust-1611e7b72a33ece8a05fdb274e20e14143f52015.zip
auto merge of #8943 : alexcrichton/rust/issue-8904, r=brson
We already do this for libstd tests automatically, and compiletest runs into the
same problems where when forking lots of processes lots of file descriptors are
created. On OSX we can use specific syscalls to raise the limits, in this
situation, though.

Closes #8904
-rw-r--r--src/compiletest/compiletest.rs5
-rw-r--r--src/libstd/rt/test.rs10
2 files changed, 13 insertions, 2 deletions
diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs
index be8f9655010..969f4e4373a 100644
--- a/src/compiletest/compiletest.rs
+++ b/src/compiletest/compiletest.rs
@@ -16,6 +16,7 @@
 extern mod extra;
 
 use std::os;
+use std::rt;
 use std::f64;
 
 use extra::getopts;
@@ -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"); }
 }
diff --git a/src/libstd/rt/test.rs b/src/libstd/rt/test.rs
index 4e2f9fbe130..2c293af1eaf 100644
--- a/src/libstd/rt/test.rs
+++ b/src/libstd/rt/test.rs
@@ -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.
@@ -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);