diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-11-21 12:39:15 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-11-21 12:39:30 +0000 |
commit | f75769f242817029e5d8bfa3d617d02aece1729a (patch) | |
tree | 69439a3a50adfe84c64b994fea3eb21ed561e04c | |
parent | 464e03890c20488ec6bff075ddf28772cd15f422 (diff) | |
download | rspamd-f75769f242817029e5d8bfa3d617d02aece1729a.tar.gz rspamd-f75769f242817029e5d8bfa3d617d02aece1729a.zip |
[Minor] Fix tests
-rw-r--r-- | lualib/lua_stat.lua | 2 | ||||
-rw-r--r-- | src/lua/lua_util.c | 5 | ||||
-rw-r--r-- | test/rspamd_test_suite.c | 5 |
3 files changed, 9 insertions, 3 deletions
diff --git a/lualib/lua_stat.lua b/lualib/lua_stat.lua index 21870b27d..2606a8d22 100644 --- a/lualib/lua_stat.lua +++ b/lualib/lua_stat.lua @@ -519,7 +519,7 @@ exports.redis_classifier_from_sqlite = redis_classifier_from_sqlite -- Reads statistics config and return preprocessed table local function process_stat_config(cfg) - local opts_section = cfg:get_all_opt('options') + local opts_section = cfg:get_all_opt('options') or {} -- Check if we have a dedicated section for statistics if opts_section.statistics then diff --git a/src/lua/lua_util.c b/src/lua/lua_util.c index b98feb1b2..0e61d6e84 100644 --- a/src/lua/lua_util.c +++ b/src/lua/lua_util.c @@ -743,6 +743,11 @@ lua_util_config_from_ucl (lua_State *L) lua_pushnil (L); } else { + + if (int_options & RSPAMD_CONFIG_INIT_LIBS) { + cfg->libs_ctx = rspamd_init_libs (); + } + rspamd_config_post_load (cfg, int_options); pcfg = lua_newuserdata (L, sizeof (struct rspamd_config *)); rspamd_lua_setclass (L, "rspamd{config}", -1); diff --git a/test/rspamd_test_suite.c b/test/rspamd_test_suite.c index 10a5d941b..6ca8d6465 100644 --- a/test/rspamd_test_suite.c +++ b/test/rspamd_test_suite.c @@ -1,6 +1,7 @@ #include "config.h" #include "rspamd.h" #include "libstat/stat_api.h" +#include "lua/lua_common.h" #include "tests.h" struct rspamd_main *rspamd_main = NULL; @@ -31,6 +32,7 @@ main (int argc, char **argv) memset (rspamd_main, 0, sizeof (struct rspamd_main)); rspamd_main->server_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL); cfg = rspamd_config_new (RSPAMD_CONFIG_INIT_DEFAULT); + cfg->libs_ctx = rspamd_init_libs (); rspamd_main->cfg = cfg; cfg->cfg_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL); cfg->log_type = RSPAMD_LOG_CONSOLE; @@ -51,8 +53,7 @@ main (int argc, char **argv) exit (1); } - cfg->libs_ctx = rspamd_init_libs (); - + rspamd_lua_set_path ((lua_State *)cfg->lua_state, NULL, NULL); base = event_init (); rspamd_stat_init (cfg, base); rspamd_url_init (NULL); |