for _,t in ipairs(tests_list) do
telescope.load_contexts(t, contexts)
end
+local function test_filter(test)
+ return test.name:match(test_pattern)
+end
+if not test_pattern then
+ test_filter = function(_) return true end
+end
local buffer = {}
-local results = telescope.run(contexts, callbacks, test_pattern)
+local results = telescope.run(contexts, callbacks, test_filter)
local summary, data = telescope.summary_report(contexts, results)
table.insert(buffer, telescope.test_report(contexts, results))
static const char *lua_src = BUILDROOT "/test/lua/tests.lua";
extern gchar *lua_test;
+extern gchar *lua_test_case;
extern struct rspamd_main *rspamd_main;
static int
rspamd_lua_set_globals (rspamd_main->cfg, L, NULL);
+ if (lua_test_case) {
+ lua_pushstring (L, lua_test_case);
+ lua_setglobal (L, "test_pattern");
+ }
+
rspamd_printf ("Starting lua tests\n");
if ((rp = realpath (lua_src, rp_buf)) == NULL) {
worker_t *workers[] = { NULL };
gchar *lua_test = NULL;
+gchar *lua_test_case = NULL;
gboolean verbose = FALSE;
static GOptionEntry entries[] =
{
{ "test", 't', 0, G_OPTION_ARG_STRING, &lua_test,
"Lua test to run (i.e. selectors.lua)", NULL },
+ { "test-case", 'c', 0, G_OPTION_ARG_STRING, &lua_test_case,
+ "Lua test to run, lua pattern i.e. \"case .* rcpts\"", NULL },
{ NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
};