diff options
Diffstat (limited to 'src/datastore/test_datastore_api.c')
-rw-r--r-- | src/datastore/test_datastore_api.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c index 3093f7545..af2f15da8 100644 --- a/src/datastore/test_datastore_api.c +++ b/src/datastore/test_datastore_api.c | |||
@@ -46,6 +46,10 @@ static struct GNUNET_TIME_Absolute now; | |||
46 | 46 | ||
47 | static int ok; | 47 | static int ok; |
48 | 48 | ||
49 | /** | ||
50 | * Name of plugin under test. | ||
51 | */ | ||
52 | static const char *plugin_name; | ||
49 | 53 | ||
50 | static size_t | 54 | static size_t |
51 | get_size (int i) | 55 | get_size (int i) |
@@ -593,6 +597,7 @@ run (void *cls, | |||
593 | static int | 597 | static int |
594 | check () | 598 | check () |
595 | { | 599 | { |
600 | char cfg_name[128]; | ||
596 | pid_t pid; | 601 | pid_t pid; |
597 | char *const argv[] = { "test-datastore-api", | 602 | char *const argv[] = { "test-datastore-api", |
598 | "-c", | 603 | "-c", |
@@ -605,12 +610,16 @@ check () | |||
605 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 610 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
606 | GNUNET_GETOPT_OPTION_END | 611 | GNUNET_GETOPT_OPTION_END |
607 | }; | 612 | }; |
613 | GNUNET_snprintf (cfg_name, | ||
614 | sizeof (cfg_name), | ||
615 | "test_datastore_api_data_%s.conf", | ||
616 | plugin_name); | ||
608 | pid = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 617 | pid = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", |
609 | "gnunet-service-arm", | 618 | "gnunet-service-arm", |
610 | #if VERBOSE | 619 | #if VERBOSE |
611 | "-L", "DEBUG", | 620 | "-L", "DEBUG", |
612 | #endif | 621 | #endif |
613 | "-c", "test_datastore_api_data.conf", NULL); | 622 | "-c", cfg_name, NULL); |
614 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, | 623 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, |
615 | argv, "test-datastore-api", "nohelp", | 624 | argv, "test-datastore-api", "nohelp", |
616 | options, &run, NULL); | 625 | options, &run, NULL); |
@@ -629,8 +638,19 @@ int | |||
629 | main (int argc, char *argv[]) | 638 | main (int argc, char *argv[]) |
630 | { | 639 | { |
631 | int ret; | 640 | int ret; |
632 | 641 | const char *pos; | |
633 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-datastore"); | 642 | char dir_name[128]; |
643 | |||
644 | /* determine name of plugin to use */ | ||
645 | plugin_name = argv[0]; | ||
646 | while (NULL != (pos = strstr(plugin_name, "_"))) | ||
647 | plugin_name = pos+1; | ||
648 | |||
649 | GNUNET_snprintf (dir_name, | ||
650 | sizeof (dir_name), | ||
651 | "/tmp/test-gnunet-datastore-%s", | ||
652 | plugin_name); | ||
653 | GNUNET_DISK_directory_remove (dir_name); | ||
634 | GNUNET_log_setup ("test-datastore-api", | 654 | GNUNET_log_setup ("test-datastore-api", |
635 | #if VERBOSE | 655 | #if VERBOSE |
636 | "DEBUG", | 656 | "DEBUG", |
@@ -639,11 +659,8 @@ main (int argc, char *argv[]) | |||
639 | #endif | 659 | #endif |
640 | NULL); | 660 | NULL); |
641 | ret = check (); | 661 | ret = check (); |
642 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-datastore"); | 662 | GNUNET_DISK_directory_remove (dir_name); |
643 | |||
644 | return ret; | 663 | return ret; |
645 | } | 664 | } |
646 | 665 | ||
647 | |||
648 | |||
649 | /* end of test_datastore_api.c */ | 666 | /* end of test_datastore_api.c */ |