aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-06-10 11:43:20 +0000
committerChristian Grothoff <christian@grothoff.org>2012-06-10 11:43:20 +0000
commitdadbf4c950bf4cd459c95ac4ab61a02af7b3668b (patch)
treeddaf0644dcd97fbef7f67a68eff2a5cf204b0bb7 /src
parent8efaae301b29ec7cbdb921ac5e6b30ae2c143568 (diff)
downloadgnunet-dadbf4c950bf4cd459c95ac4ab61a02af7b3668b.tar.gz
gnunet-dadbf4c950bf4cd459c95ac4ab61a02af7b3668b.zip
-using new testing api to determine plugin name
Diffstat (limited to 'src')
-rw-r--r--src/datacache/Makefile.am9
-rw-r--r--src/datacache/perf_datacache.c23
-rw-r--r--src/datacache/test_datacache.c17
-rw-r--r--src/datacache/test_datacache_quota.c26
-rw-r--r--src/datastore/Makefile.am6
-rw-r--r--src/datastore/perf_datastore_api.c10
-rw-r--r--src/datastore/perf_plugin_datastore.c13
-rw-r--r--src/datastore/test_datastore_api.c10
-rw-r--r--src/datastore/test_datastore_api_management.c10
-rw-r--r--src/datastore/test_plugin_datastore.c16
10 files changed, 31 insertions, 109 deletions
diff --git a/src/datacache/Makefile.am b/src/datacache/Makefile.am
index e1cd8fd79..0f10e6c1b 100644
--- a/src/datacache/Makefile.am
+++ b/src/datacache/Makefile.am
@@ -134,54 +134,63 @@ endif
134test_datacache_sqlite_SOURCES = \ 134test_datacache_sqlite_SOURCES = \
135 test_datacache.c 135 test_datacache.c
136test_datacache_sqlite_LDADD = \ 136test_datacache_sqlite_LDADD = \
137 $(top_builddir)/src/testing/libgnunettesting.la \
137 $(top_builddir)/src/datacache/libgnunetdatacache.la \ 138 $(top_builddir)/src/datacache/libgnunetdatacache.la \
138 $(top_builddir)/src/util/libgnunetutil.la 139 $(top_builddir)/src/util/libgnunetutil.la
139 140
140test_datacache_quota_sqlite_SOURCES = \ 141test_datacache_quota_sqlite_SOURCES = \
141 test_datacache_quota.c 142 test_datacache_quota.c
142test_datacache_quota_sqlite_LDADD = \ 143test_datacache_quota_sqlite_LDADD = \
144 $(top_builddir)/src/testing/libgnunettesting.la \
143 $(top_builddir)/src/datacache/libgnunetdatacache.la \ 145 $(top_builddir)/src/datacache/libgnunetdatacache.la \
144 $(top_builddir)/src/util/libgnunetutil.la 146 $(top_builddir)/src/util/libgnunetutil.la
145 147
146perf_datacache_sqlite_SOURCES = \ 148perf_datacache_sqlite_SOURCES = \
147 perf_datacache.c 149 perf_datacache.c
148perf_datacache_sqlite_LDADD = \ 150perf_datacache_sqlite_LDADD = \
151 $(top_builddir)/src/testing/libgnunettesting.la \
149 $(top_builddir)/src/datacache/libgnunetdatacache.la \ 152 $(top_builddir)/src/datacache/libgnunetdatacache.la \
150 $(top_builddir)/src/util/libgnunetutil.la 153 $(top_builddir)/src/util/libgnunetutil.la
151 154
152test_datacache_mysql_SOURCES = \ 155test_datacache_mysql_SOURCES = \
153 test_datacache.c 156 test_datacache.c
154test_datacache_mysql_LDADD = \ 157test_datacache_mysql_LDADD = \
158 $(top_builddir)/src/testing/libgnunettesting.la \
155 $(top_builddir)/src/datacache/libgnunetdatacache.la \ 159 $(top_builddir)/src/datacache/libgnunetdatacache.la \
156 $(top_builddir)/src/util/libgnunetutil.la 160 $(top_builddir)/src/util/libgnunetutil.la
157 161
158test_datacache_quota_mysql_SOURCES = \ 162test_datacache_quota_mysql_SOURCES = \
159 test_datacache_quota.c 163 test_datacache_quota.c
160test_datacache_quota_mysql_LDADD = \ 164test_datacache_quota_mysql_LDADD = \
165 $(top_builddir)/src/testing/libgnunettesting.la \
161 $(top_builddir)/src/datacache/libgnunetdatacache.la \ 166 $(top_builddir)/src/datacache/libgnunetdatacache.la \
162 $(top_builddir)/src/util/libgnunetutil.la 167 $(top_builddir)/src/util/libgnunetutil.la
163 168
164perf_datacache_mysql_SOURCES = \ 169perf_datacache_mysql_SOURCES = \
165 perf_datacache.c 170 perf_datacache.c
166perf_datacache_mysql_LDADD = \ 171perf_datacache_mysql_LDADD = \
172 $(top_builddir)/src/testing/libgnunettesting.la \
167 $(top_builddir)/src/datacache/libgnunetdatacache.la \ 173 $(top_builddir)/src/datacache/libgnunetdatacache.la \
168 $(top_builddir)/src/util/libgnunetutil.la 174 $(top_builddir)/src/util/libgnunetutil.la
169 175
170test_datacache_postgres_SOURCES = \ 176test_datacache_postgres_SOURCES = \
171 test_datacache.c 177 test_datacache.c
172test_datacache_postgres_LDADD = \ 178test_datacache_postgres_LDADD = \
179 $(top_builddir)/src/testing/libgnunettesting.la \
173 $(top_builddir)/src/datacache/libgnunetdatacache.la \ 180 $(top_builddir)/src/datacache/libgnunetdatacache.la \
174 $(top_builddir)/src/util/libgnunetutil.la 181 $(top_builddir)/src/util/libgnunetutil.la
175 182
176test_datacache_quota_postgres_SOURCES = \ 183test_datacache_quota_postgres_SOURCES = \
177 test_datacache_quota.c 184 test_datacache_quota.c
178test_datacache_quota_postgres_LDADD = \ 185test_datacache_quota_postgres_LDADD = \
186 $(top_builddir)/src/testing/libgnunettesting.la \
179 $(top_builddir)/src/datacache/libgnunetdatacache.la \ 187 $(top_builddir)/src/datacache/libgnunetdatacache.la \
180 $(top_builddir)/src/util/libgnunetutil.la 188 $(top_builddir)/src/util/libgnunetutil.la
181 189
182perf_datacache_postgres_SOURCES = \ 190perf_datacache_postgres_SOURCES = \
183 perf_datacache.c 191 perf_datacache.c
184perf_datacache_postgres_LDADD = \ 192perf_datacache_postgres_LDADD = \
193 $(top_builddir)/src/testing/libgnunettesting.la \
185 $(top_builddir)/src/datacache/libgnunetdatacache.la \ 194 $(top_builddir)/src/datacache/libgnunetdatacache.la \
186 $(top_builddir)/src/util/libgnunetutil.la 195 $(top_builddir)/src/util/libgnunetutil.la
187 196
diff --git a/src/datacache/perf_datacache.c b/src/datacache/perf_datacache.c
index 77edbf925..94cd7a58e 100644
--- a/src/datacache/perf_datacache.c
+++ b/src/datacache/perf_datacache.c
@@ -25,9 +25,9 @@
25#include "platform.h" 25#include "platform.h"
26#include "gnunet_util_lib.h" 26#include "gnunet_util_lib.h"
27#include "gnunet_datacache_lib.h" 27#include "gnunet_datacache_lib.h"
28#include "gnunet_testing_lib-new.h"
28#include <gauger.h> 29#include <gauger.h>
29 30
30#define VERBOSE GNUNET_NO
31 31
32#define ASSERT(x) do { if (! (x)) { printf("Error at %s:%d\n", __FILE__, __LINE__); goto FAILURE;} } while (0) 32#define ASSERT(x) do { if (! (x)) { printf("Error at %s:%d\n", __FILE__, __LINE__); goto FAILURE;} } while (0)
33 33
@@ -129,16 +129,11 @@ FAILURE:
129int 129int
130main (int argc, char *argv[]) 130main (int argc, char *argv[])
131{ 131{
132 char *pos;
133 char cfg_name[128]; 132 char cfg_name[128];
134
135 char *const xargv[] = { 133 char *const xargv[] = {
136 "perf-datacache", 134 "perf-datacache",
137 "-c", 135 "-c",
138 cfg_name, 136 cfg_name,
139#if VERBOSE
140 "-L", "DEBUG",
141#endif
142 NULL 137 NULL
143 }; 138 };
144 struct GNUNET_GETOPT_CommandLineOption options[] = { 139 struct GNUNET_GETOPT_CommandLineOption options[] = {
@@ -146,25 +141,11 @@ main (int argc, char *argv[])
146 }; 141 };
147 142
148 GNUNET_log_setup ("perf-datacache", 143 GNUNET_log_setup ("perf-datacache",
149#if VERBOSE
150 "DEBUG",
151#else
152 "WARNING", 144 "WARNING",
153#endif
154 NULL); 145 NULL);
155 /* determine name of plugin to use */ 146 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
156 plugin_name = argv[0];
157 while (NULL != (pos = strstr (plugin_name, "_")))
158 plugin_name = pos + 1;
159 if (NULL != (pos = strstr (plugin_name, ".")))
160 pos[0] = 0;
161 else
162 pos = (char *) plugin_name;
163
164 GNUNET_snprintf (cfg_name, sizeof (cfg_name), "perf_datacache_data_%s.conf", 147 GNUNET_snprintf (cfg_name, sizeof (cfg_name), "perf_datacache_data_%s.conf",
165 plugin_name); 148 plugin_name);
166 if (pos != plugin_name)
167 pos[0] = '.';
168 GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv, 149 GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv,
169 "perf-datacache", "nohelp", options, &run, NULL); 150 "perf-datacache", "nohelp", options, &run, NULL);
170 if (ok != 0) 151 if (ok != 0)
diff --git a/src/datacache/test_datacache.c b/src/datacache/test_datacache.c
index 97e2cda30..c818daaa8 100644
--- a/src/datacache/test_datacache.c
+++ b/src/datacache/test_datacache.c
@@ -25,6 +25,7 @@
25#include "platform.h" 25#include "platform.h"
26#include "gnunet_util_lib.h" 26#include "gnunet_util_lib.h"
27#include "gnunet_datacache_lib.h" 27#include "gnunet_datacache_lib.h"
28#include "gnunet_testing_lib-new.h"
28 29
29#define ASSERT(x) do { if (! (x)) { printf("Error at %s:%d\n", __FILE__, __LINE__); goto FAILURE;} } while (0) 30#define ASSERT(x) do { if (! (x)) { printf("Error at %s:%d\n", __FILE__, __LINE__); goto FAILURE;} } while (0)
30 31
@@ -114,9 +115,7 @@ FAILURE:
114int 115int
115main (int argc, char *argv[]) 116main (int argc, char *argv[])
116{ 117{
117 char *pos;
118 char cfg_name[128]; 118 char cfg_name[128];
119
120 char *const xargv[] = { 119 char *const xargv[] = {
121 "test-datacache", 120 "test-datacache",
122 "-c", 121 "-c",
@@ -130,22 +129,12 @@ main (int argc, char *argv[])
130 GNUNET_log_setup ("test-datacache", 129 GNUNET_log_setup ("test-datacache",
131 "WARNING", 130 "WARNING",
132 NULL); 131 NULL);
133 /* determine name of plugin to use */ 132 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
134 plugin_name = argv[0];
135 while (NULL != (pos = strstr (plugin_name, "_")))
136 plugin_name = pos + 1;
137 if (NULL != (pos = strstr (plugin_name, ".")))
138 pos[0] = 0;
139 else
140 pos = (char *) plugin_name;
141
142 GNUNET_snprintf (cfg_name, sizeof (cfg_name), "test_datacache_data_%s.conf", 133 GNUNET_snprintf (cfg_name, sizeof (cfg_name), "test_datacache_data_%s.conf",
143 plugin_name); 134 plugin_name);
144 if (pos != plugin_name)
145 pos[0] = '.';
146 GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv, 135 GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv,
147 "test-datacache", "nohelp", options, &run, NULL); 136 "test-datacache", "nohelp", options, &run, NULL);
148 if (ok != 0) 137 if (0 != ok)
149 FPRINTF (stderr, "Missed some testcases: %d\n", ok); 138 FPRINTF (stderr, "Missed some testcases: %d\n", ok);
150 return ok; 139 return ok;
151} 140}
diff --git a/src/datacache/test_datacache_quota.c b/src/datacache/test_datacache_quota.c
index cc47bdb8f..5325b398f 100644
--- a/src/datacache/test_datacache_quota.c
+++ b/src/datacache/test_datacache_quota.c
@@ -25,8 +25,7 @@
25#include "platform.h" 25#include "platform.h"
26#include "gnunet_util_lib.h" 26#include "gnunet_util_lib.h"
27#include "gnunet_datacache_lib.h" 27#include "gnunet_datacache_lib.h"
28 28#include "gnunet_testing_lib-new.h"
29#define VERBOSE GNUNET_NO
30 29
31#define ASSERT(x) do { if (! (x)) { printf("Error at %s:%d\n", __FILE__, __LINE__); goto FAILURE;} } while (0) 30#define ASSERT(x) do { if (! (x)) { printf("Error at %s:%d\n", __FILE__, __LINE__); goto FAILURE;} } while (0)
32 31
@@ -104,16 +103,11 @@ FAILURE:
104int 103int
105main (int argc, char *argv[]) 104main (int argc, char *argv[])
106{ 105{
107 char *pos;
108 char cfg_name[128]; 106 char cfg_name[128];
109
110 char *const xargv[] = { 107 char *const xargv[] = {
111 "test-datacache-quota", 108 "test-datacache-quota",
112 "-c", 109 "-c",
113 cfg_name, 110 cfg_name,
114#if VERBOSE
115 "-L", "DEBUG",
116#endif
117 NULL 111 NULL
118 }; 112 };
119 struct GNUNET_GETOPT_CommandLineOption options[] = { 113 struct GNUNET_GETOPT_CommandLineOption options[] = {
@@ -121,29 +115,15 @@ main (int argc, char *argv[])
121 }; 115 };
122 116
123 GNUNET_log_setup ("test-datacache-quota", 117 GNUNET_log_setup ("test-datacache-quota",
124#if VERBOSE
125 "DEBUG",
126#else
127 "WARNING", 118 "WARNING",
128#endif
129 NULL); 119 NULL);
130 120
131 /* determine name of plugin to use */ 121 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
132 plugin_name = argv[0];
133 while (NULL != (pos = strstr (plugin_name, "_")))
134 plugin_name = pos + 1;
135 if (NULL != (pos = strstr (plugin_name, ".")))
136 pos[0] = 0;
137 else
138 pos = (char *) plugin_name;
139
140 GNUNET_snprintf (cfg_name, sizeof (cfg_name), "test_datacache_data_%s.conf", 122 GNUNET_snprintf (cfg_name, sizeof (cfg_name), "test_datacache_data_%s.conf",
141 plugin_name); 123 plugin_name);
142 if (pos != plugin_name)
143 pos[0] = '.';
144 GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv, 124 GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv,
145 "test-datacache-quota", "nohelp", options, &run, NULL); 125 "test-datacache-quota", "nohelp", options, &run, NULL);
146 if (ok != 0) 126 if (0 != ok)
147 FPRINTF (stderr, "Missed some testcases: %d\n", ok); 127 FPRINTF (stderr, "Missed some testcases: %d\n", ok);
148 return ok; 128 return ok;
149} 129}
diff --git a/src/datastore/Makefile.am b/src/datastore/Makefile.am
index cd5b0d481..4000e9981 100644
--- a/src/datastore/Makefile.am
+++ b/src/datastore/Makefile.am
@@ -162,11 +162,13 @@ perf_datastore_api_sqlite_LDADD = \
162perf_plugin_datastore_sqlite_SOURCES = \ 162perf_plugin_datastore_sqlite_SOURCES = \
163 perf_plugin_datastore.c 163 perf_plugin_datastore.c
164perf_plugin_datastore_sqlite_LDADD = \ 164perf_plugin_datastore_sqlite_LDADD = \
165 $(top_builddir)/src/testing/libgnunettesting.la \
165 $(top_builddir)/src/util/libgnunetutil.la 166 $(top_builddir)/src/util/libgnunetutil.la
166 167
167test_plugin_datastore_sqlite_SOURCES = \ 168test_plugin_datastore_sqlite_SOURCES = \
168 test_plugin_datastore.c 169 test_plugin_datastore.c
169test_plugin_datastore_sqlite_LDADD = \ 170test_plugin_datastore_sqlite_LDADD = \
171 $(top_builddir)/src/testing/libgnunettesting.la \
170 $(top_builddir)/src/util/libgnunetutil.la 172 $(top_builddir)/src/util/libgnunetutil.la
171 173
172 174
@@ -194,11 +196,13 @@ perf_datastore_api_mysql_LDADD = \
194test_plugin_datastore_mysql_SOURCES = \ 196test_plugin_datastore_mysql_SOURCES = \
195 test_plugin_datastore.c 197 test_plugin_datastore.c
196test_plugin_datastore_mysql_LDADD = \ 198test_plugin_datastore_mysql_LDADD = \
199 $(top_builddir)/src/testing/libgnunettesting.la \
197 $(top_builddir)/src/util/libgnunetutil.la 200 $(top_builddir)/src/util/libgnunetutil.la
198 201
199perf_plugin_datastore_mysql_SOURCES = \ 202perf_plugin_datastore_mysql_SOURCES = \
200 perf_plugin_datastore.c 203 perf_plugin_datastore.c
201perf_plugin_datastore_mysql_LDADD = \ 204perf_plugin_datastore_mysql_LDADD = \
205 $(top_builddir)/src/testing/libgnunettesting.la \
202 $(top_builddir)/src/util/libgnunetutil.la 206 $(top_builddir)/src/util/libgnunetutil.la
203 207
204 208
@@ -226,11 +230,13 @@ perf_datastore_api_postgres_LDADD = \
226test_plugin_datastore_postgres_SOURCES = \ 230test_plugin_datastore_postgres_SOURCES = \
227 test_plugin_datastore.c 231 test_plugin_datastore.c
228test_plugin_datastore_postgres_LDADD = \ 232test_plugin_datastore_postgres_LDADD = \
233 $(top_builddir)/src/testing/libgnunettesting.la \
229 $(top_builddir)/src/util/libgnunetutil.la 234 $(top_builddir)/src/util/libgnunetutil.la
230 235
231perf_plugin_datastore_postgres_SOURCES = \ 236perf_plugin_datastore_postgres_SOURCES = \
232 perf_plugin_datastore.c 237 perf_plugin_datastore.c
233perf_plugin_datastore_postgres_LDADD = \ 238perf_plugin_datastore_postgres_LDADD = \
239 $(top_builddir)/src/testing/libgnunettesting.la \
234 $(top_builddir)/src/util/libgnunetutil.la 240 $(top_builddir)/src/util/libgnunetutil.la
235 241
236 242
diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c
index e236b6235..fa2ee52dc 100644
--- a/src/datastore/perf_datastore_api.c
+++ b/src/datastore/perf_datastore_api.c
@@ -322,17 +322,9 @@ run (void *cls,
322int 322int
323main (int argc, char *argv[]) 323main (int argc, char *argv[])
324{ 324{
325 char *pos;
326 char cfg_name[128]; 325 char cfg_name[128];
327 326
328 /* determine name of plugin to use */ 327 plugin_name = GNUNET_TESTING_get_testname_from_underscoare (argv[0]);
329 plugin_name = argv[0];
330 while (NULL != (pos = strstr (plugin_name, "_")))
331 plugin_name = pos + 1;
332 if (NULL != (pos = strstr (plugin_name, ".")))
333 pos[0] = '\0';
334 else
335 pos = (char *) plugin_name;
336 GNUNET_snprintf (cfg_name, sizeof (cfg_name), 328 GNUNET_snprintf (cfg_name, sizeof (cfg_name),
337 "test_datastore_api_data_%s.conf", plugin_name); 329 "test_datastore_api_data_%s.conf", plugin_name);
338 if (0 != 330 if (0 !=
diff --git a/src/datastore/perf_plugin_datastore.c b/src/datastore/perf_plugin_datastore.c
index daea8d796..763b38766 100644
--- a/src/datastore/perf_plugin_datastore.c
+++ b/src/datastore/perf_plugin_datastore.c
@@ -27,6 +27,7 @@
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_protocols.h" 28#include "gnunet_protocols.h"
29#include "gnunet_datastore_plugin.h" 29#include "gnunet_datastore_plugin.h"
30#include "gnunet_testing_lib-new.h"
30#include <gauger.h> 31#include <gauger.h>
31 32
32/** 33/**
@@ -453,7 +454,6 @@ run (void *cls, char *const *args, const char *cfgfile,
453int 454int
454main (int argc, char *argv[]) 455main (int argc, char *argv[])
455{ 456{
456 char *pos;
457 char dir_name[128]; 457 char dir_name[128];
458 char cfg_name[128]; 458 char cfg_name[128];
459 char *const argv[] = { 459 char *const argv[] = {
@@ -466,14 +466,7 @@ main (int argc, char *argv[])
466 GNUNET_GETOPT_OPTION_END 466 GNUNET_GETOPT_OPTION_END
467 }; 467 };
468 468
469 /* determine name of plugin to use */ 469 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
470 plugin_name = argv[0];
471 while (NULL != (pos = strstr (plugin_name, "_")))
472 plugin_name = pos + 1;
473 if (NULL != (pos = strstr (plugin_name, ".")))
474 pos[0] = 0;
475 else
476 pos = (char *) plugin_name;
477 GNUNET_snprintf (dir_name, sizeof (dir_name), "/tmp/perf-gnunet-datastore-%s", 470 GNUNET_snprintf (dir_name, sizeof (dir_name), "/tmp/perf-gnunet-datastore-%s",
478 plugin_name); 471 plugin_name);
479 GNUNET_DISK_directory_remove (dir_name); 472 GNUNET_DISK_directory_remove (dir_name);
@@ -487,8 +480,6 @@ main (int argc, char *argv[])
487 "perf-plugin-datastore", "nohelp", options, &run, NULL); 480 "perf-plugin-datastore", "nohelp", options, &run, NULL);
488 if (ok != 0) 481 if (ok != 0)
489 FPRINTF (stderr, "Missed some testcases: %u\n", ok); 482 FPRINTF (stderr, "Missed some testcases: %u\n", ok);
490 if (pos != plugin_name)
491 pos[0] = '.';
492 GNUNET_DISK_directory_remove (dir_name); 483 GNUNET_DISK_directory_remove (dir_name);
493 484
494 return ok; 485 return ok;
diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c
index cfeac86db..374067ca0 100644
--- a/src/datastore/test_datastore_api.c
+++ b/src/datastore/test_datastore_api.c
@@ -491,17 +491,9 @@ run (void *cls,
491int 491int
492main (int argc, char *argv[]) 492main (int argc, char *argv[])
493{ 493{
494 char *pos;
495 char cfg_name[128]; 494 char cfg_name[128];
496 495
497 /* determine name of plugin to use */ 496 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
498 plugin_name = argv[0];
499 while (NULL != (pos = strstr (plugin_name, "_")))
500 plugin_name = pos + 1;
501 if (NULL != (pos = strstr (plugin_name, ".")))
502 pos[0] = '\0';
503 else
504 pos = (char *) plugin_name;
505 GNUNET_snprintf (cfg_name, sizeof (cfg_name), 497 GNUNET_snprintf (cfg_name, sizeof (cfg_name),
506 "test_datastore_api_data_%s.conf", plugin_name); 498 "test_datastore_api_data_%s.conf", plugin_name);
507 if (0 != 499 if (0 !=
diff --git a/src/datastore/test_datastore_api_management.c b/src/datastore/test_datastore_api_management.c
index 9b5fb4e6f..bbb954304 100644
--- a/src/datastore/test_datastore_api_management.c
+++ b/src/datastore/test_datastore_api_management.c
@@ -286,17 +286,9 @@ run (void *cls,
286int 286int
287main (int argc, char *argv[]) 287main (int argc, char *argv[])
288{ 288{
289 char *pos;
290 char cfg_name[128]; 289 char cfg_name[128];
291 290
292 /* determine name of plugin to use */ 291 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
293 plugin_name = argv[0];
294 while (NULL != (pos = strstr (plugin_name, "_")))
295 plugin_name = pos + 1;
296 if (NULL != (pos = strstr (plugin_name, ".")))
297 pos[0] = 0;
298 else
299 pos = (char *) plugin_name;
300 GNUNET_snprintf (cfg_name, sizeof (cfg_name), 292 GNUNET_snprintf (cfg_name, sizeof (cfg_name),
301 "test_datastore_api_data_%s.conf", plugin_name); 293 "test_datastore_api_data_%s.conf", plugin_name);
302 if (0 != 294 if (0 !=
diff --git a/src/datastore/test_plugin_datastore.c b/src/datastore/test_plugin_datastore.c
index de9e7c2ab..a228e1004 100644
--- a/src/datastore/test_plugin_datastore.c
+++ b/src/datastore/test_plugin_datastore.c
@@ -27,6 +27,7 @@
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_protocols.h" 28#include "gnunet_protocols.h"
29#include "gnunet_datastore_plugin.h" 29#include "gnunet_datastore_plugin.h"
30#include "gnunet_testing_lib-new.h"
30 31
31/** 32/**
32 * Number of put operations to perform. 33 * Number of put operations to perform.
@@ -349,11 +350,9 @@ run (void *cls, char *const *args, const char *cfgfile,
349} 350}
350 351
351 352
352
353int 353int
354main (int argc, char *argv[]) 354main (int argc, char *argv[])
355{ 355{
356 char *pos;
357 char dir_name[128]; 356 char dir_name[128];
358 char cfg_name[128]; 357 char cfg_name[128];
359 char *const xargv[] = { 358 char *const xargv[] = {
@@ -367,14 +366,7 @@ main (int argc, char *argv[])
367 }; 366 };
368 367
369 /* determine name of plugin to use */ 368 /* determine name of plugin to use */
370 plugin_name = argv[0]; 369 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
371 while (NULL != (pos = strstr (plugin_name, "_")))
372 plugin_name = pos + 1;
373 if (NULL != (pos = strstr (plugin_name, ".")))
374 pos[0] = 0;
375 else
376 pos = (char *) plugin_name;
377
378 GNUNET_snprintf (dir_name, sizeof (dir_name), 370 GNUNET_snprintf (dir_name, sizeof (dir_name),
379 "/tmp/test-gnunet-datastore-plugin-%s", plugin_name); 371 "/tmp/test-gnunet-datastore-plugin-%s", plugin_name);
380 GNUNET_DISK_directory_remove (dir_name); 372 GNUNET_DISK_directory_remove (dir_name);
@@ -385,10 +377,8 @@ main (int argc, char *argv[])
385 "test_plugin_datastore_data_%s.conf", plugin_name); 377 "test_plugin_datastore_data_%s.conf", plugin_name);
386 GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv, 378 GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv,
387 "test-plugin-datastore", "nohelp", options, &run, NULL); 379 "test-plugin-datastore", "nohelp", options, &run, NULL);
388 if (ok != 0) 380 if (0 != ok)
389 FPRINTF (stderr, "Missed some testcases: %u\n", ok); 381 FPRINTF (stderr, "Missed some testcases: %u\n", ok);
390 if (pos != plugin_name)
391 pos[0] = '.';
392 GNUNET_DISK_directory_remove (dir_name); 382 GNUNET_DISK_directory_remove (dir_name);
393 return ok; 383 return ok;
394} 384}