Skip to content

compiletest: Run tests in their own thread to avoid blocking the schedul... #8531

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
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
18 changes: 16 additions & 2 deletions src/compiletest/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down