commit cb070ee: [Minor] Fix unit tests
Vsevolod Stakhov
vsevolod at highsecure.ru
Mon Feb 10 21:28:16 UTC 2020
Author: Vsevolod Stakhov
Date: 2020-02-10 21:11:52 +0000
URL: https://github.com/rspamd/rspamd/commit/cb070eea5c1a2e39336171b37688202f334f7d70 (HEAD -> master)
[Minor] Fix unit tests
---
test/rspamd_test_suite.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/test/rspamd_test_suite.c b/test/rspamd_test_suite.c
index 48645ca93..4525f8ebc 100644
--- a/test/rspamd_test_suite.c
+++ b/test/rspamd_test_suite.c
@@ -37,12 +37,6 @@ main (int argc, char **argv)
cfg->libs_ctx = rspamd_init_libs ();
rspamd_main->cfg = cfg;
cfg->cfg_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL, 0);
- cfg->log_type = RSPAMD_LOG_CONSOLE;
- cfg->log_level = G_LOG_LEVEL_MESSAGE;
-
- rspamd_set_logger (cfg, g_quark_from_static_string("rspamd-test"),
- &rspamd_main->logger, rspamd_main->server_pool);
- (void)rspamd_log_open (rspamd_main->logger);
g_test_init (&argc, &argv, NULL);
@@ -57,18 +51,25 @@ main (int argc, char **argv)
exit (1);
}
+ /* Setup logger */
+ rspamd_main->logger = rspamd_log_open_emergency (rspamd_main->server_pool);
+
+ /* Setup logger */
+ if (verbose || g_test_verbose ()) {
+ rspamd_log_set_log_level (rspamd_main->logger, G_LOG_LEVEL_DEBUG);
+ rspamd_log_set_log_flags (rspamd_main->logger,
+ RSPAMD_LOG_FLAG_USEC|RSPAMD_LOG_FLAG_ENFORCED|RSPAMD_LOG_FLAG_RSPAMADM);
+ }
+ else {
+ rspamd_log_set_log_level (rspamd_main->logger, G_LOG_LEVEL_MESSAGE);
+ rspamd_log_set_log_flags (rspamd_main->logger,RSPAMD_LOG_FLAG_RSPAMADM);
+ }
+
rspamd_lua_set_path ((lua_State *)cfg->lua_state, NULL, NULL);
event_loop = ev_default_loop (EVFLAG_SIGNALFD|EVBACKEND_ALL);
rspamd_stat_init (cfg, event_loop);
rspamd_url_init (NULL);
- if (g_test_verbose ()) {
- cfg->log_level = G_LOG_LEVEL_DEBUG;
- rspamd_set_logger (cfg, g_quark_from_static_string("rspamd-test"),
- &rspamd_main->logger, rspamd_main->server_pool);
- (void)rspamd_log_reopen (rspamd_main->logger);
- }
-
g_log_set_default_handler (rspamd_glib_log_function, rspamd_main->logger);
g_test_add_func ("/rspamd/mem_pool", rspamd_mem_pool_test_func);
More information about the Commits
mailing list