about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-07-27 18:30:57 -0700
committerBrian Anderson <banderson@mozilla.com>2011-07-27 19:04:57 -0700
commite81d6d28e7a6f4e42bb005b7aaaa765688de61cb (patch)
tree5877264b84266e4e77ebb3340e0749248fd57f2b
parent51ef7a3676c2665ca41e4ec9f5b43c7a2eb7c6d8 (diff)
downloadrust-e81d6d28e7a6f4e42bb005b7aaaa765688de61cb.tar.gz
rust-e81d6d28e7a6f4e42bb005b7aaaa765688de61cb.zip
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.
-rw-r--r--src/lib/test.rs25
-rw-r--r--src/test/compiletest/compiletest.rs2
2 files changed, 15 insertions, 12 deletions
diff --git a/src/lib/test.rs b/src/lib/test.rs
index 1e9ad1f9f4c..7fc6ad4da13 100644
--- a/src/lib/test.rs
+++ b/src/lib/test.rs
@@ -22,6 +22,7 @@ export filter_tests;
 export parse_opts;
 export test_to_task;
 export default_test_to_task;
+export configure_test_task;
 
 // The name of a test. By convention this follows the rules for rust
 // paths, i.e it should be a series of identifiers seperated by double
@@ -300,17 +301,7 @@ native "rust" mod rustrt {
 // only works with functions that don't contain closures.
 fn default_test_to_task(f: &fn()) -> task {
     fn run_task(fptr: *mutable fn() ) {
-        // If this task fails we don't want that failure to propagate to the
-        // test runner or else we couldn't keep running tests
-        task::unsupervise();
-
-        // FIXME (236): Hack supreme - unwinding doesn't work yet so if this
-        // task fails memory will not be freed correctly. This turns off the
-        // sanity checks in the runtime's memory region for the task, so that
-        // the test runner can continue.
-        rustrt::hack_allow_leaks();
-
-
+        configure_test_task();
         // Run the test
         (*fptr)()
     }
@@ -318,6 +309,18 @@ fn default_test_to_task(f: &fn()) -> task {
     ret spawn run_task(fptr);
 }
 
+// Call from within a test task to make sure it's set up correctly
+fn configure_test_task() {
+    // If this task fails we don't want that failure to propagate to the
+    // test runner or else we couldn't keep running tests
+    task::unsupervise();
+
+    // FIXME (236): Hack supreme - unwinding doesn't work yet so if this
+    // task fails memory will not be freed correctly. This turns off the
+    // sanity checks in the runtime's memory region for the task, so that
+    // the test runner can continue.
+    rustrt::hack_allow_leaks();
+}
 
 // Local Variables:
 // mode: rust;
diff --git a/src/test/compiletest/compiletest.rs b/src/test/compiletest/compiletest.rs
index ddae56e29b7..ff6fc171d9e 100644
--- a/src/test/compiletest/compiletest.rs
+++ b/src/test/compiletest/compiletest.rs
@@ -388,12 +388,12 @@ mod runtest {
     export run;
 
     fn run(cx: &cx, testfile: &str) {
+        test::configure_test_task();
         if (cx.config.verbose) {
             // We're going to be dumping a lot of info. Start on a new line.
             io::stdout().write_str("\n\n");
         }
         log #fmt("running %s", testfile);
-        task::unsupervise();
         let props = load_props(testfile);
         alt cx.config.mode {
                 mode_compile_fail. { run_cfail_test(cx, props, testfile); }