X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=libtest%2Fframework.cc;h=327c2c0de4ae65b827ec8fe340d045826e546327;hb=aacf5ba18fa98145d95f7a0567f0b32306fac1aa;hp=ea7ca66505e79af9811da02b3701f854c772f151;hpb=23bbe3972dada1e21493437ba64be129e86b59fc;p=awesomized%2Flibmemcached diff --git a/libtest/framework.cc b/libtest/framework.cc index ea7ca665..327c2c0d 100644 --- a/libtest/framework.cc +++ b/libtest/framework.cc @@ -43,12 +43,12 @@ #include #include -using namespace libtest; +namespace libtest { Framework::Framework(libtest::SignalThread& signal, + const std::string& name_, const std::string& only_run_arg, const std::string& wildcard_arg) : - _collections(NULL), _total(0), _success(0), _skipped(0), @@ -61,11 +61,15 @@ Framework::Framework(libtest::SignalThread& signal, _creators_ptr(NULL), _signal(signal), _only_run(only_run_arg), - _wildcard(wildcard_arg) + _wildcard(wildcard_arg), + _name(name_) { get_world(this); +} - for (collection_st *next= _collections; next and next->name; next++) +void Framework::collections(collection_st* collections_) +{ + for (collection_st *next= collections_; next and next->name; next++) { _collection.push_back(new Collection(this, next)); } @@ -84,7 +88,7 @@ Framework::~Framework() for (std::vector::iterator iter= _collection.begin(); iter != _collection.end(); - iter++) + ++iter) { delete *iter; } @@ -104,7 +108,7 @@ void Framework::exec() { for (std::vector::iterator iter= _collection.begin(); iter != _collection.end() and (_signal.is_shutdown() == false); - iter++) + ++iter) { if (_only_run.empty() == false and fnmatch(_only_run.c_str(), (*iter)->name(), 0)) @@ -134,16 +138,23 @@ void Framework::exec() } catch (libtest::fatal& e) { + _failed++; stream::cerr(e.file(), e.line(), e.func()) << e.mesg(); } catch (libtest::disconnected& e) { + _failed++; Error << "Unhandled disconnection occurred:" << e.what(); throw; } - - Outn(); + catch (...) + { + _failed++; + throw; + } } + + void xml(const std::string& testsuites_name, std::ostream& output); } uint32_t Framework::sum_total() @@ -151,7 +162,7 @@ uint32_t Framework::sum_total() uint32_t count= 0; for (std::vector::iterator iter= _collection.begin(); iter != _collection.end(); - iter++) + ++iter) { count+= (*iter)->total(); } @@ -164,7 +175,7 @@ uint32_t Framework::sum_success() uint32_t count= 0; for (std::vector::iterator iter= _collection.begin(); iter != _collection.end(); - iter++) + ++iter) { count+= (*iter)->success(); } @@ -177,7 +188,7 @@ uint32_t Framework::sum_skipped() uint32_t count= 0; for (std::vector::iterator iter= _collection.begin(); iter != _collection.end(); - iter++) + ++iter) { count+= (*iter)->skipped(); } @@ -190,7 +201,7 @@ uint32_t Framework::sum_failed() uint32_t count= 0; for (std::vector::iterator iter= _collection.begin(); iter != _collection.end(); - iter++) + ++iter) { count+= (*iter)->failed(); } @@ -219,3 +230,5 @@ test_return_t Framework::create() return rc; } + +} // namespace libtest