aboutsummaryrefslogtreecommitdiffstats
path: root/test/rspamd_test_suite.c
diff options
context:
space:
mode:
authorMikhail Galanin <mgalanin@mimecast.com>2018-09-19 15:42:38 +0100
committerMikhail Galanin <mgalanin@mimecast.com>2018-09-19 15:42:38 +0100
commit57d19346b6ff61c360ce5d1653d1e25118277c88 (patch)
tree8cc845db0d615031b3dbe1831fc28419287aa236 /test/rspamd_test_suite.c
parent50d51fca34585b51c1e6ecd168bda6e9e48b0bb2 (diff)
downloadrspamd-57d19346b6ff61c360ce5d1653d1e25118277c88.tar.gz
rspamd-57d19346b6ff61c360ce5d1653d1e25118277c88.zip
[Test] Added key to run specifig lua-test
example: $ ./test/rspamd-test -p /rspamd/lua -t selectors.lua no way to run two test suites atm
Diffstat (limited to 'test/rspamd_test_suite.c')
-rw-r--r--test/rspamd_test_suite.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/rspamd_test_suite.c b/test/rspamd_test_suite.c
index 07b728ecf..0be3091d9 100644
--- a/test/rspamd_test_suite.c
+++ b/test/rspamd_test_suite.c
@@ -7,10 +7,22 @@ struct rspamd_main *rspamd_main = NULL;
struct event_base *base = NULL;
worker_t *workers[] = { NULL };
+gchar *lua_test = 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 },
+ { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
+};
+
int
main (int argc, char **argv)
{
struct rspamd_config *cfg;
+ GOptionContext *context;
+ GError *error = NULL;
rspamd_main = (struct rspamd_main *)g_malloc (sizeof (struct rspamd_main));
memset (rspamd_main, 0, sizeof (struct rspamd_main));
@@ -27,6 +39,15 @@ main (int argc, char **argv)
g_test_init (&argc, &argv, NULL);
+ context = g_option_context_new ("- run rspamd test");
+ g_option_context_add_main_entries (context, entries, NULL);
+
+ if (!g_option_context_parse (context, &argc, &argv, &error)) {
+ fprintf (stderr, "option parsing failed: %s\n", error->message);
+ g_option_context_free (context);
+ exit (1);
+ }
+
cfg->libs_ctx = rspamd_init_libs ();
base = event_init ();