diff options
Diffstat (limited to 'src/util/test_plugin.c')
-rw-r--r-- | src/util/test_plugin.c | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/src/util/test_plugin.c b/src/util/test_plugin.c index c0eb717d6..e739d17c9 100644 --- a/src/util/test_plugin.c +++ b/src/util/test_plugin.c | |||
@@ -26,15 +26,22 @@ | |||
26 | 26 | ||
27 | 27 | ||
28 | static void | 28 | static void |
29 | test_cb (void *cls, const char *libname, void *lib_ret) | 29 | test_cb (void *cls, |
30 | const char *libname, | ||
31 | void *lib_ret) | ||
30 | { | 32 | { |
31 | void *ret; | 33 | const char *test_cls = cls; |
34 | char *ret; | ||
32 | 35 | ||
33 | GNUNET_assert (0 == strcmp (cls, "test")); | 36 | GNUNET_assert (0 == strcmp (test_cls, |
34 | GNUNET_assert (0 == strcmp (lib_ret, "Hello")); | 37 | "test-closure")); |
35 | ret = GNUNET_PLUGIN_unload (libname, "out"); | 38 | GNUNET_assert (0 == strcmp (lib_ret, |
39 | "Hello")); | ||
40 | ret = GNUNET_PLUGIN_unload (libname, | ||
41 | "out"); | ||
36 | GNUNET_assert (NULL != ret); | 42 | GNUNET_assert (NULL != ret); |
37 | GNUNET_assert (0 == strcmp (ret, "World")); | 43 | GNUNET_assert (0 == strcmp (ret, |
44 | "World")); | ||
38 | free (ret); | 45 | free (ret); |
39 | } | 46 | } |
40 | 47 | ||
@@ -44,24 +51,35 @@ main (int argc, char *argv[]) | |||
44 | { | 51 | { |
45 | void *ret; | 52 | void *ret; |
46 | 53 | ||
47 | GNUNET_log_setup ("test-plugin", "WARNING", NULL); | 54 | GNUNET_log_setup ("test-plugin", |
48 | GNUNET_log_skip (1, GNUNET_NO); | 55 | "WARNING", |
49 | ret = GNUNET_PLUGIN_load ("libgnunet_plugin_missing", NULL); | 56 | NULL); |
57 | GNUNET_log_skip (1, | ||
58 | GNUNET_NO); | ||
59 | ret = GNUNET_PLUGIN_load ("libgnunet_plugin_missing", | ||
60 | NULL); | ||
50 | GNUNET_log_skip (0, GNUNET_NO); | 61 | GNUNET_log_skip (0, GNUNET_NO); |
51 | if (ret != NULL) | 62 | if (NULL != ret) |
52 | return 1; | 63 | return 1; |
53 | ret = GNUNET_PLUGIN_load ("libgnunet_plugin_test", "in"); | 64 | ret = GNUNET_PLUGIN_load ("libgnunet_plugin_utiltest", |
54 | if (ret == NULL) | 65 | "in"); |
66 | if (NULL == ret) | ||
55 | return 1; | 67 | return 1; |
56 | if (0 != strcmp (ret, "Hello")) | 68 | if (0 != strcmp (ret, |
69 | "Hello")) | ||
57 | return 2; | 70 | return 2; |
58 | ret = GNUNET_PLUGIN_unload ("libgnunet_plugin_test", "out"); | 71 | ret = GNUNET_PLUGIN_unload ("libgnunet_plugin_utiltest", |
59 | if (ret == NULL) | 72 | "out"); |
73 | if (NULL == ret) | ||
60 | return 3; | 74 | return 3; |
61 | if (0 != strcmp (ret, "World")) | 75 | if (0 != strcmp (ret, |
76 | "World")) | ||
62 | return 4; | 77 | return 4; |
63 | free (ret); | 78 | free (ret); |
64 | GNUNET_PLUGIN_load_all ("libgnunet_plugin_tes", "in", &test_cb, "test"); | 79 | GNUNET_PLUGIN_load_all ("libgnunet_plugin_utiltes", |
80 | "in", | ||
81 | &test_cb, | ||
82 | "test-closure"); | ||
65 | return 0; | 83 | return 0; |
66 | } | 84 | } |
67 | 85 | ||