Skip to content

Commit e81d6d2

Browse files
committed
Don't stop at first test failure
Since compiletest is setting up its own test tasks it needs to configure them the correct way, which means allowing them to leak.
1 parent 51ef7a3 commit e81d6d2

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

src/lib/test.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export filter_tests;
2222
export parse_opts;
2323
export test_to_task;
2424
export default_test_to_task;
25+
export configure_test_task;
2526

2627
// The name of a test. By convention this follows the rules for rust
2728
// paths, i.e it should be a series of identifiers seperated by double
@@ -300,24 +301,26 @@ native "rust" mod rustrt {
300301
// only works with functions that don't contain closures.
301302
fn default_test_to_task(f: &fn()) -> task {
302303
fn run_task(fptr: *mutable fn() ) {
303-
// If this task fails we don't want that failure to propagate to the
304-
// test runner or else we couldn't keep running tests
305-
task::unsupervise();
306-
307-
// FIXME (236): Hack supreme - unwinding doesn't work yet so if this
308-
// task fails memory will not be freed correctly. This turns off the
309-
// sanity checks in the runtime's memory region for the task, so that
310-
// the test runner can continue.
311-
rustrt::hack_allow_leaks();
312-
313-
304+
configure_test_task();
314305
// Run the test
315306
(*fptr)()
316307
}
317308
let fptr = ptr::addr_of(f);
318309
ret spawn run_task(fptr);
319310
}
320311

312+
// Call from within a test task to make sure it's set up correctly
313+
fn configure_test_task() {
314+
// If this task fails we don't want that failure to propagate to the
315+
// test runner or else we couldn't keep running tests
316+
task::unsupervise();
317+
318+
// FIXME (236): Hack supreme - unwinding doesn't work yet so if this
319+
// task fails memory will not be freed correctly. This turns off the
320+
// sanity checks in the runtime's memory region for the task, so that
321+
// the test runner can continue.
322+
rustrt::hack_allow_leaks();
323+
}
321324

322325
// Local Variables:
323326
// mode: rust;

src/test/compiletest/compiletest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,12 +388,12 @@ mod runtest {
388388
export run;
389389

390390
fn run(cx: &cx, testfile: &str) {
391+
test::configure_test_task();
391392
if (cx.config.verbose) {
392393
// We're going to be dumping a lot of info. Start on a new line.
393394
io::stdout().write_str("\n\n");
394395
}
395396
log #fmt("running %s", testfile);
396-
task::unsupervise();
397397
let props = load_props(testfile);
398398
alt cx.config.mode {
399399
mode_compile_fail. { run_cfail_test(cx, props, testfile); }

0 commit comments

Comments
 (0)