@@ -22,6 +22,7 @@ export filter_tests;
22
22
export parse_opts;
23
23
export test_to_task;
24
24
export default_test_to_task;
25
+ export configure_test_task;
25
26
26
27
// The name of a test. By convention this follows the rules for rust
27
28
// paths, i.e it should be a series of identifiers seperated by double
@@ -300,24 +301,26 @@ native "rust" mod rustrt {
300
301
// only works with functions that don't contain closures.
301
302
fn default_test_to_task ( f : & fn ( ) ) -> task {
302
303
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 ( ) ;
314
305
// Run the test
315
306
( * fptr) ( )
316
307
}
317
308
let fptr = ptr:: addr_of ( f) ;
318
309
ret spawn run_task ( fptr) ;
319
310
}
320
311
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
+ }
321
324
322
325
// Local Variables:
323
326
// mode: rust;
0 commit comments