X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fcollection.cc;h=b3bdbdeee69548e43776e62340292642e4e83e76;hb=9065046a3fd404f72fb090cb0da65cfa8443032f;hp=5814c2f4a1546cd2fe72ea5a13d0f6628387e4d6;hpb=23bbe3972dada1e21493437ba64be129e86b59fc;p=awesomized%2Flibmemcached diff --git a/libtest/collection.cc b/libtest/collection.cc index 5814c2f4..b3bdbdee 100644 --- a/libtest/collection.cc +++ b/libtest/collection.cc @@ -34,11 +34,11 @@ * */ -#include +#include "libtest/yatlcon.h" #include -static test_return_t runner_code(Framework* frame, +static test_return_t runner_code(libtest::Framework* frame, test_st* run, libtest::Timer& _timer) { // Runner Code @@ -84,21 +84,22 @@ Collection::Collection(Framework* frame_arg, _success(0), _skipped(0), _failed(0), - _total(0) + _total(0), + _formatter(frame_arg->name(), _name) { fatal_assert(arg); } test_return_t Collection::exec() { - Out << "Collection: " << _name; - if (test_success(_frame->runner()->pre(_pre, _frame->creators_ptr()))) { for (test_st *run= _tests; run->name; run++) { + formatter()->push_testcase(run->name); if (_frame->match(run->name)) { + formatter()->skipped(); continue; } _total++; @@ -112,38 +113,48 @@ test_return_t Collection::exec() { Error << "frame->runner()->flush(creators_ptr)"; _skipped++; + formatter()->skipped(); continue; } } - return_code= runner_code(_frame, run, _timer); + set_alarm(); + + try + { + return_code= runner_code(_frame, run, _timer); + } + catch (...) + { + cancel_alarm(); + + throw; + } + libtest::cancel_alarm(); } catch (libtest::fatal &e) { - Error << "Fatal exception was thrown: " << e.what(); + stream::cerr(e.file(), e.line(), e.func()) << e.what(); _failed++; + formatter()->failed(); throw; } switch (return_code) { case TEST_SUCCESS: - Out << "\tTesting " - << run->name - << "\t\t\t\t\t" - << _timer - << " [ " << test_strerror(return_code) << " ]"; _success++; + formatter()->success(_timer); break; case TEST_FAILURE: _failed++; - Out << "\tTesting " << run->name << "\t\t\t\t\t" << "[ " << test_strerror(return_code) << " ]"; + formatter()->failed(); break; case TEST_SKIPPED: _skipped++; - Out << "\tTesting " << run->name << "\t\t\t\t\t" << "[ " << test_strerror(return_code) << " ]"; + formatter()->skipped(); break; default: