diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/conftest/conftest.c | 20 | ||||
-rw-r--r-- | src/conftest/conftest.h | 5 |
2 files changed, 19 insertions, 6 deletions
diff --git a/src/conftest/conftest.c b/src/conftest/conftest.c index 6491fd294..8df5d6fc2 100644 --- a/src/conftest/conftest.c +++ b/src/conftest/conftest.c @@ -322,6 +322,7 @@ static bool load_hooks() */ static void cleanup() { + file_logger_t *logger; hook_t *hook; DESTROY_IF(conftest->test); @@ -344,6 +345,13 @@ static void cleanup() } conftest->config->destroy(conftest->config); } + while (conftest->loggers->remove_last(conftest->loggers, + (void**)&logger) == SUCCESS) + { + charon->bus->remove_logger(charon->bus, &logger->logger); + logger->destroy(logger); + } + conftest->loggers->destroy(conftest->loggers); free(conftest->suite_dir); free(conftest); libcharon_deinit(); @@ -394,7 +402,7 @@ static void load_loggers(file_logger_t *logger) logger = file_logger_create(file, NULL, FALSE); load_log_levels(logger, section); charon->bus->add_logger(charon->bus, &logger->logger); - charon->file_loggers->insert_last(charon->file_loggers, logger); + conftest->loggers->insert_last(conftest->loggers, logger); } } enumerator->destroy(enumerator); @@ -433,16 +441,16 @@ int main(int argc, char *argv[]) INIT(conftest, .creds = mem_cred_create(), + .config = config_create(), + .hooks = linked_list_create(), + .loggers = linked_list_create(), ); + lib->credmgr->add_set(lib->credmgr, &conftest->creds->set); logger = file_logger_create(stdout, NULL, FALSE); logger->set_level(logger, DBG_ANY, LEVEL_CTRL); charon->bus->add_logger(charon->bus, &logger->logger); - charon->file_loggers->insert_last(charon->file_loggers, logger); - - lib->credmgr->add_set(lib->credmgr, &conftest->creds->set); - conftest->hooks = linked_list_create(); - conftest->config = config_create(); + conftest->loggers->insert_last(conftest->loggers, logger); atexit(cleanup); diff --git a/src/conftest/conftest.h b/src/conftest/conftest.h index 2caf9b3ce..6bbdabd07 100644 --- a/src/conftest/conftest.h +++ b/src/conftest/conftest.h @@ -64,6 +64,11 @@ struct conftest_t { * Action handling */ actions_t *actions; + + /** + * Test specific loggers + */ + linked_list_t *loggers; }; /** |