aboutsummaryrefslogtreecommitdiff
path: root/src/datacache
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
parent8efaae301b29ec7cbdb921ac5e6b30ae2c143568 (diff)
downloadgnunet-dadbf4c950bf4cd459c95ac4ab61a02af7b3668b.tar.gz
gnunet-dadbf4c950bf4cd459c95ac4ab61a02af7b3668b.zip
-using new testing api to determine plugin name
Diffstat (limited to 'src/datacache')
-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
4 files changed, 17 insertions, 58 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}