delete _runner;
}
-test_return_t Framework::Item::pre(void *arg)
-{
- if (pre_run)
- {
- return pre_run(arg);
- }
-
- return TEST_SUCCESS;
-}
-
-test_return_t Framework::Item::post(void *arg)
-{
- if (post_run)
- {
- return post_run(arg);
- }
-
- return TEST_SUCCESS;
-}
-
test_return_t Framework::Item::flush(void* arg, test_st* run)
{
if (run->requires_flush and _flush)
*/
test_callback_fn *_flush;
- private:
- /*
- Run before and after the runnner is executed.
- */
- test_callback_fn *pre_run;
- test_callback_fn *post_run;
-
public:
Item() :
_startup(NULL),
- _flush(NULL),
- pre_run(NULL),
- post_run(NULL)
+ _flush(NULL)
{ }
void set_startup(test_callback_fn *arg)
_flush= arg;
}
- void set_pre(test_callback_fn *arg)
- {
- pre_run= arg;
- }
-
- void set_post(test_callback_fn *arg)
- {
- pre_run= arg;
- }
-
- test_return_t pre(void *arg);
test_return_t flush(void* arg, test_st* run);
- test_return_t post(void *arg);
} item;
{
if (test_success(return_code= world.item.flush(creators_ptr, run)))
{
- // @note pre will fail is SKIPPED is returned
- if (test_success(return_code= world.item.pre(creators_ptr)))
- {
- { // Runner Code
- gettimeofday(&start_time, NULL);
- assert(world.runner());
- assert(run->test_fn);
- try
+ { // Runner Code
+ gettimeofday(&start_time, NULL);
+ assert(world.runner());
+ assert(run->test_fn);
+ try
+ {
+ return_code= world.runner()->run(run->test_fn, creators_ptr);
+ }
+ // Special case where check for the testing of the exception
+ // system.
+ catch (libtest::fatal &e)
+ {
+ if (fatal::is_disabled())
{
- return_code= world.runner()->run(run->test_fn, creators_ptr);
+ fatal::increment_disabled_counter();
+ return_code= TEST_SUCCESS;
}
- // Special case where check for the testing of the exception
- // system.
- catch (libtest::fatal &e)
+ else
{
- if (fatal::is_disabled())
- {
- fatal::increment_disabled_counter();
- return_code= TEST_SUCCESS;
- }
- else
- {
- throw;
- }
+ throw;
}
-
- gettimeofday(&end_time, NULL);
- load_time= timedif(end_time, start_time);
}
- }
- // @todo do something if post fails
- (void)world.item.post(creators_ptr);
+ gettimeofday(&end_time, NULL);
+ load_time= timedif(end_time, start_time);
+ }
}
else if (return_code == TEST_SKIPPED)
{ }
world->_destroy= (test_callback_destroy_fn*)world_destroy;
world->item._startup= (test_callback_fn*)world_test_startup;
- world->item.set_pre((test_callback_fn*)world_pre_run);
world->item.set_flush((test_callback_fn*)world_flush);
- world->item.set_post((test_callback_fn*)world_post_run);
world->_on_error= (test_callback_error_fn*)world_on_error;
world->collection_startup= (test_callback_fn*)world_container_startup;
world->_destroy= (test_callback_destroy_fn*)world_destroy;
world->item._startup= (test_callback_fn*)world_test_startup;
- world->item.set_pre((test_callback_fn*)world_pre_run);
world->item.set_flush((test_callback_fn*)world_flush);
- world->item.set_post((test_callback_fn*)world_post_run);
world->_on_error= (test_callback_error_fn*)world_on_error;
world->collection_startup= (test_callback_fn*)world_container_startup;
world->_destroy= (test_callback_destroy_fn*)world_destroy;
world->item._startup= (test_callback_fn*)world_test_startup;
- world->item.set_pre((test_callback_fn*)world_pre_run);
world->item.set_flush((test_callback_fn*)world_flush);
- world->item.set_post((test_callback_fn*)world_post_run);
world->_on_error= (test_callback_error_fn*)world_on_error;
world->collection_startup= (test_callback_fn*)world_container_startup;
world->item._startup= (test_callback_fn*)world_test_startup;
world->item._flush= (test_callback_fn*)world_flush;
- world->item.set_pre((test_callback_fn*)world_pre_run);
- world->item.set_post((test_callback_fn*)world_post_run);
world->_on_error= (test_callback_error_fn*)world_on_error;
world->collection_startup= (test_callback_fn*)world_container_startup;
world->item._startup= reinterpret_cast<test_callback_fn*>(world_test_startup);
world->item._flush= reinterpret_cast<test_callback_fn*>(world_flush);
- world->item.set_pre(reinterpret_cast<test_callback_fn*>(world_pre_run));
- world->item.set_post(reinterpret_cast<test_callback_fn*>(world_post_run));
world->_on_error= reinterpret_cast<test_callback_error_fn*>(world_on_error);
world->collection_startup= reinterpret_cast<test_callback_fn*>(world_container_startup);
world->_destroy= (test_callback_destroy_fn*)world_destroy;
world->item._startup= (test_callback_fn*)world_test_startup;
- world->item.set_pre((test_callback_fn*)world_pre_run);
world->item.set_flush((test_callback_fn*)world_flush);
- world->item.set_post((test_callback_fn*)world_post_run);
world->_on_error= (test_callback_error_fn*)world_on_error;
world->collection_startup= (test_callback_fn*)world_container_startup;
return TEST_SUCCESS;
}
-static test_return_t world_pre_run(libmemcached_test_container_st *container)
-{
- test_true(container->memc);
- for (uint32_t loop= 0; loop < memcached_server_list_count(container->memc->servers); loop++)
- {
- memcached_server_instance_st instance= memcached_server_instance_by_position(container->memc, loop);
-
- test_compare(-1, instance->fd);
- test_compare(0U, instance->cursor_active);
- }
-
- return TEST_SUCCESS;
-}
-
-
-static test_return_t world_post_run(libmemcached_test_container_st *container)
-{
- test_true(container->memc);
-
- return TEST_SUCCESS;
-}
-
static test_return_t world_on_error(test_return_t , libmemcached_test_container_st *container)
{
test_true(container->memc);
return TEST_SUCCESS;
}
-static test_return_t world_pre_run(libmemcached_test_container_st *container)
-{
- test_true(container->memc);
- for (uint32_t loop= 0; loop < memcached_server_list_count(container->memc->servers); loop++)
- {
- memcached_server_instance_st instance=
- memcached_server_instance_by_position(container->memc, loop);
-
- test_compare(-1, instance->fd);
- test_compare(0U, instance->cursor_active);
- }
-
- return TEST_SUCCESS;
-}
-
-
-static test_return_t world_post_run(libmemcached_test_container_st *container)
-{
- test_true(container->memc);
-
- return TEST_SUCCESS;
-}
-
static test_return_t world_on_error(test_return_t , libmemcached_test_container_st *container)
{
test_true(container->memc);
world->item._startup= (test_callback_fn*)world_test_startup;
world->item._flush= (test_callback_fn*)world_flush;
- world->item.set_pre((test_callback_fn*)world_pre_run);
- world->item.set_post((test_callback_fn*)world_post_run);
world->_on_error= (test_callback_error_fn*)world_on_error;
world->collection_startup= (test_callback_fn*)world_container_startup;