37
37
#include <config.h>
38
39
#include <libtest/common.h>
40
#include <libtest/collection.h>
41
#include <libtest/signal.h>
39
44
#include <iostream>
41
46
using namespace libtest;
43
Framework::Framework() :
48
Framework::Framework(libtest::SignalThread& signal,
49
const std::string& only_run_arg,
50
const std::string& wildcard_arg) :
62
_only_run(only_run_arg),
63
_wildcard(wildcard_arg)
67
for (collection_st *next= collections; next and next->name; next++)
69
_collection.push_back(new Collection(this, next));
53
73
Framework::~Framework()
60
80
_servers.shutdown();
84
for (std::vector<Collection*>::iterator iter= _collection.begin();
85
iter != _collection.end();
92
bool Framework::match(const char* arg)
94
if (_wildcard.empty() == false and fnmatch(_wildcard.c_str(), arg, 0))
102
void Framework::exec()
104
for (std::vector<Collection*>::iterator iter= _collection.begin();
105
iter != _collection.end() and (_signal.is_shutdown() == false);
108
if (_only_run.empty() == false and
109
fnmatch(_only_run.c_str(), (*iter)->name(), 0))
117
switch ((*iter)->exec())
127
// exec() can return SUCCESS, but that doesn't mean that some tests did
128
// not fail or get skipped.
134
catch (libtest::fatal& e)
136
stream::cerr(e.file(), e.line(), e.func()) << e.mesg();
138
catch (libtest::disconnected& e)
140
Error << "Unhandled disconnection occurred:" << e.what();
148
uint32_t Framework::sum_total()
151
for (std::vector<Collection*>::iterator iter= _collection.begin();
152
iter != _collection.end();
155
count+= (*iter)->total();
161
uint32_t Framework::sum_success()
164
for (std::vector<Collection*>::iterator iter= _collection.begin();
165
iter != _collection.end();
168
count+= (*iter)->success();
174
uint32_t Framework::sum_skipped()
177
for (std::vector<Collection*>::iterator iter= _collection.begin();
178
iter != _collection.end();
181
count+= (*iter)->skipped();
187
uint32_t Framework::sum_failed()
190
for (std::vector<Collection*>::iterator iter= _collection.begin();
191
iter != _collection.end();
194
count+= (*iter)->failed();
65
200
libtest::Runner *Framework::runner()
76
void* Framework::create(test_return_t& arg)
211
test_return_t Framework::create()
213
test_return_t rc= TEST_SUCCESS;
81
return _creators_ptr= _create(_servers, arg);
216
_creators_ptr= _create(_servers, rc);