Store loggers in conftest separately, not on charon
This commit is contained in:
parent
3c4d383443
commit
18a8893e8e
|
@ -322,6 +322,7 @@ static bool load_hooks()
|
||||||
*/
|
*/
|
||||||
static void cleanup()
|
static void cleanup()
|
||||||
{
|
{
|
||||||
|
file_logger_t *logger;
|
||||||
hook_t *hook;
|
hook_t *hook;
|
||||||
|
|
||||||
DESTROY_IF(conftest->test);
|
DESTROY_IF(conftest->test);
|
||||||
|
@ -344,6 +345,13 @@ static void cleanup()
|
||||||
}
|
}
|
||||||
conftest->config->destroy(conftest->config);
|
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->suite_dir);
|
||||||
free(conftest);
|
free(conftest);
|
||||||
libcharon_deinit();
|
libcharon_deinit();
|
||||||
|
@ -394,7 +402,7 @@ static void load_loggers(file_logger_t *logger)
|
||||||
logger = file_logger_create(file, NULL, FALSE);
|
logger = file_logger_create(file, NULL, FALSE);
|
||||||
load_log_levels(logger, section);
|
load_log_levels(logger, section);
|
||||||
charon->bus->add_logger(charon->bus, &logger->logger);
|
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);
|
enumerator->destroy(enumerator);
|
||||||
|
@ -433,16 +441,16 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
INIT(conftest,
|
INIT(conftest,
|
||||||
.creds = mem_cred_create(),
|
.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 = file_logger_create(stdout, NULL, FALSE);
|
||||||
logger->set_level(logger, DBG_ANY, LEVEL_CTRL);
|
logger->set_level(logger, DBG_ANY, LEVEL_CTRL);
|
||||||
charon->bus->add_logger(charon->bus, &logger->logger);
|
charon->bus->add_logger(charon->bus, &logger->logger);
|
||||||
charon->file_loggers->insert_last(charon->file_loggers, logger);
|
conftest->loggers->insert_last(conftest->loggers, logger);
|
||||||
|
|
||||||
lib->credmgr->add_set(lib->credmgr, &conftest->creds->set);
|
|
||||||
conftest->hooks = linked_list_create();
|
|
||||||
conftest->config = config_create();
|
|
||||||
|
|
||||||
atexit(cleanup);
|
atexit(cleanup);
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,11 @@ struct conftest_t {
|
||||||
* Action handling
|
* Action handling
|
||||||
*/
|
*/
|
||||||
actions_t *actions;
|
actions_t *actions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test specific loggers
|
||||||
|
*/
|
||||||
|
linked_list_t *loggers;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue