diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-06-10 11:43:20 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-06-10 11:43:20 +0000 |
commit | dadbf4c950bf4cd459c95ac4ab61a02af7b3668b (patch) | |
tree | ddaf0644dcd97fbef7f67a68eff2a5cf204b0bb7 /src/datastore | |
parent | 8efaae301b29ec7cbdb921ac5e6b30ae2c143568 (diff) | |
download | gnunet-dadbf4c950bf4cd459c95ac4ab61a02af7b3668b.tar.gz gnunet-dadbf4c950bf4cd459c95ac4ab61a02af7b3668b.zip |
-using new testing api to determine plugin name
Diffstat (limited to 'src/datastore')
-rw-r--r-- | src/datastore/Makefile.am | 6 | ||||
-rw-r--r-- | src/datastore/perf_datastore_api.c | 10 | ||||
-rw-r--r-- | src/datastore/perf_plugin_datastore.c | 13 | ||||
-rw-r--r-- | src/datastore/test_datastore_api.c | 10 | ||||
-rw-r--r-- | src/datastore/test_datastore_api_management.c | 10 | ||||
-rw-r--r-- | src/datastore/test_plugin_datastore.c | 16 |
6 files changed, 14 insertions, 51 deletions
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 = \ | |||
162 | perf_plugin_datastore_sqlite_SOURCES = \ | 162 | perf_plugin_datastore_sqlite_SOURCES = \ |
163 | perf_plugin_datastore.c | 163 | perf_plugin_datastore.c |
164 | perf_plugin_datastore_sqlite_LDADD = \ | 164 | perf_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 | ||
167 | test_plugin_datastore_sqlite_SOURCES = \ | 168 | test_plugin_datastore_sqlite_SOURCES = \ |
168 | test_plugin_datastore.c | 169 | test_plugin_datastore.c |
169 | test_plugin_datastore_sqlite_LDADD = \ | 170 | test_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 = \ | |||
194 | test_plugin_datastore_mysql_SOURCES = \ | 196 | test_plugin_datastore_mysql_SOURCES = \ |
195 | test_plugin_datastore.c | 197 | test_plugin_datastore.c |
196 | test_plugin_datastore_mysql_LDADD = \ | 198 | test_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 | ||
199 | perf_plugin_datastore_mysql_SOURCES = \ | 202 | perf_plugin_datastore_mysql_SOURCES = \ |
200 | perf_plugin_datastore.c | 203 | perf_plugin_datastore.c |
201 | perf_plugin_datastore_mysql_LDADD = \ | 204 | perf_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 = \ | |||
226 | test_plugin_datastore_postgres_SOURCES = \ | 230 | test_plugin_datastore_postgres_SOURCES = \ |
227 | test_plugin_datastore.c | 231 | test_plugin_datastore.c |
228 | test_plugin_datastore_postgres_LDADD = \ | 232 | test_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 | ||
231 | perf_plugin_datastore_postgres_SOURCES = \ | 236 | perf_plugin_datastore_postgres_SOURCES = \ |
232 | perf_plugin_datastore.c | 237 | perf_plugin_datastore.c |
233 | perf_plugin_datastore_postgres_LDADD = \ | 238 | perf_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, | |||
322 | int | 322 | int |
323 | main (int argc, char *argv[]) | 323 | main (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, | |||
453 | int | 454 | int |
454 | main (int argc, char *argv[]) | 455 | main (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, | |||
491 | int | 491 | int |
492 | main (int argc, char *argv[]) | 492 | main (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, | |||
286 | int | 286 | int |
287 | main (int argc, char *argv[]) | 287 | main (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 | |||
353 | int | 353 | int |
354 | main (int argc, char *argv[]) | 354 | main (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 | } |