aboutsummaryrefslogtreecommitdiff
path: root/src/datacache/test_datacache_quota.c
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/datacache/test_datacache_quota.c
parent8efaae301b29ec7cbdb921ac5e6b30ae2c143568 (diff)
downloadgnunet-dadbf4c950bf4cd459c95ac4ab61a02af7b3668b.tar.gz
gnunet-dadbf4c950bf4cd459c95ac4ab61a02af7b3668b.zip
-using new testing api to determine plugin name
Diffstat (limited to 'src/datacache/test_datacache_quota.c')
-rw-r--r--src/datacache/test_datacache_quota.c26
1 files changed, 3 insertions, 23 deletions
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}