X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fcollection.cc;h=86e7f864a922c4034cf29f32b1495d660be9bcd0;hb=d75ea573873b3e4369306a59aa61b776ae9ff53f;hp=346a151cb69ac422d49609cb300b3bc7fb975f48;hpb=00a8f6f7d315dc3fce0b0e5a1987c8663488ae1c;p=awesomized%2Flibmemcached diff --git a/libtest/collection.cc b/libtest/collection.cc index 346a151c..86e7f864 100644 --- a/libtest/collection.cc +++ b/libtest/collection.cc @@ -34,10 +34,11 @@ * */ -#include +#include "libtest/yatlcon.h" #include +// @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,11 +51,11 @@ 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. - catch (libtest::fatal &e) + catch (const libtest::fatal& e) { if (libtest::fatal::is_disabled()) { @@ -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(60); + 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 (const libtest::fatal& e) { stream::cerr(e.file(), e.line(), e.func()) << e.what(); _failed++; @@ -156,14 +159,14 @@ test_return_t Collection::exec() break; default: - fatal_message("invalid return code"); + FATAL("invalid return code"); } #if 0 @TODO add code here to allow for a collection to define a method to reset to allow tests to continue. #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)