You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rspamd_test_suite.c 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #include "config.h"
  2. #include "rspamd.h"
  3. #include "libstat/stat_api.h"
  4. #include "tests.h"
  5. struct rspamd_main *rspamd_main = NULL;
  6. struct event_base *base = NULL;
  7. worker_t *workers[] = { NULL };
  8. int
  9. main (int argc, char **argv)
  10. {
  11. struct rspamd_config *cfg;
  12. rspamd_main = (struct rspamd_main *)g_malloc (sizeof (struct rspamd_main));
  13. memset (rspamd_main, 0, sizeof (struct rspamd_main));
  14. rspamd_main->server_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL);
  15. cfg = rspamd_config_new ();
  16. rspamd_main->cfg = cfg;
  17. cfg->cfg_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL);
  18. cfg->log_type = RSPAMD_LOG_CONSOLE;
  19. cfg->log_level = G_LOG_LEVEL_INFO;
  20. rspamd_set_logger (cfg, g_quark_from_static_string("rspamd-test"), rspamd_main);
  21. (void)rspamd_log_open (rspamd_main->logger);
  22. g_test_init (&argc, &argv, NULL);
  23. cfg->libs_ctx = rspamd_init_libs ();
  24. base = event_init ();
  25. rspamd_stat_init (cfg, base);
  26. if (g_test_verbose ()) {
  27. cfg->log_level = G_LOG_LEVEL_DEBUG;
  28. rspamd_set_logger (cfg, g_quark_from_static_string("rspamd-test"), rspamd_main);
  29. (void)rspamd_log_reopen (rspamd_main->logger);
  30. }
  31. g_log_set_default_handler (rspamd_glib_log_function, rspamd_main->logger);
  32. g_test_add_func ("/rspamd/mem_pool", rspamd_mem_pool_test_func);
  33. g_test_add_func ("/rspamd/url", rspamd_url_test_func);
  34. g_test_add_func ("/rspamd/statfile", rspamd_statfile_test_func);
  35. g_test_add_func ("/rspamd/radix", rspamd_radix_test_func);
  36. g_test_add_func ("/rspamd/dns", rspamd_dns_test_func);
  37. g_test_add_func ("/rspamd/aio", rspamd_async_test_func);
  38. g_test_add_func ("/rspamd/dkim", rspamd_dkim_test_func);
  39. g_test_add_func ("/rspamd/rrd", rspamd_rrd_test_func);
  40. g_test_add_func ("/rspamd/upstream", rspamd_upstream_test_func);
  41. g_test_add_func ("/rspamd/shingles", rspamd_shingles_test_func);
  42. g_test_add_func ("/rspamd/http", rspamd_http_test_func);
  43. g_test_add_func ("/rspamd/lua", rspamd_lua_test_func);
  44. g_test_add_func ("/rspamd/crypto", rspamd_cryptobox_test_func);
  45. g_test_add_func ("/rspamd/cryptobox", rspamd_cryptobox_test_func);
  46. g_test_run ();
  47. g_mime_shutdown ();
  48. rspamd_regexp_library_finalize ();
  49. return 0;
  50. }