summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-07-30 12:25:07 +0200
committerChristian Grothoff <christian@grothoff.org>2021-07-30 12:25:07 +0200
commite84ea6f9f1718298486a088832c87479bd6e9572 (patch)
tree1d1325c53a0731532a418f790ff033392fd68bdb /src
parent7f3311b8755f144fea8ab56fa21816e7f92c5820 (diff)
downloadgnunet-e84ea6f9f1718298486a088832c87479bd6e9572.tar.gz
gnunet-e84ea6f9f1718298486a088832c87479bd6e9572.zip
-rename plugin, otherwise plugin_test fails due to conflicting other plugin with the same prefix name
Diffstat (limited to 'src')
-rw-r--r--src/util/Makefile.am6
-rw-r--r--src/util/plugin.c6
-rw-r--r--src/util/test_plugin.c52
-rw-r--r--src/util/test_plugin_plug.c5
4 files changed, 46 insertions, 23 deletions
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index 37eb0508b..89d040a0c 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -242,11 +242,11 @@ gnunet_qr_LDADD = \
242gnunet_qr_LDFLAGS= -lzbar 242gnunet_qr_LDFLAGS= -lzbar
243 243
244plugin_LTLIBRARIES = \ 244plugin_LTLIBRARIES = \
245 libgnunet_plugin_test.la 245 libgnunet_plugin_utiltest.la
246 246
247libgnunet_plugin_test_la_SOURCES = \ 247libgnunet_plugin_utiltest_la_SOURCES = \
248 test_plugin_plug.c 248 test_plugin_plug.c
249libgnunet_plugin_test_la_LDFLAGS = \ 249libgnunet_plugin_utiltest_la_LDFLAGS = \
250 $(GN_PLUGIN_LDFLAGS) 250 $(GN_PLUGIN_LDFLAGS)
251 251
252if HAVE_BENCHMARKS 252if HAVE_BENCHMARKS
diff --git a/src/util/plugin.c b/src/util/plugin.c
index feb661f24..39874a588 100644
--- a/src/util/plugin.c
+++ b/src/util/plugin.c
@@ -447,8 +447,12 @@ GNUNET_PLUGIN_load_all_in_context (const struct GNUNET_OS_ProjectData *ctx,
447 void *cb_cls) 447 void *cb_cls)
448{ 448{
449 const struct GNUNET_OS_ProjectData *cpd = GNUNET_OS_project_data_get (); 449 const struct GNUNET_OS_ProjectData *cpd = GNUNET_OS_project_data_get ();
450
450 GNUNET_OS_init (ctx); 451 GNUNET_OS_init (ctx);
451 GNUNET_PLUGIN_load_all (basename, arg, cb, cb_cls); 452 GNUNET_PLUGIN_load_all (basename,
453 arg,
454 cb,
455 cb_cls);
452 GNUNET_OS_init (cpd); 456 GNUNET_OS_init (cpd);
453} 457}
454 458
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
28static void 28static void
29test_cb (void *cls, const char *libname, void *lib_ret) 29test_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
diff --git a/src/util/test_plugin_plug.c b/src/util/test_plugin_plug.c
index 39c8774b1..bfaad52e8 100644
--- a/src/util/test_plugin_plug.c
+++ b/src/util/test_plugin_plug.c
@@ -23,8 +23,9 @@
23 */ 23 */
24#include "platform.h" 24#include "platform.h"
25 25
26
26void * 27void *
27libgnunet_plugin_test_init (void *arg) 28libgnunet_plugin_utiltest_init (void *arg)
28{ 29{
29 if (0 == strcmp (arg, "in")) 30 if (0 == strcmp (arg, "in"))
30 return "Hello"; 31 return "Hello";
@@ -33,7 +34,7 @@ libgnunet_plugin_test_init (void *arg)
33 34
34 35
35void * 36void *
36libgnunet_plugin_test_done (void *arg) 37libgnunet_plugin_utiltest_done (void *arg)
37{ 38{
38 if (0 == strcmp (arg, "out")) 39 if (0 == strcmp (arg, "out"))
39 return strdup ("World"); 40 return strdup ("World");