]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Test] Properly set lua paths for tests
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 28 Apr 2016 08:24:36 +0000 (09:24 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 28 Apr 2016 08:26:36 +0000 (09:26 +0100)
src/lua/lua_common.c
test/rspamd_lua_test.c

index 9036955a5b38b65c4cef0f06bfad7004d752ec89..fc65a67df853bf1db05501ecd45d380a928e4d50 100644 (file)
@@ -173,11 +173,13 @@ rspamd_lua_set_path (lua_State *L, struct rspamd_config *cfg)
                return;
        }
 
-       opts = ucl_object_lookup (cfg->rcl_obj, "options");
-       if (opts != NULL) {
-               opts = ucl_object_lookup (opts, "lua_path");
-               if (opts != NULL && ucl_object_type (opts) == UCL_STRING) {
-                       additional_path = ucl_object_tostring (opts);
+       if (cfg) {
+               opts = ucl_object_lookup (cfg->rcl_obj, "options");
+               if (opts != NULL) {
+                       opts = ucl_object_lookup (opts, "lua_path");
+                       if (opts != NULL && ucl_object_type (opts) == UCL_STRING) {
+                               additional_path = ucl_object_tostring (opts);
+                       }
                }
        }
 
index 12d56e5f00c8a7707c4d4bd2abd26e863bda3bc9..baad40ed7389d330fc7e2e2a223fa1753d43ba2a 100644 (file)
@@ -106,6 +106,7 @@ rspamd_lua_test_func (void)
        }
 
        lua_setglobal (L, "tests_list");
+       rspamd_lua_set_path (L, NULL);
 
        lua_pushcfunction (L, traceback);
        luaL_loadfile (L, rp);