}
}
+static test_return_t _pre_runner_default(libmemcached_test_callback_fn func, libmemcached_test_container_st *container)
+{
+ if (func)
+ {
+ return func(container->parent);
+ }
+ else
+ {
+ return TEST_SUCCESS;
+ }
+}
+
+static test_return_t _post_runner_default(libmemcached_test_callback_fn func, libmemcached_test_container_st *container)
+{
+ if (func)
+ {
+ return func(container->parent);
+ }
+ else
+ {
+ return TEST_SUCCESS;
+ }
+}
+
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
static world_runner_st defualt_libmemcached_runner= {
+ reinterpret_cast<test_callback_runner_fn>(_pre_runner_default),
reinterpret_cast<test_callback_runner_fn>(_runner_default),
- reinterpret_cast<test_callback_runner_fn>(_runner_default),
- reinterpret_cast<test_callback_runner_fn>(_runner_default)
+ reinterpret_cast<test_callback_runner_fn>(_post_runner_default)
};
#else
static world_runner_st defualt_libmemcached_runner= {
+ (test_callback_runner_fn)_pre_runner_default,
(test_callback_runner_fn)_runner_default,
- (test_callback_runner_fn)_runner_default,
- (test_callback_runner_fn)_runner_default
+ (test_callback_runner_fn)_post_runner_default
};
#endif
collection_rc= world.collection.startup(world_ptr);
+ if (collection_rc != TEST_SUCCESS)
+ goto skip_pre;
+
+ if (next->pre)
+ {
+ collection_rc= world.runner->pre(next->pre, world_ptr);
+ }
+
+skip_pre:
switch (collection_rc)
{
case TEST_SUCCESS:
break;
case TEST_FAILURE:
fprintf(stderr, "\n%s [ failed ]\n\n", next->name);
- stats.failed++;
- continue;
+ stats.collection_failed++;
+ goto cleanup;
case TEST_SKIPPED:
fprintf(stderr, "\n%s [ skipping ]\n\n", next->name);
- stats.skipped++;
- continue;
+ stats.collection_skipped++;
+ goto cleanup;
case TEST_MEMORY_ALLOCATION_FAILURE:
case TEST_MAXIMUM_RETURN:
default:
break;
}
+
for (x= 0; run->name; run++)
{
struct timeval start_time, end_time;
// Runner code
{
+#if 0
if (next->pre && world.runner->pre)
{
return_code= world.runner->pre(next->pre, world_ptr);
goto error;
}
}
+#endif
gettimeofday(&start_time, NULL);
return_code= world.runner->run(run->test_fn, world_ptr);
gettimeofday(&end_time, NULL);
load_time= timedif(end_time, start_time);
+#if 0
if (next->post && world.runner->post)
{
(void) world.runner->post(next->post, world_ptr);
}
+#endif
}
if (world.test.post_run)
world.test.post_run(world_ptr);
}
-error:
stats.total++;
fprintf(stderr, "\t\t\t\t\t");
}
}
- if (failed)
- {
- stats.collection_failed++;
- }
-
- if (skipped)
+ if (next->post && world.runner->post)
{
- stats.collection_skipped++;
+ (void) world.runner->post(next->post, world_ptr);
}
if (! failed && ! skipped)
{
stats.collection_success++;
}
+cleanup:
world.collection.shutdown(world_ptr);
}