projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Fix for lp:1062704
[awesomized/libmemcached]
/
libtest
/
framework.cc
diff --git
a/libtest/framework.cc
b/libtest/framework.cc
index eb0f4120de3982eacdc485d3a5e487f37a7461bf..6cca8450abcbcffbc4a7672518acb96a668c0f0f 100644
(file)
--- a/
libtest/framework.cc
+++ b/
libtest/framework.cc
@@
-43,28
+43,33
@@
#include <fnmatch.h>
#include <iostream>
#include <fnmatch.h>
#include <iostream>
-using namespace libtest;
+namespace libtest {
-Framework::Framework(libtest::SignalThread& signal,
+Framework::Framework(libtest::SignalThread& signal_,
+ const std::string& name_,
const std::string& only_run_arg,
const std::string& wildcard_arg) :
const std::string& only_run_arg,
const std::string& wildcard_arg) :
- collections(NULL),
_total(0),
_success(0),
_skipped(0),
_failed(0),
_create(NULL),
_destroy(NULL),
_total(0),
_success(0),
_skipped(0),
_failed(0),
_create(NULL),
_destroy(NULL),
+ _on_error(NULL),
_runner(NULL),
_socket(false),
_creators_ptr(NULL),
_runner(NULL),
_socket(false),
_creators_ptr(NULL),
- _signal(signal),
+ _signal(signal
_
),
_only_run(only_run_arg),
_only_run(only_run_arg),
- _wildcard(wildcard_arg)
+ _wildcard(wildcard_arg),
+ _name(name_)
{
get_world(this);
{
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));
}
{
_collection.push_back(new Collection(this, next));
}
@@
-83,11
+88,10
@@
Framework::~Framework()
for (std::vector<Collection*>::iterator iter= _collection.begin();
iter != _collection.end();
for (std::vector<Collection*>::iterator iter= _collection.begin();
iter != _collection.end();
-
iter++
)
+
++iter
)
{
delete *iter;
}
{
delete *iter;
}
- _collection.clear();
}
bool Framework::match(const char* arg)
}
bool Framework::match(const char* arg)
@@
-104,7
+108,7
@@
void Framework::exec()
{
for (std::vector<Collection*>::iterator iter= _collection.begin();
iter != _collection.end() and (_signal.is_shutdown() == false);
{
for (std::vector<Collection*>::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))
{
if (_only_run.empty() == false and
fnmatch(_only_run.c_str(), (*iter)->name(), 0))
@@
-114,7
+118,8
@@
void Framework::exec()
_total++;
_total++;
- try {
+ try
+ {
switch ((*iter)->exec())
{
case TEST_FAILURE:
switch ((*iter)->exec())
{
case TEST_FAILURE:
@@
-134,16
+139,23
@@
void Framework::exec()
}
catch (libtest::fatal& e)
{
}
catch (libtest::fatal& e)
{
+ _failed++;
stream::cerr(e.file(), e.line(), e.func()) << e.mesg();
}
catch (libtest::disconnected& e)
{
stream::cerr(e.file(), e.line(), e.func()) << e.mesg();
}
catch (libtest::disconnected& e)
{
- Error << "Unhandled disconnection occurred:" << e.what();
+ _failed++;
+ stream::cerr(e.file(), e.line(), e.func()) << "Unhandled disconnection occurred: " << e.mesg();
+ throw;
+ }
+ catch (...)
+ {
+ _failed++;
throw;
}
throw;
}
-
- Outn();
}
}
+
+ void xml(const std::string& testsuites_name, std::ostream& output);
}
uint32_t Framework::sum_total()
}
uint32_t Framework::sum_total()
@@
-151,7
+163,7
@@
uint32_t Framework::sum_total()
uint32_t count= 0;
for (std::vector<Collection*>::iterator iter= _collection.begin();
iter != _collection.end();
uint32_t count= 0;
for (std::vector<Collection*>::iterator iter= _collection.begin();
iter != _collection.end();
-
iter++
)
+
++iter
)
{
count+= (*iter)->total();
}
{
count+= (*iter)->total();
}
@@
-164,7
+176,7
@@
uint32_t Framework::sum_success()
uint32_t count= 0;
for (std::vector<Collection*>::iterator iter= _collection.begin();
iter != _collection.end();
uint32_t count= 0;
for (std::vector<Collection*>::iterator iter= _collection.begin();
iter != _collection.end();
-
iter++
)
+
++iter
)
{
count+= (*iter)->success();
}
{
count+= (*iter)->success();
}
@@
-177,7
+189,7
@@
uint32_t Framework::sum_skipped()
uint32_t count= 0;
for (std::vector<Collection*>::iterator iter= _collection.begin();
iter != _collection.end();
uint32_t count= 0;
for (std::vector<Collection*>::iterator iter= _collection.begin();
iter != _collection.end();
-
iter++
)
+
++iter
)
{
count+= (*iter)->skipped();
}
{
count+= (*iter)->skipped();
}
@@
-190,7
+202,7
@@
uint32_t Framework::sum_failed()
uint32_t count= 0;
for (std::vector<Collection*>::iterator iter= _collection.begin();
iter != _collection.end();
uint32_t count= 0;
for (std::vector<Collection*>::iterator iter= _collection.begin();
iter != _collection.end();
-
iter++
)
+
++iter
)
{
count+= (*iter)->failed();
}
{
count+= (*iter)->failed();
}
@@
-219,3
+231,5
@@
test_return_t Framework::create()
return rc;
}
return rc;
}
+
+} // namespace libtest