_runner_default
};
+static test_return_t _default_callback(void *p)
+{
+ (void)p;
+
+ return TEST_SUCCESS;
+}
+
+static inline void set_default_fn(test_callback_fn *fn)
+{
+ if (*fn == NULL)
+ {
+ *fn= _default_callback;
+ }
+}
+
+static collection_st *init_world(world_st *world)
+{
+ if (! world->runner)
+ {
+ world->runner= &defualt_runners;
+ }
+
+ set_default_fn(&world->collection.startup);
+ set_default_fn(&world->collection.shutdown);
+
+ return world->collections;
+}
+
int main(int argc, char *argv[])
{
memset(&world, 0, sizeof(world));
get_world(&world);
- if (! world.runner)
- {
- world.runner= &defualt_runners;
- }
-
- collection= world.collections;
+ collection= init_world(&world);
if (world.create)
{
stats.collection_total++;
- if (world.collection_startup)
- {
- collection_rc= world.collection_startup(world_ptr);
- }
+ collection_rc= world.collection.startup(world_ptr);
switch (collection_rc)
{
stats.collection_success++;
}
- if (world.collection_shutdown)
- {
- world.collection_shutdown(world_ptr);
- }
+ world.collection.shutdown(world_ptr);
}
if (stats.collection_failed || stats.collection_skipped)
test_callback_error_fn on_error;
} test;
- /* This is called a the beginning of any collection run. */
- test_callback_fn collection_startup;
+ struct {
+ /* This is called a the beginning of any collection run. */
+ test_callback_fn startup;
- /* This is called a the beginning of any collection run. */
- test_callback_fn collection_shutdown;
+ /* This is called at the end of any collection run. */
+ test_callback_fn shutdown;
+ } collection;
/**