Skip to content

Commit 610b2b5

Browse files
committed
compiletest: do not run tests in sub-threads if on valgrind.
1 parent 19f4ae1 commit 610b2b5

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/compiletest/runtest.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use std::os;
2626
use std::str;
2727
use std::task::{spawn_sched, SingleThreaded};
2828
use std::vec;
29+
use std::unstable::running_on_valgrind;
2930

3031
use extra::test::MetricMap;
3132

@@ -38,11 +39,21 @@ pub fn run(config: config, testfile: ~str) {
3839
// that destroys parallelism if we let normal schedulers block.
3940
// It should be possible to remove this spawn once std::run is
4041
// rewritten to be non-blocking.
41-
do spawn_sched(SingleThreaded) {
42+
//
43+
// We do _not_ create another thread if we're running on V because
44+
// it serializes all threads anyways.
45+
if running_on_valgrind() {
4246
let config = config.take();
4347
let testfile = testfile.take();
4448
let mut _mm = MetricMap::new();
4549
run_metrics(config, testfile, &mut _mm);
50+
} else {
51+
do spawn_sched(SingleThreaded) {
52+
let config = config.take();
53+
let testfile = testfile.take();
54+
let mut _mm = MetricMap::new();
55+
run_metrics(config, testfile, &mut _mm);
56+
}
4657
}
4758
}
4859

0 commit comments

Comments
 (0)