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/test_plugin_datastore.c | |
parent | 8efaae301b29ec7cbdb921ac5e6b30ae2c143568 (diff) | |
download | gnunet-dadbf4c950bf4cd459c95ac4ab61a02af7b3668b.tar.gz gnunet-dadbf4c950bf4cd459c95ac4ab61a02af7b3668b.zip |
-using new testing api to determine plugin name
Diffstat (limited to 'src/datastore/test_plugin_datastore.c')
-rw-r--r-- | src/datastore/test_plugin_datastore.c | 16 |
1 files changed, 3 insertions, 13 deletions
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 | } |