about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-08-17 00:22:05 -0700
committerbors <bors@rust-lang.org>2013-08-17 00:22:05 -0700
commit8ac17731eba236648e86b4e760d6c93addf19fa0 (patch)
tree90a16f68b156411aabc6ca625bb3f84fa39af671
parenta1674b6150b20616c954e37206012b356ff81b1c (diff)
parent15fca2dad7c2abc60610635fd9ae0998abe43e54 (diff)
downloadrust-8ac17731eba236648e86b4e760d6c93addf19fa0.tar.gz
rust-8ac17731eba236648e86b4e760d6c93addf19fa0.zip
auto merge of #8531 : brson/rust/test-waitpid-workaround, r=graydon
...er

I believe the calls to waitpid are interacting badly with the message passing that goes
on between schedulers and causing us to have very little parallelism in
the test suite. I don't fully understand the sequence of events that causes
the problem here but clearly blocking on waitpid is something that a
well-behaved task should not be doing.

Unfortunately this adds quite a bit of overhead to each test: one thread, two
tasks, three stacks, so there's a tradeoff. The time to execute run-pass on
my 4-core machine goes from ~750s to ~300s.

This should have a pretty good impact on cycle times.

cc @toddaaro
-rw-r--r--src/compiletest/runtest.rs18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs
index 0fb64152d37..2346aba3bcb 100644
--- a/src/compiletest/runtest.rs
+++ b/src/compiletest/runtest.rs
@@ -20,16 +20,30 @@ use procsrv;
 use util;
 use util::logv;
 
+use std::cell::Cell;
 use std::io;
 use std::os;
 use std::str;
+use std::task::{spawn_sched, SingleThreaded};
 use std::vec;
 
 use extra::test::MetricMap;
 
 pub fn run(config: config, testfile: ~str) {
-    let mut _mm = MetricMap::new();
-    run_metrics(config, testfile, &mut _mm);
+    let config = Cell::new(config);
+    let testfile = Cell::new(testfile);
+    // FIXME #6436: Creating another thread to run the test because this
+    // is going to call waitpid. The new scheduler has some strange
+    // interaction between the blocking tasks and 'friend' schedulers
+    // that destroys parallelism if we let normal schedulers block.
+    // It should be possible to remove this spawn once std::run is
+    // rewritten to be non-blocking.
+    do spawn_sched(SingleThreaded) {
+        let config = config.take();
+        let testfile = testfile.take();
+        let mut _mm = MetricMap::new();
+        run_metrics(config, testfile, &mut _mm);
+    }
 }
 
 pub fn run_metrics(config: config, testfile: ~str, mm: &mut MetricMap) {