Fixes for scanner/parser from OSX.
[awesomized/libmemcached] / libtest / collection.cc
index 26e8bb44e33d455ef725546dc98fe338da3427b3..1b4915e13d75ac1802e40a9cd37906b83fb814ad 100644 (file)
  *
  */
 
-#include <config.h>
+#include "libtest/yatlcon.h"
 
 #include <libtest/common.h>
 
+// @todo possibly have this code fork off so if it fails nothing goes bad
 static test_return_t runner_code(libtest::Framework* frame,
                                  test_st* run, 
                                  libtest::Timer& _timer)
@@ -50,7 +51,7 @@ static test_return_t runner_code(libtest::Framework* frame,
   try 
   {
     _timer.reset();
-    return_code= frame->runner()->run(run->test_fn, frame->creators_ptr());
+    return_code= frame->runner()->main(run->test_fn, frame->creators_ptr());
   }
   // Special case where check for the testing of the exception
   // system.
@@ -85,14 +86,14 @@ Collection::Collection(Framework* frame_arg,
   _skipped(0),
   _failed(0),
   _total(0),
-  _formatter(_name)
+  _formatter(frame_arg->name(), _name)
 {
   fatal_assert(arg);
 }
 
 test_return_t Collection::exec()
 {
-  if (test_success(_frame->runner()->pre(_pre, _frame->creators_ptr())))
+  if (test_success(_frame->runner()->setup(_pre, _frame->creators_ptr())))
   {
     for (test_st *run= _tests; run->name; run++)
     {
@@ -118,19 +119,21 @@ test_return_t Collection::exec()
           }
         }
 
-        alarm(600);
+        set_alarm();
+
         try 
         {
           return_code= runner_code(_frame, run, _timer);
         }
         catch (...)
         {
-          alarm(0);
+          cancel_alarm();
+
           throw;
         }
-        alarm(0);
+        libtest::cancel_alarm();
       }
-      catch (libtest::exception &e)
+      catch (libtest::fatal &e)
       {
         stream::cerr(e.file(), e.line(), e.func()) << e.what();
         _failed++;
@@ -163,7 +166,7 @@ test_return_t Collection::exec()
 #endif
     }
 
-    (void) _frame->runner()->post(_post, _frame->creators_ptr());
+    (void) _frame->runner()->teardown(_post, _frame->creators_ptr());
   }
 
   if (_failed == 0 and _skipped == 0 and _success)