aboutsummaryrefslogtreecommitdiff
path: root/src/main/test_plugin_load_multi.c
blob: 83e9120823b434f76c36fc9debf37b7afd08fc4a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
 * @file main/test_plugin_load_multi.c
 * @brief testcase for libextractor plugin loading that loads the same
 *    plugins multiple times!
 * @author Christian Grothoff
 */

#include "platform.h"
#include "extractor.h"

static int
testLoadPlugins ()
{
  struct EXTRACTOR_PluginList *el1;
  struct EXTRACTOR_PluginList *el2;

  el1 = EXTRACTOR_plugin_add_defaults (EXTRACTOR_OPTION_DEFAULT_POLICY);
  el2 = EXTRACTOR_plugin_add_defaults (EXTRACTOR_OPTION_DEFAULT_POLICY);
  if ((el1 == NULL) || (el2 == NULL))
    {
      fprintf (stderr,
	       "Failed to load default plugins!\n");
      return 1;
    }
  EXTRACTOR_plugin_remove_all (el1);
  EXTRACTOR_plugin_remove_all (el2);
  return 0;
}

int
main (int argc, char *argv[])
{
  int ret = 0;

  ret += testLoadPlugins ();
  ret += testLoadPlugins ();
  return ret;
}