aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-05-01 12:44:39 +0200
committerChristian Grothoff <christian@grothoff.org>2018-05-01 12:44:39 +0200
commita5e3e870f27c8ef3a3cd5d59a686a3050f9c64fb (patch)
tree6eec8a07a9a932d3c7b36f196ad01428e4f0ed63 /src
parent8f2f5bc2ee8ebf9b059b7b7e3104f25c5c363458 (diff)
downloadgnunet-a5e3e870f27c8ef3a3cd5d59a686a3050f9c64fb.tar.gz
gnunet-a5e3e870f27c8ef3a3cd5d59a686a3050f9c64fb.zip
more extensive namestore tests for the non-sqlite plugins, with bugfixes
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_namestore_plugin.h2
-rw-r--r--src/namestore/Makefile.am420
-rw-r--r--src/namestore/gnunet-service-namestore.c11
-rw-r--r--src/namestore/perf_namestore_api_flat.conf7
-rw-r--r--src/namestore/perf_namestore_api_postgres.conf7
-rw-r--r--src/namestore/perf_namestore_api_sqlite.conf4
-rw-r--r--src/namestore/perf_namestore_api_zone_iteration.c2
-rw-r--r--src/namestore/plugin_namestore_flat.c79
-rw-r--r--src/namestore/plugin_namestore_postgres.c41
-rw-r--r--src/namestore/plugin_namestore_sqlite.c11
-rw-r--r--src/namestore/test_namestore_api_flat.conf3
-rw-r--r--src/namestore/test_namestore_api_lookup_nick.c16
-rw-r--r--src/namestore/test_namestore_api_lookup_private.c14
-rw-r--r--src/namestore/test_namestore_api_lookup_public.c10
-rw-r--r--src/namestore/test_namestore_api_lookup_shadow.c16
-rw-r--r--src/namestore/test_namestore_api_lookup_shadow_filter.c12
-rw-r--r--src/namestore/test_namestore_api_monitoring.c10
-rw-r--r--src/namestore/test_namestore_api_monitoring_existing.c14
-rw-r--r--src/namestore/test_namestore_api_postgres.conf3
-rw-r--r--src/namestore/test_namestore_api_remove.c30
-rw-r--r--src/namestore/test_namestore_api_remove_not_existing_record.c12
-rw-r--r--src/namestore/test_namestore_api_sqlite.conf4
-rw-r--r--src/namestore/test_namestore_api_store.c10
-rw-r--r--src/namestore/test_namestore_api_store_update.c10
-rw-r--r--src/namestore/test_namestore_api_zone_iteration.c10
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_nick.c12
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_specific_zone.c12
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_stop.c10
-rw-r--r--src/namestore/test_namestore_api_zone_to_name.c17
29 files changed, 639 insertions, 170 deletions
diff --git a/src/include/gnunet_namestore_plugin.h b/src/include/gnunet_namestore_plugin.h
index c3ab4d8bf..e15068222 100644
--- a/src/include/gnunet_namestore_plugin.h
+++ b/src/include/gnunet_namestore_plugin.h
@@ -99,7 +99,7 @@ struct GNUNET_NAMESTORE_PluginFunctions
99 * @param label name of the record in the zone 99 * @param label name of the record in the zone
100 * @param iter function to call with the result 100 * @param iter function to call with the result
101 * @param iter_cls closure for @a iter 101 * @param iter_cls closure for @a iter
102 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 102 * @return #GNUNET_OK on success, #GNUNET_NO for no results, else #GNUNET_SYSERR
103 */ 103 */
104 int 104 int
105 (*lookup_records) (void *cls, 105 (*lookup_records) (void *cls,
diff --git a/src/namestore/Makefile.am b/src/namestore/Makefile.am
index b925261b7..b1faae862 100644
--- a/src/namestore/Makefile.am
+++ b/src/namestore/Makefile.am
@@ -23,6 +23,22 @@ endif
23FLAT_PLUGIN = libgnunet_plugin_namestore_flat.la 23FLAT_PLUGIN = libgnunet_plugin_namestore_flat.la
24if HAVE_TESTING 24if HAVE_TESTING
25FLAT_TESTS = test_plugin_namestore_flat \ 25FLAT_TESTS = test_plugin_namestore_flat \
26 test_namestore_api_store_flat \
27 test_namestore_api_store_update_flat \
28 test_namestore_api_remove_flat \
29 test_namestore_api_zone_iteration_flat \
30 test_namestore_api_lookup_nick_flat \
31 test_namestore_api_monitoring_flat \
32 test_namestore_api_lookup_public_flat \
33 test_namestore_api_lookup_private_flat \
34 test_namestore_api_lookup_shadow_flat \
35 test_namestore_api_lookup_shadow_filter_flat \
36 test_namestore_api_remove_not_existing_record_flat \
37 test_namestore_api_zone_iteration_nick_flat \
38 test_namestore_api_zone_iteration_specific_zone_flat \
39 test_namestore_api_zone_iteration_stop_flat \
40 test_namestore_api_monitoring_existing_flat \
41 test_namestore_api_zone_to_name_flat \
26 perf_namestore_api_zone_iteration_flat 42 perf_namestore_api_zone_iteration_flat
27endif 43endif
28 44
@@ -30,6 +46,22 @@ if HAVE_SQLITE
30SQLITE_PLUGIN = libgnunet_plugin_namestore_sqlite.la 46SQLITE_PLUGIN = libgnunet_plugin_namestore_sqlite.la
31if HAVE_TESTING 47if HAVE_TESTING
32SQLITE_TESTS = test_plugin_namestore_sqlite \ 48SQLITE_TESTS = test_plugin_namestore_sqlite \
49 test_namestore_api_store_sqlite \
50 test_namestore_api_store_update_sqlite \
51 test_namestore_api_zone_iteration_sqlite \
52 test_namestore_api_remove_sqlite \
53 test_namestore_api_lookup_nick_sqlite \
54 test_namestore_api_monitoring_sqlite \
55 test_namestore_api_lookup_public_sqlite \
56 test_namestore_api_lookup_private_sqlite \
57 test_namestore_api_lookup_shadow_sqlite \
58 test_namestore_api_lookup_shadow_filter_sqlite \
59 test_namestore_api_remove_not_existing_record_sqlite \
60 test_namestore_api_zone_iteration_nick_sqlite \
61 test_namestore_api_zone_iteration_specific_zone_sqlite \
62 test_namestore_api_zone_iteration_stop_sqlite \
63 test_namestore_api_monitoring_existing_sqlite \
64 test_namestore_api_zone_to_name_sqlite \
33 perf_namestore_api_zone_iteration_sqlite 65 perf_namestore_api_zone_iteration_sqlite
34endif 66endif
35endif 67endif
@@ -38,54 +70,31 @@ if HAVE_POSTGRESQL
38POSTGRES_PLUGIN = libgnunet_plugin_namestore_postgres.la 70POSTGRES_PLUGIN = libgnunet_plugin_namestore_postgres.la
39if HAVE_TESTING 71if HAVE_TESTING
40POSTGRES_TESTS = test_plugin_namestore_postgres \ 72POSTGRES_TESTS = test_plugin_namestore_postgres \
73 test_namestore_api_store_postgres \
74 test_namestore_api_store_update_postgres \
75 test_namestore_api_remove_postgres \
76 test_namestore_api_zone_iteration_postgres \
77 test_namestore_api_lookup_nick_postgres \
78 test_namestore_api_monitoring_postgres \
79 test_namestore_api_lookup_public_postgres \
80 test_namestore_api_lookup_private_postgres \
81 test_namestore_api_lookup_shadow_postgres \
82 test_namestore_api_lookup_shadow_filter_postgres \
83 test_namestore_api_remove_not_existing_record_postgres \
84 test_namestore_api_zone_iteration_nick_postgres \
85 test_namestore_api_zone_iteration_specific_zone_postgres \
86 test_namestore_api_zone_iteration_stop_postgres \
87 test_namestore_api_monitoring_existing_postgres \
88 test_namestore_api_zone_to_name_postgres \
41 perf_namestore_api_zone_iteration_postgres 89 perf_namestore_api_zone_iteration_postgres
42endif 90endif
43endif 91endif
44 92
45if HAVE_TESTING
46TESTING_TESTS = \
47 test_namestore_api_store.nc \
48 test_namestore_api_store_update.nc \
49 test_namestore_api_lookup_public.nc \
50 test_namestore_api_lookup_private.nc \
51 test_namestore_api_lookup_nick.nc \
52 test_namestore_api_lookup_shadow.nc \
53 test_namestore_api_lookup_shadow_filter.nc \
54 test_namestore_api_remove.nc \
55 test_namestore_api_remove_not_existing_record.nc \
56 test_namestore_api_zone_iteration.nc \
57 test_namestore_api_zone_iteration_nick.nc \
58 test_namestore_api_zone_iteration_specific_zone.nc \
59 test_namestore_api_zone_iteration_stop.nc \
60 test_namestore_api_monitoring.nc \
61 test_namestore_api_monitoring_existing.nc \
62 test_namestore_api_zone_to_name
63endif
64
65# Declare .nc (NO-CONCURRENCY) as a test extension so that we can impart
66# sequential execution order for them
67TEST_EXTENSIONS = .nc
68test_namestore_api_store.log: test_namestore_api_store_update.log
69test_namestore_api_store_update.log: test_namestore_api_lookup_public.log
70test_namestore_api_lookup_public.log: test_namestore_api_lookup_private.log
71test_namestore_api_lookup_private.log: test_namestore_api_lookup_nick.log
72test_namestore_api_lookup_nick.log: test_namestore_api_lookup_shadow.log
73test_namestore_api_lookup_shadow.log: test_namestore_api_lookup_shadow_filter.log
74test_namestore_api_lookup_shadow_filter.log: test_namestore_api_remove.log
75test_namestore_api_remove.log: test_namestore_api_remove_not_existing_record.log
76test_namestore_api_remove_not_existing_record.log: test_namestore_api_zone_iteration.log
77test_namestore_api_zone_iteration.log: test_namestore_api_zone_iteration_nick.log
78test_namestore_api_zone_iteration_nick.log: test_namestore_api_zone_iteration_specific_zone.log
79test_namestore_api_zone_iteration_specific_zone.log: test_namestore_api_zone_iteration_stop.log
80test_namestore_api_zone_iteration_stop.log: test_namestore_api_monitoring.log
81test_namestore_api_monitoring.log: test_namestore_api_monitoring_existing.log
82
83if HAVE_SQLITE 93if HAVE_SQLITE
84check_PROGRAMS = \ 94check_PROGRAMS = \
85 $(SQLITE_TESTS) \ 95 $(SQLITE_TESTS) \
86 $(POSTGRES_TESTS) \ 96 $(POSTGRES_TESTS) \
87 $(FLAT_TESTS) \ 97 $(FLAT_TESTS)
88 $(TESTING_TESTS)
89endif 98endif
90 99
91if HAVE_MHD 100if HAVE_MHD
@@ -230,110 +239,327 @@ libgnunet_plugin_rest_namestore_la_LDFLAGS = \
230 $(GN_PLUGIN_LDFLAGS) 239 $(GN_PLUGIN_LDFLAGS)
231 240
232 241
233test_namestore_api_store_nc_SOURCES = \ 242test_namestore_api_store_flat_SOURCES = \
243 test_namestore_api_store.c
244test_namestore_api_store_flat_LDADD = \
245 $(top_builddir)/src/testing/libgnunettesting.la \
246 $(top_builddir)/src/util/libgnunetutil.la \
247 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
248 libgnunetnamestore.la
249
250test_namestore_api_store_sqlite_SOURCES = \
251 test_namestore_api_store.c
252test_namestore_api_store_sqlite_LDADD = \
253 $(top_builddir)/src/testing/libgnunettesting.la \
254 $(top_builddir)/src/util/libgnunetutil.la \
255 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
256 libgnunetnamestore.la
257
258test_namestore_api_store_postgres_SOURCES = \
234 test_namestore_api_store.c 259 test_namestore_api_store.c
235test_namestore_api_store_nc_LDADD = \ 260test_namestore_api_store_postgres_LDADD = \
236 $(top_builddir)/src/testing/libgnunettesting.la \ 261 $(top_builddir)/src/testing/libgnunettesting.la \
237 $(top_builddir)/src/util/libgnunetutil.la \ 262 $(top_builddir)/src/util/libgnunetutil.la \
238 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 263 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
239 libgnunetnamestore.la 264 libgnunetnamestore.la
240 265
241test_namestore_api_store_update_nc_SOURCES = \ 266test_namestore_api_store_update_flat_SOURCES = \
242 test_namestore_api_store_update.c 267 test_namestore_api_store_update.c
243test_namestore_api_store_update_nc_LDADD = \ 268test_namestore_api_store_update_flat_LDADD = \
244 $(top_builddir)/src/testing/libgnunettesting.la \ 269 $(top_builddir)/src/testing/libgnunettesting.la \
245 $(top_builddir)/src/util/libgnunetutil.la \ 270 $(top_builddir)/src/util/libgnunetutil.la \
246 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 271 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
247 $(top_builddir)/src/namecache/libgnunetnamecache.la \ 272 $(top_builddir)/src/namecache/libgnunetnamecache.la \
248 libgnunetnamestore.la 273 libgnunetnamestore.la
249 274
250test_namestore_api_lookup_public_nc_SOURCES = \ 275test_namestore_api_store_update_sqlite_SOURCES = \
276 test_namestore_api_store_update.c
277test_namestore_api_store_update_sqlite_LDADD = \
278 $(top_builddir)/src/testing/libgnunettesting.la \
279 $(top_builddir)/src/util/libgnunetutil.la \
280 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
281 $(top_builddir)/src/namecache/libgnunetnamecache.la \
282 libgnunetnamestore.la
283
284test_namestore_api_store_update_postgres_SOURCES = \
285 test_namestore_api_store_update.c
286test_namestore_api_store_update_postgres_LDADD = \
287 $(top_builddir)/src/testing/libgnunettesting.la \
288 $(top_builddir)/src/util/libgnunetutil.la \
289 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
290 $(top_builddir)/src/namecache/libgnunetnamecache.la \
291 libgnunetnamestore.la
292
293test_namestore_api_lookup_public_flat_SOURCES = \
251 test_namestore_api_lookup_public.c 294 test_namestore_api_lookup_public.c
252test_namestore_api_lookup_public_nc_LDADD = \ 295test_namestore_api_lookup_public_flat_LDADD = \
296 $(top_builddir)/src/testing/libgnunettesting.la \
297 $(top_builddir)/src/util/libgnunetutil.la \
298 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
299 $(top_builddir)/src/namecache/libgnunetnamecache.la \
300 libgnunetnamestore.la
301
302test_namestore_api_lookup_public_sqlite_SOURCES = \
303 test_namestore_api_lookup_public.c
304test_namestore_api_lookup_public_sqlite_LDADD = \
305 $(top_builddir)/src/testing/libgnunettesting.la \
306 $(top_builddir)/src/util/libgnunetutil.la \
307 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
308 $(top_builddir)/src/namecache/libgnunetnamecache.la \
309 libgnunetnamestore.la
310
311test_namestore_api_lookup_public_postgres_SOURCES = \
312 test_namestore_api_lookup_public.c
313test_namestore_api_lookup_public_postgres_LDADD = \
314 $(top_builddir)/src/testing/libgnunettesting.la \
315 $(top_builddir)/src/util/libgnunetutil.la \
316 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
317 $(top_builddir)/src/namecache/libgnunetnamecache.la \
318 libgnunetnamestore.la
319
320test_namestore_api_lookup_nick_sqlite_SOURCES = \
321 test_namestore_api_lookup_nick.c
322test_namestore_api_lookup_nick_sqlite_LDADD = \
253 $(top_builddir)/src/testing/libgnunettesting.la \ 323 $(top_builddir)/src/testing/libgnunettesting.la \
254 $(top_builddir)/src/util/libgnunetutil.la \ 324 $(top_builddir)/src/util/libgnunetutil.la \
255 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 325 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
256 $(top_builddir)/src/namecache/libgnunetnamecache.la \ 326 $(top_builddir)/src/namecache/libgnunetnamecache.la \
257 libgnunetnamestore.la 327 libgnunetnamestore.la
258 328
259test_namestore_api_lookup_nick_nc_SOURCES = \ 329test_namestore_api_lookup_nick_postgres_SOURCES = \
260 test_namestore_api_lookup_nick.c 330 test_namestore_api_lookup_nick.c
261test_namestore_api_lookup_nick_nc_LDADD = \ 331test_namestore_api_lookup_nick_postgres_LDADD = \
262 $(top_builddir)/src/testing/libgnunettesting.la \ 332 $(top_builddir)/src/testing/libgnunettesting.la \
263 $(top_builddir)/src/util/libgnunetutil.la \ 333 $(top_builddir)/src/util/libgnunetutil.la \
264 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 334 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
265 $(top_builddir)/src/namecache/libgnunetnamecache.la \ 335 $(top_builddir)/src/namecache/libgnunetnamecache.la \
266 libgnunetnamestore.la 336 libgnunetnamestore.la
267 337
268test_namestore_api_lookup_private_nc_SOURCES = \ 338test_namestore_api_lookup_nick_flat_SOURCES = \
339 test_namestore_api_lookup_nick.c
340test_namestore_api_lookup_nick_flat_LDADD = \
341 $(top_builddir)/src/testing/libgnunettesting.la \
342 $(top_builddir)/src/util/libgnunetutil.la \
343 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
344 $(top_builddir)/src/namecache/libgnunetnamecache.la \
345 libgnunetnamestore.la
346
347test_namestore_api_lookup_private_flat_SOURCES = \
348 test_namestore_api_lookup_private.c
349test_namestore_api_lookup_private_flat_LDADD = \
350 $(top_builddir)/src/testing/libgnunettesting.la \
351 $(top_builddir)/src/util/libgnunetutil.la \
352 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
353 $(top_builddir)/src/namecache/libgnunetnamecache.la \
354 libgnunetnamestore.la
355
356test_namestore_api_lookup_private_sqlite_SOURCES = \
269 test_namestore_api_lookup_private.c 357 test_namestore_api_lookup_private.c
270test_namestore_api_lookup_private_nc_LDADD = \ 358test_namestore_api_lookup_private_sqlite_LDADD = \
271 $(top_builddir)/src/testing/libgnunettesting.la \ 359 $(top_builddir)/src/testing/libgnunettesting.la \
272 $(top_builddir)/src/util/libgnunetutil.la \ 360 $(top_builddir)/src/util/libgnunetutil.la \
273 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 361 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
274 $(top_builddir)/src/namecache/libgnunetnamecache.la \ 362 $(top_builddir)/src/namecache/libgnunetnamecache.la \
275 libgnunetnamestore.la 363 libgnunetnamestore.la
276 364
277test_namestore_api_lookup_shadow_nc_SOURCES = \ 365test_namestore_api_lookup_private_postgres_SOURCES = \
366 test_namestore_api_lookup_private.c
367test_namestore_api_lookup_private_postgres_LDADD = \
368 $(top_builddir)/src/testing/libgnunettesting.la \
369 $(top_builddir)/src/util/libgnunetutil.la \
370 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
371 $(top_builddir)/src/namecache/libgnunetnamecache.la \
372 libgnunetnamestore.la
373
374test_namestore_api_lookup_shadow_flat_SOURCES = \
278 test_namestore_api_lookup_shadow.c 375 test_namestore_api_lookup_shadow.c
279test_namestore_api_lookup_shadow_nc_LDADD = \ 376test_namestore_api_lookup_shadow_flat_LDADD = \
280 $(top_builddir)/src/testing/libgnunettesting.la \ 377 $(top_builddir)/src/testing/libgnunettesting.la \
281 $(top_builddir)/src/util/libgnunetutil.la \ 378 $(top_builddir)/src/util/libgnunetutil.la \
282 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 379 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
283 $(top_builddir)/src/namecache/libgnunetnamecache.la \ 380 $(top_builddir)/src/namecache/libgnunetnamecache.la \
284 libgnunetnamestore.la 381 libgnunetnamestore.la
285 382
286test_namestore_api_lookup_shadow_filter_nc_SOURCES = \ 383test_namestore_api_lookup_shadow_sqlite_SOURCES = \
384 test_namestore_api_lookup_shadow.c
385test_namestore_api_lookup_shadow_sqlite_LDADD = \
386 $(top_builddir)/src/testing/libgnunettesting.la \
387 $(top_builddir)/src/util/libgnunetutil.la \
388 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
389 $(top_builddir)/src/namecache/libgnunetnamecache.la \
390 libgnunetnamestore.la
391
392test_namestore_api_lookup_shadow_postgres_SOURCES = \
393 test_namestore_api_lookup_shadow.c
394test_namestore_api_lookup_shadow_postgres_LDADD = \
395 $(top_builddir)/src/testing/libgnunettesting.la \
396 $(top_builddir)/src/util/libgnunetutil.la \
397 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
398 $(top_builddir)/src/namecache/libgnunetnamecache.la \
399 libgnunetnamestore.la
400
401test_namestore_api_lookup_shadow_filter_flat_SOURCES = \
287 test_namestore_api_lookup_shadow_filter.c 402 test_namestore_api_lookup_shadow_filter.c
288test_namestore_api_lookup_shadow_filter_nc_LDADD = \ 403test_namestore_api_lookup_shadow_filter_flat_LDADD = \
289 $(top_builddir)/src/testing/libgnunettesting.la \ 404 $(top_builddir)/src/testing/libgnunettesting.la \
290 $(top_builddir)/src/util/libgnunetutil.la \ 405 $(top_builddir)/src/util/libgnunetutil.la \
291 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 406 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
292 $(top_builddir)/src/namecache/libgnunetnamecache.la \ 407 $(top_builddir)/src/namecache/libgnunetnamecache.la \
293 libgnunetnamestore.la 408 libgnunetnamestore.la
294 409
295test_namestore_api_remove_nc_SOURCES = \ 410test_namestore_api_lookup_shadow_filter_sqlite_SOURCES = \
411 test_namestore_api_lookup_shadow_filter.c
412test_namestore_api_lookup_shadow_filter_sqlite_LDADD = \
413 $(top_builddir)/src/testing/libgnunettesting.la \
414 $(top_builddir)/src/util/libgnunetutil.la \
415 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
416 $(top_builddir)/src/namecache/libgnunetnamecache.la \
417 libgnunetnamestore.la
418test_namestore_api_lookup_shadow_filter_postgres_SOURCES = \
419 test_namestore_api_lookup_shadow_filter.c
420test_namestore_api_lookup_shadow_filter_postgres_LDADD = \
421 $(top_builddir)/src/testing/libgnunettesting.la \
422 $(top_builddir)/src/util/libgnunetutil.la \
423 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
424 $(top_builddir)/src/namecache/libgnunetnamecache.la \
425 libgnunetnamestore.la
426
427test_namestore_api_remove_sqlite_SOURCES = \
428 test_namestore_api_remove.c
429test_namestore_api_remove_sqlite_LDADD = \
430 $(top_builddir)/src/testing/libgnunettesting.la \
431 $(top_builddir)/src/util/libgnunetutil.la \
432 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
433 libgnunetnamestore.la
434
435test_namestore_api_remove_postgres_SOURCES = \
296 test_namestore_api_remove.c 436 test_namestore_api_remove.c
297test_namestore_api_remove_nc_LDADD = \ 437test_namestore_api_remove_postgres_LDADD = \
438 $(top_builddir)/src/testing/libgnunettesting.la \
439 $(top_builddir)/src/util/libgnunetutil.la \
440 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
441 libgnunetnamestore.la
442
443test_namestore_api_remove_flat_SOURCES = \
444 test_namestore_api_remove.c
445test_namestore_api_remove_flat_LDADD = \
446 $(top_builddir)/src/testing/libgnunettesting.la \
447 $(top_builddir)/src/util/libgnunetutil.la \
448 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
449 libgnunetnamestore.la
450
451test_namestore_api_remove_not_existing_record_flat_SOURCES = \
452 test_namestore_api_remove_not_existing_record.c
453test_namestore_api_remove_not_existing_record_flat_LDADD = \
298 $(top_builddir)/src/testing/libgnunettesting.la \ 454 $(top_builddir)/src/testing/libgnunettesting.la \
299 $(top_builddir)/src/util/libgnunetutil.la \ 455 $(top_builddir)/src/util/libgnunetutil.la \
300 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 456 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
301 libgnunetnamestore.la 457 libgnunetnamestore.la
302 458
303test_namestore_api_remove_not_existing_record_nc_SOURCES = \ 459test_namestore_api_remove_not_existing_record_sqlite_SOURCES = \
304 test_namestore_api_remove_not_existing_record.c 460 test_namestore_api_remove_not_existing_record.c
305test_namestore_api_remove_not_existing_record_nc_LDADD = \ 461test_namestore_api_remove_not_existing_record_sqlite_LDADD = \
306 $(top_builddir)/src/testing/libgnunettesting.la \ 462 $(top_builddir)/src/testing/libgnunettesting.la \
307 $(top_builddir)/src/util/libgnunetutil.la \ 463 $(top_builddir)/src/util/libgnunetutil.la \
308 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 464 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
309 libgnunetnamestore.la 465 libgnunetnamestore.la
310 466
311test_namestore_api_zone_to_name_SOURCES = \ 467test_namestore_api_remove_not_existing_record_postgres_SOURCES = \
468 test_namestore_api_remove_not_existing_record.c
469test_namestore_api_remove_not_existing_record_postgres_LDADD = \
470 $(top_builddir)/src/testing/libgnunettesting.la \
471 $(top_builddir)/src/util/libgnunetutil.la \
472 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
473 libgnunetnamestore.la
474
475test_namestore_api_zone_to_name_flat_SOURCES = \
476 test_namestore_api_zone_to_name.c
477test_namestore_api_zone_to_name_flat_LDADD = \
478 $(top_builddir)/src/testing/libgnunettesting.la \
479 $(top_builddir)/src/util/libgnunetutil.la \
480 libgnunetnamestore.la
481
482test_namestore_api_zone_to_name_sqlite_SOURCES = \
312 test_namestore_api_zone_to_name.c 483 test_namestore_api_zone_to_name.c
313test_namestore_api_zone_to_name_LDADD = \ 484test_namestore_api_zone_to_name_sqlite_LDADD = \
314 $(top_builddir)/src/testing/libgnunettesting.la \ 485 $(top_builddir)/src/testing/libgnunettesting.la \
315 $(top_builddir)/src/util/libgnunetutil.la \ 486 $(top_builddir)/src/util/libgnunetutil.la \
316 libgnunetnamestore.la 487 libgnunetnamestore.la
317 488
318test_namestore_api_monitoring_nc_SOURCES = \ 489test_namestore_api_zone_to_name_postgres_SOURCES = \
490 test_namestore_api_zone_to_name.c
491test_namestore_api_zone_to_name_postgres_LDADD = \
492 $(top_builddir)/src/testing/libgnunettesting.la \
493 $(top_builddir)/src/util/libgnunetutil.la \
494 libgnunetnamestore.la
495
496test_namestore_api_monitoring_flat_SOURCES = \
319 test_namestore_api_monitoring.c 497 test_namestore_api_monitoring.c
320test_namestore_api_monitoring_nc_LDADD = \ 498test_namestore_api_monitoring_flat_LDADD = \
499 $(top_builddir)/src/testing/libgnunettesting.la \
500 libgnunetnamestore.la \
501 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
502 $(top_builddir)/src/util/libgnunetutil.la
503
504test_namestore_api_monitoring_sqlite_SOURCES = \
505 test_namestore_api_monitoring.c
506test_namestore_api_monitoring_sqlite_LDADD = \
507 $(top_builddir)/src/testing/libgnunettesting.la \
508 libgnunetnamestore.la \
509 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
510 $(top_builddir)/src/util/libgnunetutil.la
511
512test_namestore_api_monitoring_postgres_SOURCES = \
513 test_namestore_api_monitoring.c
514test_namestore_api_monitoring_postgres_LDADD = \
515 $(top_builddir)/src/testing/libgnunettesting.la \
516 libgnunetnamestore.la \
517 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
518 $(top_builddir)/src/util/libgnunetutil.la
519
520test_namestore_api_monitoring_existing_flat_SOURCES = \
521 test_namestore_api_monitoring_existing.c
522test_namestore_api_monitoring_existing_flat_LDADD = \
523 $(top_builddir)/src/testing/libgnunettesting.la \
524 libgnunetnamestore.la \
525 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
526 $(top_builddir)/src/util/libgnunetutil.la
527
528test_namestore_api_monitoring_existing_sqlite_SOURCES = \
529 test_namestore_api_monitoring_existing.c
530test_namestore_api_monitoring_existing_sqlite_LDADD = \
321 $(top_builddir)/src/testing/libgnunettesting.la \ 531 $(top_builddir)/src/testing/libgnunettesting.la \
322 libgnunetnamestore.la \ 532 libgnunetnamestore.la \
323 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 533 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
324 $(top_builddir)/src/util/libgnunetutil.la 534 $(top_builddir)/src/util/libgnunetutil.la
325 535
326test_namestore_api_monitoring_existing_nc_SOURCES = \ 536test_namestore_api_monitoring_existing_postgres_SOURCES = \
327 test_namestore_api_monitoring_existing.c 537 test_namestore_api_monitoring_existing.c
328test_namestore_api_monitoring_existing_nc_LDADD = \ 538test_namestore_api_monitoring_existing_postgres_LDADD = \
329 $(top_builddir)/src/testing/libgnunettesting.la \ 539 $(top_builddir)/src/testing/libgnunettesting.la \
330 libgnunetnamestore.la \ 540 libgnunetnamestore.la \
331 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 541 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
332 $(top_builddir)/src/util/libgnunetutil.la 542 $(top_builddir)/src/util/libgnunetutil.la
333 543
334test_namestore_api_zone_iteration_nc_SOURCES = \ 544test_namestore_api_zone_iteration_flat_SOURCES = \
545 test_namestore_api_zone_iteration.c
546test_namestore_api_zone_iteration_flat_LDADD = \
547 $(top_builddir)/src/testing/libgnunettesting.la \
548 $(top_builddir)/src/util/libgnunetutil.la \
549 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
550 libgnunetnamestore.la
551
552test_namestore_api_zone_iteration_sqlite_SOURCES = \
553 test_namestore_api_zone_iteration.c
554test_namestore_api_zone_iteration_sqlite_LDADD = \
555 $(top_builddir)/src/testing/libgnunettesting.la \
556 $(top_builddir)/src/util/libgnunetutil.la \
557 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
558 libgnunetnamestore.la
559
560test_namestore_api_zone_iteration_postgres_SOURCES = \
335 test_namestore_api_zone_iteration.c 561 test_namestore_api_zone_iteration.c
336test_namestore_api_zone_iteration_nc_LDADD = \ 562test_namestore_api_zone_iteration_postgres_LDADD = \
337 $(top_builddir)/src/testing/libgnunettesting.la \ 563 $(top_builddir)/src/testing/libgnunettesting.la \
338 $(top_builddir)/src/util/libgnunetutil.la \ 564 $(top_builddir)/src/util/libgnunetutil.la \
339 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 565 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
@@ -363,26 +589,73 @@ perf_namestore_api_zone_iteration_flat_LDADD = \
363 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 589 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
364 libgnunetnamestore.la 590 libgnunetnamestore.la
365 591
366test_namestore_api_zone_iteration_nick_nc_SOURCES = \ 592test_namestore_api_zone_iteration_nick_flat_SOURCES = \
367 test_namestore_api_zone_iteration_nick.c 593 test_namestore_api_zone_iteration_nick.c
368test_namestore_api_zone_iteration_nick_nc_LDADD = \ 594test_namestore_api_zone_iteration_nick_flat_LDADD = \
369 $(top_builddir)/src/testing/libgnunettesting.la \ 595 $(top_builddir)/src/testing/libgnunettesting.la \
370 $(top_builddir)/src/util/libgnunetutil.la \ 596 $(top_builddir)/src/util/libgnunetutil.la \
371 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 597 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
372 libgnunetnamestore.la 598 libgnunetnamestore.la
373 599
600test_namestore_api_zone_iteration_nick_sqlite_SOURCES = \
601 test_namestore_api_zone_iteration_nick.c
602test_namestore_api_zone_iteration_nick_sqlite_LDADD = \
603 $(top_builddir)/src/testing/libgnunettesting.la \
604 $(top_builddir)/src/util/libgnunetutil.la \
605 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
606 libgnunetnamestore.la
374 607
375test_namestore_api_zone_iteration_specific_zone_nc_SOURCES = \ 608test_namestore_api_zone_iteration_nick_postgres_SOURCES = \
609 test_namestore_api_zone_iteration_nick.c
610test_namestore_api_zone_iteration_nick_postgres_LDADD = \
611 $(top_builddir)/src/testing/libgnunettesting.la \
612 $(top_builddir)/src/util/libgnunetutil.la \
613 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
614 libgnunetnamestore.la
615
616test_namestore_api_zone_iteration_specific_zone_flat_SOURCES = \
617 test_namestore_api_zone_iteration_specific_zone.c
618test_namestore_api_zone_iteration_specific_zone_flat_LDADD = \
619 $(top_builddir)/src/testing/libgnunettesting.la \
620 $(top_builddir)/src/util/libgnunetutil.la \
621 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
622 libgnunetnamestore.la
623
624test_namestore_api_zone_iteration_specific_zone_sqlite_SOURCES = \
625 test_namestore_api_zone_iteration_specific_zone.c
626test_namestore_api_zone_iteration_specific_zone_sqlite_LDADD = \
627 $(top_builddir)/src/testing/libgnunettesting.la \
628 $(top_builddir)/src/util/libgnunetutil.la \
629 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
630 libgnunetnamestore.la
631
632test_namestore_api_zone_iteration_specific_zone_postgres_SOURCES = \
376 test_namestore_api_zone_iteration_specific_zone.c 633 test_namestore_api_zone_iteration_specific_zone.c
377test_namestore_api_zone_iteration_specific_zone_nc_LDADD = \ 634test_namestore_api_zone_iteration_specific_zone_postgres_LDADD = \
635 $(top_builddir)/src/testing/libgnunettesting.la \
636 $(top_builddir)/src/util/libgnunetutil.la \
637 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
638 libgnunetnamestore.la
639
640test_namestore_api_zone_iteration_stop_flat_SOURCES = \
641 test_namestore_api_zone_iteration_stop.c
642test_namestore_api_zone_iteration_stop_flat_LDADD = \
643 $(top_builddir)/src/testing/libgnunettesting.la \
644 $(top_builddir)/src/util/libgnunetutil.la \
645 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
646 libgnunetnamestore.la
647
648test_namestore_api_zone_iteration_stop_sqlite_SOURCES = \
649 test_namestore_api_zone_iteration_stop.c
650test_namestore_api_zone_iteration_stop_sqlite_LDADD = \
378 $(top_builddir)/src/testing/libgnunettesting.la \ 651 $(top_builddir)/src/testing/libgnunettesting.la \
379 $(top_builddir)/src/util/libgnunetutil.la \ 652 $(top_builddir)/src/util/libgnunetutil.la \
380 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 653 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
381 libgnunetnamestore.la 654 libgnunetnamestore.la
382 655
383test_namestore_api_zone_iteration_stop_nc_SOURCES = \ 656test_namestore_api_zone_iteration_stop_postgres_SOURCES = \
384 test_namestore_api_zone_iteration_stop.c 657 test_namestore_api_zone_iteration_stop.c
385test_namestore_api_zone_iteration_stop_nc_LDADD = \ 658test_namestore_api_zone_iteration_stop_postgres_LDADD = \
386 $(top_builddir)/src/testing/libgnunettesting.la \ 659 $(top_builddir)/src/testing/libgnunettesting.la \
387 $(top_builddir)/src/util/libgnunetutil.la \ 660 $(top_builddir)/src/util/libgnunetutil.la \
388 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 661 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
@@ -416,6 +689,9 @@ EXTRA_DIST = \
416 test_namestore_api_postgres.conf \ 689 test_namestore_api_postgres.conf \
417 test_namestore_api_sqlite.conf \ 690 test_namestore_api_sqlite.conf \
418 test_namestore_api_flat.conf \ 691 test_namestore_api_flat.conf \
692 perf_namestore_api_postgres.conf \
693 perf_namestore_api_sqlite.conf \
694 perf_namestore_api_flat.conf \
419 test_plugin_namestore_sqlite.conf \ 695 test_plugin_namestore_sqlite.conf \
420 test_plugin_namestore_postgres.conf \ 696 test_plugin_namestore_postgres.conf \
421 test_plugin_namestore_flat.conf \ 697 test_plugin_namestore_flat.conf \
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index 0456e5c15..2172ed0c7 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -1108,12 +1108,11 @@ handle_record_store (void *cls,
1108 conv_name); 1108 conv_name);
1109 if ( (0 == rd_count) && 1109 if ( (0 == rd_count) &&
1110 (GNUNET_NO == 1110 (GNUNET_NO ==
1111 GSN_database->iterate_records (GSN_database->cls, 1111 GSN_database->lookup_records (GSN_database->cls,
1112 &rp_msg->private_key, 1112 &rp_msg->private_key,
1113 0, 1113 conv_name,
1114 1, 1114 NULL,
1115 NULL, 1115 0)) )
1116 0)) )
1117 { 1116 {
1118 /* This name does not exist, so cannot be removed */ 1117 /* This name does not exist, so cannot be removed */
1119 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1118 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
diff --git a/src/namestore/perf_namestore_api_flat.conf b/src/namestore/perf_namestore_api_flat.conf
new file mode 100644
index 000000000..26e2f2c51
--- /dev/null
+++ b/src/namestore/perf_namestore_api_flat.conf
@@ -0,0 +1,7 @@
1@INLINE@ test_namestore_api.conf
2
3[namestore]
4DATABASE = flat
5
6[namecache]
7DISABLE = YES
diff --git a/src/namestore/perf_namestore_api_postgres.conf b/src/namestore/perf_namestore_api_postgres.conf
new file mode 100644
index 000000000..259ce35e7
--- /dev/null
+++ b/src/namestore/perf_namestore_api_postgres.conf
@@ -0,0 +1,7 @@
1@INLINE@ test_namestore_api.conf
2
3[namestore]
4DATABASE = postgres
5
6[namecache]
7DISABLE = YES
diff --git a/src/namestore/perf_namestore_api_sqlite.conf b/src/namestore/perf_namestore_api_sqlite.conf
new file mode 100644
index 000000000..72b609226
--- /dev/null
+++ b/src/namestore/perf_namestore_api_sqlite.conf
@@ -0,0 +1,4 @@
1@INLINE@ test_namestore_api.conf
2
3[namecache]
4DISABLE = YES
diff --git a/src/namestore/perf_namestore_api_zone_iteration.c b/src/namestore/perf_namestore_api_zone_iteration.c
index 220c3c495..4ef8d3407 100644
--- a/src/namestore/perf_namestore_api_zone_iteration.c
+++ b/src/namestore/perf_namestore_api_zone_iteration.c
@@ -364,7 +364,7 @@ main (int argc,
364 364
365 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]); 365 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
366 GNUNET_asprintf (&cfg_name, 366 GNUNET_asprintf (&cfg_name,
367 "test_namestore_api_%s.conf", 367 "perf_namestore_api_%s.conf",
368 plugin_name); 368 plugin_name);
369 res = 1; 369 res = 1;
370 if (0 != 370 if (0 !=
diff --git a/src/namestore/plugin_namestore_flat.c b/src/namestore/plugin_namestore_flat.c
index f40154915..88b3ce9b4 100644
--- a/src/namestore/plugin_namestore_flat.c
+++ b/src/namestore/plugin_namestore_flat.c
@@ -436,45 +436,51 @@ namestore_flat_store_records (void *cls,
436 UINT64_MAX); 436 UINT64_MAX);
437 key_len = strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey); 437 key_len = strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey);
438 key = GNUNET_malloc (key_len); 438 key = GNUNET_malloc (key_len);
439 GNUNET_memcpy (key, label, strlen (label)); 439 GNUNET_memcpy (key,
440 GNUNET_memcpy (key+strlen(label), 440 label,
441 zone_key, 441 strlen (label));
442 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)); 442 GNUNET_memcpy (key + strlen(label),
443 zone_key,
444 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
443 GNUNET_CRYPTO_hash (key, 445 GNUNET_CRYPTO_hash (key,
444 key_len, 446 key_len,
445 &hkey); 447 &hkey);
446 448 GNUNET_CONTAINER_multihashmap_remove_all (plugin->hm,
447 GNUNET_CONTAINER_multihashmap_remove_all (plugin->hm, &hkey); 449 &hkey);
448 450 if (0 == rd_count)
449 if (0 < rd_count)
450 { 451 {
451 entry = GNUNET_new (struct FlatFileEntry); 452 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
452 entry->private_key = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey); 453 "sqlite",
453 GNUNET_asprintf (&entry->label, 454 "Record deleted\n");
454 label, 455 return GNUNET_OK;
455 strlen (label));
456 GNUNET_memcpy (entry->private_key,
457 zone_key,
458 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
459 entry->rvalue = rvalue;
460 entry->record_count = rd_count;
461 entry->record_data = GNUNET_new_array (rd_count,
462 struct GNUNET_GNSRECORD_Data);
463 for (unsigned int i = 0; i < rd_count; i++)
464 {
465 entry->record_data[i].expiration_time = rd[i].expiration_time;
466 entry->record_data[i].record_type = rd[i].record_type;
467 entry->record_data[i].flags = rd[i].flags;
468 entry->record_data[i].data_size = rd[i].data_size;
469 entry->record_data[i].data = GNUNET_malloc (rd[i].data_size);
470 GNUNET_memcpy ((char*)entry->record_data[i].data, rd[i].data, rd[i].data_size);
471 }
472 return GNUNET_CONTAINER_multihashmap_put (plugin->hm,
473 &hkey,
474 entry,
475 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
476 } 456 }
477 return GNUNET_NO; 457 entry = GNUNET_new (struct FlatFileEntry);
458 entry->private_key = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey);
459 GNUNET_asprintf (&entry->label,
460 label,
461 strlen (label));
462 GNUNET_memcpy (entry->private_key,
463 zone_key,
464 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
465 entry->rvalue = rvalue;
466 entry->record_count = rd_count;
467 entry->record_data = GNUNET_new_array (rd_count,
468 struct GNUNET_GNSRECORD_Data);
469 for (unsigned int i = 0; i < rd_count; i++)
470 {
471 entry->record_data[i].expiration_time = rd[i].expiration_time;
472 entry->record_data[i].record_type = rd[i].record_type;
473 entry->record_data[i].flags = rd[i].flags;
474 entry->record_data[i].data_size = rd[i].data_size;
475 entry->record_data[i].data = GNUNET_malloc (rd[i].data_size);
476 GNUNET_memcpy ((char*)entry->record_data[i].data,
477 rd[i].data,
478 rd[i].data_size);
479 }
480 return GNUNET_CONTAINER_multihashmap_put (plugin->hm,
481 &hkey,
482 entry,
483 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
478} 484}
479 485
480 486
@@ -486,7 +492,7 @@ namestore_flat_store_records (void *cls,
486 * @param label name of the record in the zone 492 * @param label name of the record in the zone
487 * @param iter function to call with the result 493 * @param iter function to call with the result
488 * @param iter_cls closure for @a iter 494 * @param iter_cls closure for @a iter
489 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 495 * @return #GNUNET_OK on success, #GNUNET_NO for no results, else #GNUNET_SYSERR
490 */ 496 */
491static int 497static int
492namestore_flat_lookup_records (void *cls, 498namestore_flat_lookup_records (void *cls,
@@ -502,7 +508,10 @@ namestore_flat_lookup_records (void *cls,
502 size_t key_len; 508 size_t key_len;
503 509
504 if (NULL == zone) 510 if (NULL == zone)
511 {
512 GNUNET_break (0);
505 return GNUNET_SYSERR; 513 return GNUNET_SYSERR;
514 }
506 key_len = strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey); 515 key_len = strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey);
507 key = GNUNET_malloc (key_len); 516 key = GNUNET_malloc (key_len);
508 GNUNET_memcpy (key, 517 GNUNET_memcpy (key,
diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c
index 69e28b0d0..4e4ca1f43 100644
--- a/src/namestore/plugin_namestore_postgres.c
+++ b/src/namestore/plugin_namestore_postgres.c
@@ -212,7 +212,9 @@ namestore_postgres_store_records (void *cls,
212 uint32_t rd_count32 = (uint32_t) rd_count; 212 uint32_t rd_count32 = (uint32_t) rd_count;
213 size_t data_size; 213 size_t data_size;
214 214
215 memset (&pkey, 0, sizeof (pkey)); 215 memset (&pkey,
216 0,
217 sizeof (pkey));
216 for (unsigned int i=0;i<rd_count;i++) 218 for (unsigned int i=0;i<rd_count;i++)
217 if (GNUNET_GNSRECORD_TYPE_PKEY == rd[i].record_type) 219 if (GNUNET_GNSRECORD_TYPE_PKEY == rd[i].record_type)
218 { 220 {
@@ -231,6 +233,32 @@ namestore_postgres_store_records (void *cls,
231 GNUNET_break (0); 233 GNUNET_break (0);
232 return GNUNET_SYSERR; 234 return GNUNET_SYSERR;
233 } 235 }
236 /* first, delete existing records */
237 {
238 struct GNUNET_PQ_QueryParam params[] = {
239 GNUNET_PQ_query_param_auto_from_type (zone_key),
240 GNUNET_PQ_query_param_string (label),
241 GNUNET_PQ_query_param_end
242 };
243 enum GNUNET_DB_QueryStatus res;
244
245 res = GNUNET_PQ_eval_prepared_non_select (plugin->dbh,
246 "delete_records",
247 params);
248 if ( (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != res) &&
249 (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS != res) )
250 {
251 GNUNET_break (0);
252 return GNUNET_SYSERR;
253 }
254 }
255 if (0 == rd_count)
256 {
257 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
258 "postgres",
259 "Record deleted\n");
260 return GNUNET_OK;
261 }
234 { 262 {
235 char data[data_size]; 263 char data[data_size];
236 struct GNUNET_PQ_QueryParam params[] = { 264 struct GNUNET_PQ_QueryParam params[] = {
@@ -389,7 +417,7 @@ parse_result_call_iterator (void *cls,
389 * @param label name of the record in the zone 417 * @param label name of the record in the zone
390 * @param iter function to call with the result 418 * @param iter function to call with the result
391 * @param iter_cls closure for @a iter 419 * @param iter_cls closure for @a iter
392 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 420 * @return #GNUNET_OK on success, #GNUNET_NO for no results, else #GNUNET_SYSERR
393 */ 421 */
394static int 422static int
395namestore_postgres_lookup_records (void *cls, 423namestore_postgres_lookup_records (void *cls,
@@ -407,6 +435,11 @@ namestore_postgres_lookup_records (void *cls,
407 struct ParserContext pc; 435 struct ParserContext pc;
408 enum GNUNET_DB_QueryStatus res; 436 enum GNUNET_DB_QueryStatus res;
409 437
438 if (NULL == zone)
439 {
440 GNUNET_break (0);
441 return GNUNET_SYSERR;
442 }
410 pc.iter = iter; 443 pc.iter = iter;
411 pc.iter_cls = iter_cls; 444 pc.iter_cls = iter_cls;
412 pc.zone_key = zone; 445 pc.zone_key = zone;
@@ -415,8 +448,10 @@ namestore_postgres_lookup_records (void *cls,
415 params, 448 params,
416 &parse_result_call_iterator, 449 &parse_result_call_iterator,
417 &pc); 450 &pc);
418 if (res <= 0) 451 if (res < 0)
419 return GNUNET_SYSERR; 452 return GNUNET_SYSERR;
453 if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == res)
454 return GNUNET_NO;
420 return GNUNET_OK; 455 return GNUNET_OK;
421} 456}
422 457
diff --git a/src/namestore/plugin_namestore_sqlite.c b/src/namestore/plugin_namestore_sqlite.c
index b54b4dba2..f62be1e18 100644
--- a/src/namestore/plugin_namestore_sqlite.c
+++ b/src/namestore/plugin_namestore_sqlite.c
@@ -311,7 +311,7 @@ database_setup (struct Plugin *plugin)
311 sq_prepare (plugin->dbh, 311 sq_prepare (plugin->dbh,
312 "SELECT uid,record_count,record_data,label,zone_private_key" 312 "SELECT uid,record_count,record_data,label,zone_private_key"
313 " FROM ns098records" 313 " FROM ns098records"
314 " WHERE _rowid_ >= ?" 314 " WHERE _rowid_ >= ?"
315 " ORDER BY _rowid_ ASC" 315 " ORDER BY _rowid_ ASC"
316 " LIMIT ?", 316 " LIMIT ?",
317 &plugin->iterate_all_zones)) || 317 &plugin->iterate_all_zones)) ||
@@ -551,7 +551,7 @@ get_records_and_call_iterator (struct Plugin *plugin,
551 int sret; 551 int sret;
552 552
553 ret = GNUNET_OK; 553 ret = GNUNET_OK;
554 for (uint64_t i = 0;i<limit ; i++) 554 for (uint64_t i = 0;i<limit;i++)
555 { 555 {
556 sret = sqlite3_step (stmt); 556 sret = sqlite3_step (stmt);
557 557
@@ -570,7 +570,7 @@ get_records_and_call_iterator (struct Plugin *plugin,
570 ret = GNUNET_SYSERR; 570 ret = GNUNET_SYSERR;
571 break; 571 break;
572 } 572 }
573 573
574 { 574 {
575 uint64_t seq; 575 uint64_t seq;
576 uint32_t record_count; 576 uint32_t record_count;
@@ -658,7 +658,7 @@ get_records_and_call_iterator (struct Plugin *plugin,
658 * @param label name of the record in the zone 658 * @param label name of the record in the zone
659 * @param iter function to call with the result 659 * @param iter function to call with the result
660 * @param iter_cls closure for @a iter 660 * @param iter_cls closure for @a iter
661 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 661 * @return #GNUNET_OK on success, #GNUNET_NO for no results, else #GNUNET_SYSERR
662 */ 662 */
663static int 663static int
664namestore_sqlite_lookup_records (void *cls, 664namestore_sqlite_lookup_records (void *cls,
@@ -675,7 +675,10 @@ namestore_sqlite_lookup_records (void *cls,
675 }; 675 };
676 676
677 if (NULL == zone) 677 if (NULL == zone)
678 {
679 GNUNET_break (0);
678 return GNUNET_SYSERR; 680 return GNUNET_SYSERR;
681 }
679 if (GNUNET_OK != 682 if (GNUNET_OK !=
680 GNUNET_SQ_bind (plugin->lookup_label, 683 GNUNET_SQ_bind (plugin->lookup_label,
681 params)) 684 params))
diff --git a/src/namestore/test_namestore_api_flat.conf b/src/namestore/test_namestore_api_flat.conf
index 26e2f2c51..49fe25468 100644
--- a/src/namestore/test_namestore_api_flat.conf
+++ b/src/namestore/test_namestore_api_flat.conf
@@ -2,6 +2,3 @@
2 2
3[namestore] 3[namestore]
4DATABASE = flat 4DATABASE = flat
5
6[namecache]
7DISABLE = YES
diff --git a/src/namestore/test_namestore_api_lookup_nick.c b/src/namestore/test_namestore_api_lookup_nick.c
index de958cee2..50d1fd9a9 100644
--- a/src/namestore/test_namestore_api_lookup_nick.c
+++ b/src/namestore/test_namestore_api_lookup_nick.c
@@ -18,8 +18,8 @@
18 Boston, MA 02110-1301, USA. 18 Boston, MA 02110-1301, USA.
19*/ 19*/
20/** 20/**
21 * @file namestore/test_namestore_api_store.c 21 * @file namestore/test_namestore_api_lookup_nick.c
22 * @brief testcase for namestore_api.c: store a record 22 * @brief testcase for namestore_api.c: NICK records
23 */ 23 */
24#include "platform.h" 24#include "platform.h"
25#include "gnunet_namestore_service.h" 25#include "gnunet_namestore_service.h"
@@ -317,15 +317,23 @@ run (void *cls,
317int 317int
318main (int argc, char *argv[]) 318main (int argc, char *argv[])
319{ 319{
320 const char *plugin_name;
321 char *cfg_name;
322
323 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
324 GNUNET_asprintf (&cfg_name,
325 "test_namestore_api_%s.conf",
326 plugin_name);
320 res = 1; 327 res = 1;
321 if (0 != 328 if (0 !=
322 GNUNET_TESTING_peer_run ("test-namestore-api", 329 GNUNET_TESTING_peer_run ("test-namestore-api-lookup-nick",
323 "test_namestore_api.conf", 330 cfg_name,
324 &run, 331 &run,
325 NULL)) 332 NULL))
326 { 333 {
327 res = 1; 334 res = 1;
328 } 335 }
336 GNUNET_free (cfg_name);
329 if (NULL != directory) 337 if (NULL != directory)
330 { 338 {
331 GNUNET_DISK_directory_remove (directory); 339 GNUNET_DISK_directory_remove (directory);
diff --git a/src/namestore/test_namestore_api_lookup_private.c b/src/namestore/test_namestore_api_lookup_private.c
index 57505c48b..7866749f1 100644
--- a/src/namestore/test_namestore_api_lookup_private.c
+++ b/src/namestore/test_namestore_api_lookup_private.c
@@ -230,15 +230,23 @@ run (void *cls,
230int 230int
231main (int argc, char *argv[]) 231main (int argc, char *argv[])
232{ 232{
233 const char *plugin_name;
234 char *cfg_name;
235
236 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
237 GNUNET_asprintf (&cfg_name,
238 "test_namestore_api_%s.conf",
239 plugin_name);
233 res = 1; 240 res = 1;
234 if (0 != 241 if (0 !=
235 GNUNET_TESTING_peer_run ("test-namestore-api", 242 GNUNET_TESTING_peer_run ("test-namestore-api-lookup-private",
236 "test_namestore_api.conf", 243 cfg_name,
237 &run, 244 &run,
238 NULL)) 245 NULL))
239 { 246 {
240 res = 1; 247 res = 1;
241 } 248 }
249 GNUNET_free (cfg_name);
242 if (NULL != directory) 250 if (NULL != directory)
243 { 251 {
244 GNUNET_DISK_directory_remove (directory); 252 GNUNET_DISK_directory_remove (directory);
@@ -248,4 +256,4 @@ main (int argc, char *argv[])
248} 256}
249 257
250 258
251/* end of test_namestore_api_store.c */ 259/* end of test_namestore_api_lookup_private.c */
diff --git a/src/namestore/test_namestore_api_lookup_public.c b/src/namestore/test_namestore_api_lookup_public.c
index 09d6b302d..02ca16042 100644
--- a/src/namestore/test_namestore_api_lookup_public.c
+++ b/src/namestore/test_namestore_api_lookup_public.c
@@ -237,15 +237,23 @@ run (void *cls,
237int 237int
238main (int argc, char *argv[]) 238main (int argc, char *argv[])
239{ 239{
240 const char *plugin_name;
241 char *cfg_name;
242
243 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
244 GNUNET_asprintf (&cfg_name,
245 "test_namestore_api_%s.conf",
246 plugin_name);
240 res = 1; 247 res = 1;
241 if (0 != 248 if (0 !=
242 GNUNET_TESTING_peer_run ("test-namestore-api", 249 GNUNET_TESTING_peer_run ("test-namestore-api",
243 "test_namestore_api.conf", 250 cfg_name,
244 &run, 251 &run,
245 NULL)) 252 NULL))
246 { 253 {
247 res = 1; 254 res = 1;
248 } 255 }
256 GNUNET_free (cfg_name);
249 if (NULL != directory) 257 if (NULL != directory)
250 { 258 {
251 GNUNET_DISK_directory_remove (directory); 259 GNUNET_DISK_directory_remove (directory);
diff --git a/src/namestore/test_namestore_api_lookup_shadow.c b/src/namestore/test_namestore_api_lookup_shadow.c
index 7f9a90704..e80335796 100644
--- a/src/namestore/test_namestore_api_lookup_shadow.c
+++ b/src/namestore/test_namestore_api_lookup_shadow.c
@@ -18,7 +18,7 @@
18 Boston, MA 02110-1301, USA. 18 Boston, MA 02110-1301, USA.
19*/ 19*/
20/** 20/**
21 * @file namestore/test_namestore_api_lookup_shadow_filter.c 21 * @file namestore/test_namestore_api_lookup_shadow.c
22 * @brief testcase for namestore_api.c: store a shadow record and perform a lookup 22 * @brief testcase for namestore_api.c: store a shadow record and perform a lookup
23 * test passes if test returns the record but without the shadow flag since no 23 * test passes if test returns the record but without the shadow flag since no
24 * other valid record is available 24 * other valid record is available
@@ -267,15 +267,23 @@ run (void *cls,
267int 267int
268main (int argc, char *argv[]) 268main (int argc, char *argv[])
269{ 269{
270 const char *plugin_name;
271 char *cfg_name;
272
273 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
274 GNUNET_asprintf (&cfg_name,
275 "test_namestore_api_%s.conf",
276 plugin_name);
270 res = 1; 277 res = 1;
271 if (0 != 278 if (0 !=
272 GNUNET_TESTING_peer_run ("test-namestore-api", 279 GNUNET_TESTING_peer_run ("test-namestore-api-lookup-shadow",
273 "test_namestore_api.conf", 280 cfg_name,
274 &run, 281 &run,
275 NULL)) 282 NULL))
276 { 283 {
277 res = 1; 284 res = 1;
278 } 285 }
286 GNUNET_free (cfg_name);
279 if (NULL != directory) 287 if (NULL != directory)
280 { 288 {
281 GNUNET_DISK_directory_remove (directory); 289 GNUNET_DISK_directory_remove (directory);
@@ -285,4 +293,4 @@ main (int argc, char *argv[])
285} 293}
286 294
287 295
288/* end of test_namestore_api_lookup_shadow_filter.c */ 296/* end of test_namestore_api_lookup_shadow.c */
diff --git a/src/namestore/test_namestore_api_lookup_shadow_filter.c b/src/namestore/test_namestore_api_lookup_shadow_filter.c
index a22baa17b..5b8811a23 100644
--- a/src/namestore/test_namestore_api_lookup_shadow_filter.c
+++ b/src/namestore/test_namestore_api_lookup_shadow_filter.c
@@ -345,15 +345,23 @@ run (void *cls,
345int 345int
346main (int argc, char *argv[]) 346main (int argc, char *argv[])
347{ 347{
348 const char *plugin_name;
349 char *cfg_name;
350
351 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
352 GNUNET_asprintf (&cfg_name,
353 "test_namestore_api_%s.conf",
354 plugin_name);
348 res = 1; 355 res = 1;
349 if (0 != 356 if (0 !=
350 GNUNET_TESTING_peer_run ("test-namestore-api", 357 GNUNET_TESTING_peer_run ("test-namestore-api-lookup-shadow-filter",
351 "test_namestore_api.conf", 358 cfg_name,
352 &run, 359 &run,
353 NULL)) 360 NULL))
354 { 361 {
355 res = 1; 362 res = 1;
356 } 363 }
364 GNUNET_free (cfg_name);
357 if (NULL != directory) 365 if (NULL != directory)
358 { 366 {
359 GNUNET_DISK_directory_remove (directory); 367 GNUNET_DISK_directory_remove (directory);
diff --git a/src/namestore/test_namestore_api_monitoring.c b/src/namestore/test_namestore_api_monitoring.c
index 68a3e4fb8..f6d4fe226 100644
--- a/src/namestore/test_namestore_api_monitoring.c
+++ b/src/namestore/test_namestore_api_monitoring.c
@@ -374,15 +374,23 @@ run (void *cls,
374int 374int
375main (int argc, char *argv[]) 375main (int argc, char *argv[])
376{ 376{
377 const char *plugin_name;
378 char *cfg_name;
379
380 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
381 GNUNET_asprintf (&cfg_name,
382 "test_namestore_api_%s.conf",
383 plugin_name);
377 res = 1; 384 res = 1;
378 if (0 != 385 if (0 !=
379 GNUNET_TESTING_peer_run ("test-namestore-api-monitoring", 386 GNUNET_TESTING_peer_run ("test-namestore-api-monitoring",
380 "test_namestore_api.conf", 387 cfg_name,
381 &run, 388 &run,
382 NULL)) 389 NULL))
383 { 390 {
384 res = 1; 391 res = 1;
385 } 392 }
393 GNUNET_free (cfg_name);
386 if (NULL != directory) 394 if (NULL != directory)
387 { 395 {
388 GNUNET_DISK_directory_remove (directory); 396 GNUNET_DISK_directory_remove (directory);
diff --git a/src/namestore/test_namestore_api_monitoring_existing.c b/src/namestore/test_namestore_api_monitoring_existing.c
index 374ad44dd..17f726eb1 100644
--- a/src/namestore/test_namestore_api_monitoring_existing.c
+++ b/src/namestore/test_namestore_api_monitoring_existing.c
@@ -368,15 +368,23 @@ run (void *cls,
368int 368int
369main (int argc, char *argv[]) 369main (int argc, char *argv[])
370{ 370{
371 const char *plugin_name;
372 char *cfg_name;
373
374 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
375 GNUNET_asprintf (&cfg_name,
376 "test_namestore_api_%s.conf",
377 plugin_name);
371 res = 1; 378 res = 1;
372 if (0 != 379 if (0 !=
373 GNUNET_TESTING_peer_run ("test-namestore-api-monitoring", 380 GNUNET_TESTING_peer_run ("test-namestore-api-monitoring-existing",
374 "test_namestore_api.conf", 381 cfg_name,
375 &run, 382 &run,
376 NULL)) 383 NULL))
377 { 384 {
378 res = 1; 385 res = 1;
379 } 386 }
387 GNUNET_free (cfg_name);
380 if (NULL != directory) 388 if (NULL != directory)
381 { 389 {
382 GNUNET_DISK_directory_remove (directory); 390 GNUNET_DISK_directory_remove (directory);
@@ -386,4 +394,4 @@ main (int argc, char *argv[])
386} 394}
387 395
388 396
389/* end of test_namestore_api_monitoring.c */ 397/* end of test_namestore_api_monitoring_existing.c */
diff --git a/src/namestore/test_namestore_api_postgres.conf b/src/namestore/test_namestore_api_postgres.conf
index 259ce35e7..397cb4b2f 100644
--- a/src/namestore/test_namestore_api_postgres.conf
+++ b/src/namestore/test_namestore_api_postgres.conf
@@ -2,6 +2,3 @@
2 2
3[namestore] 3[namestore]
4DATABASE = postgres 4DATABASE = postgres
5
6[namecache]
7DISABLE = YES
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c
index 2d670c1ee..532a751da 100644
--- a/src/namestore/test_namestore_api_remove.c
+++ b/src/namestore/test_namestore_api_remove.c
@@ -120,7 +120,8 @@ remove_cont (void *cls,
120 120
121 121
122static void 122static void
123put_cont (void *cls, int32_t success, 123put_cont (void *cls,
124 int32_t success,
124 const char *emsg) 125 const char *emsg)
125{ 126{
126 const char *name = cls; 127 const char *name = cls;
@@ -161,20 +162,27 @@ run (void *cls,
161 162
162 directory = NULL; 163 directory = NULL;
163 GNUNET_assert (GNUNET_OK == 164 GNUNET_assert (GNUNET_OK ==
164 GNUNET_CONFIGURATION_get_value_string(cfg, "PATHS", "GNUNET_TEST_HOME", &directory)); 165 GNUNET_CONFIGURATION_get_value_string(cfg,
166 "PATHS",
167 "GNUNET_TEST_HOME",
168 &directory));
165 GNUNET_DISK_directory_remove (directory); 169 GNUNET_DISK_directory_remove (directory);
166 170
167 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 171 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
168 &endbadly, NULL); 172 &endbadly,
173 NULL);
169 GNUNET_asprintf (&hostkey_file, 174 GNUNET_asprintf (&hostkey_file,
170 "zonefiles%s%s", 175 "zonefiles%s%s",
171 DIR_SEPARATOR_STR, 176 DIR_SEPARATOR_STR,
172 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); 177 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey");
173 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); 178 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
179 "Using zonekey file `%s' \n",
180 hostkey_file);
174 privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); 181 privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file);
175 GNUNET_free (hostkey_file); 182 GNUNET_free (hostkey_file);
176 GNUNET_assert (privkey != NULL); 183 GNUNET_assert (privkey != NULL);
177 GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey); 184 GNUNET_CRYPTO_ecdsa_key_get_public (privkey,
185 &pubkey);
178 186
179 removed = GNUNET_NO; 187 removed = GNUNET_NO;
180 188
@@ -201,15 +209,23 @@ run (void *cls,
201int 209int
202main (int argc, char *argv[]) 210main (int argc, char *argv[])
203{ 211{
212 const char *plugin_name;
213 char *cfg_name;
214
215 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
216 GNUNET_asprintf (&cfg_name,
217 "test_namestore_api_%s.conf",
218 plugin_name);
204 res = 1; 219 res = 1;
205 if (0 != 220 if (0 !=
206 GNUNET_TESTING_peer_run ("test-namestore-api", 221 GNUNET_TESTING_peer_run ("test-namestore-api-remove",
207 "test_namestore_api.conf", 222 cfg_name,
208 &run, 223 &run,
209 NULL)) 224 NULL))
210 { 225 {
211 res = 1; 226 res = 1;
212 } 227 }
228 GNUNET_free (cfg_name);
213 if (NULL != directory) 229 if (NULL != directory)
214 { 230 {
215 GNUNET_DISK_directory_remove (directory); 231 GNUNET_DISK_directory_remove (directory);
diff --git a/src/namestore/test_namestore_api_remove_not_existing_record.c b/src/namestore/test_namestore_api_remove_not_existing_record.c
index ef199cdf6..2f20c3636 100644
--- a/src/namestore/test_namestore_api_remove_not_existing_record.c
+++ b/src/namestore/test_namestore_api_remove_not_existing_record.c
@@ -167,15 +167,23 @@ run (void *cls,
167int 167int
168main (int argc, char *argv[]) 168main (int argc, char *argv[])
169{ 169{
170 const char *plugin_name;
171 char *cfg_name;
172
173 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
174 GNUNET_asprintf (&cfg_name,
175 "test_namestore_api_%s.conf",
176 plugin_name);
170 res = 1; 177 res = 1;
171 if (0 != 178 if (0 !=
172 GNUNET_TESTING_peer_run ("test-namestore-api", 179 GNUNET_TESTING_peer_run ("test-namestore-api-remove-non-existing-record",
173 "test_namestore_api.conf", 180 cfg_name,
174 &run, 181 &run,
175 NULL)) 182 NULL))
176 { 183 {
177 res = 1; 184 res = 1;
178 } 185 }
186 GNUNET_free (cfg_name);
179 if (NULL != directory) 187 if (NULL != directory)
180 { 188 {
181 GNUNET_DISK_directory_remove (directory); 189 GNUNET_DISK_directory_remove (directory);
diff --git a/src/namestore/test_namestore_api_sqlite.conf b/src/namestore/test_namestore_api_sqlite.conf
index 72b609226..5416daec3 100644
--- a/src/namestore/test_namestore_api_sqlite.conf
+++ b/src/namestore/test_namestore_api_sqlite.conf
@@ -1,4 +1,4 @@
1@INLINE@ test_namestore_api.conf 1@INLINE@ test_namestore_api.conf
2 2
3[namecache] 3[namestore]
4DISABLE = YES 4DATABASE = sqlite
diff --git a/src/namestore/test_namestore_api_store.c b/src/namestore/test_namestore_api_store.c
index d80676770..4e51678a1 100644
--- a/src/namestore/test_namestore_api_store.c
+++ b/src/namestore/test_namestore_api_store.c
@@ -159,15 +159,23 @@ run (void *cls,
159int 159int
160main (int argc, char *argv[]) 160main (int argc, char *argv[])
161{ 161{
162 const char *plugin_name;
163 char *cfg_name;
164
165 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
166 GNUNET_asprintf (&cfg_name,
167 "test_namestore_api_%s.conf",
168 plugin_name);
162 res = 1; 169 res = 1;
163 if (0 != 170 if (0 !=
164 GNUNET_TESTING_peer_run ("test-namestore-api", 171 GNUNET_TESTING_peer_run ("test-namestore-api",
165 "test_namestore_api.conf", 172 cfg_name,
166 &run, 173 &run,
167 NULL)) 174 NULL))
168 { 175 {
169 res = 1; 176 res = 1;
170 } 177 }
178 GNUNET_free (cfg_name);
171 if (NULL != directory) 179 if (NULL != directory)
172 { 180 {
173 GNUNET_DISK_directory_remove (directory); 181 GNUNET_DISK_directory_remove (directory);
diff --git a/src/namestore/test_namestore_api_store_update.c b/src/namestore/test_namestore_api_store_update.c
index ed5a399bd..0a4551f21 100644
--- a/src/namestore/test_namestore_api_store_update.c
+++ b/src/namestore/test_namestore_api_store_update.c
@@ -274,15 +274,23 @@ run (void *cls,
274int 274int
275main (int argc, char *argv[]) 275main (int argc, char *argv[])
276{ 276{
277 const char *plugin_name;
278 char *cfg_name;
279
280 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
281 GNUNET_asprintf (&cfg_name,
282 "test_namestore_api_%s.conf",
283 plugin_name);
277 res = 1; 284 res = 1;
278 if (0 != 285 if (0 !=
279 GNUNET_TESTING_peer_run ("test-namestore-api-store-update", 286 GNUNET_TESTING_peer_run ("test-namestore-api-store-update",
280 "test_namestore_api.conf", 287 cfg_name,
281 &run, 288 &run,
282 NULL)) 289 NULL))
283 { 290 {
284 res = 1; 291 res = 1;
285 } 292 }
293 GNUNET_free (cfg_name);
286 if (NULL != directory) 294 if (NULL != directory)
287 { 295 {
288 GNUNET_DISK_directory_remove (directory); 296 GNUNET_DISK_directory_remove (directory);
diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c
index 1343d42bf..806605d94 100644
--- a/src/namestore/test_namestore_api_zone_iteration.c
+++ b/src/namestore/test_namestore_api_zone_iteration.c
@@ -487,15 +487,23 @@ run (void *cls,
487int 487int
488main (int argc, char *argv[]) 488main (int argc, char *argv[])
489{ 489{
490 const char *plugin_name;
491 char *cfg_name;
492
493 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
494 GNUNET_asprintf (&cfg_name,
495 "test_namestore_api_%s.conf",
496 plugin_name);
490 res = 1; 497 res = 1;
491 if (0 != 498 if (0 !=
492 GNUNET_TESTING_peer_run ("test-namestore-api-zone-iteration", 499 GNUNET_TESTING_peer_run ("test-namestore-api-zone-iteration",
493 "test_namestore_api.conf", 500 cfg_name,
494 &run, 501 &run,
495 NULL)) 502 NULL))
496 { 503 {
497 res = 1; 504 res = 1;
498 } 505 }
506 GNUNET_free (cfg_name);
499 if (NULL != directory) 507 if (NULL != directory)
500 { 508 {
501 GNUNET_DISK_directory_remove (directory); 509 GNUNET_DISK_directory_remove (directory);
diff --git a/src/namestore/test_namestore_api_zone_iteration_nick.c b/src/namestore/test_namestore_api_zone_iteration_nick.c
index 395d1854f..a88646864 100644
--- a/src/namestore/test_namestore_api_zone_iteration_nick.c
+++ b/src/namestore/test_namestore_api_zone_iteration_nick.c
@@ -490,15 +490,23 @@ run (void *cls,
490int 490int
491main (int argc, char *argv[]) 491main (int argc, char *argv[])
492{ 492{
493 const char *plugin_name;
494 char *cfg_name;
495
496 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
497 GNUNET_asprintf (&cfg_name,
498 "test_namestore_api_%s.conf",
499 plugin_name);
493 res = 1; 500 res = 1;
494 if (0 != 501 if (0 !=
495 GNUNET_TESTING_peer_run ("test-namestore-api-zone-iteration", 502 GNUNET_TESTING_peer_run ("test-namestore-api-zone-iteration-nick",
496 "test_namestore_api.conf", 503 cfg_name,
497 &run, 504 &run,
498 NULL)) 505 NULL))
499 { 506 {
500 res = 1; 507 res = 1;
501 } 508 }
509 GNUNET_free (cfg_name);
502 if (NULL != directory) 510 if (NULL != directory)
503 { 511 {
504 GNUNET_DISK_directory_remove (directory); 512 GNUNET_DISK_directory_remove (directory);
diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
index d222bf16c..a4fb320e9 100644
--- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
+++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
@@ -485,15 +485,23 @@ run (void *cls,
485int 485int
486main (int argc, char *argv[]) 486main (int argc, char *argv[])
487{ 487{
488 const char *plugin_name;
489 char *cfg_name;
490
491 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
492 GNUNET_asprintf (&cfg_name,
493 "test_namestore_api_%s.conf",
494 plugin_name);
488 res = 1; 495 res = 1;
489 if (0 != 496 if (0 !=
490 GNUNET_TESTING_peer_run ("test-namestore-api-zone-iteration", 497 GNUNET_TESTING_peer_run ("test-namestore-api-zone-iteration-specific-zone",
491 "test_namestore_api.conf", 498 cfg_name,
492 &run, 499 &run,
493 NULL)) 500 NULL))
494 { 501 {
495 res = 1; 502 res = 1;
496 } 503 }
504 GNUNET_free (cfg_name);
497 if (NULL != directory) 505 if (NULL != directory)
498 { 506 {
499 GNUNET_DISK_directory_remove (directory); 507 GNUNET_DISK_directory_remove (directory);
diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c b/src/namestore/test_namestore_api_zone_iteration_stop.c
index d23a5f4cb..c7be5fead 100644
--- a/src/namestore/test_namestore_api_zone_iteration_stop.c
+++ b/src/namestore/test_namestore_api_zone_iteration_stop.c
@@ -508,15 +508,23 @@ run (void *cls,
508int 508int
509main (int argc, char *argv[]) 509main (int argc, char *argv[])
510{ 510{
511 const char *plugin_name;
512 char *cfg_name;
513
514 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
515 GNUNET_asprintf (&cfg_name,
516 "test_namestore_api_%s.conf",
517 plugin_name);
511 res = 1; 518 res = 1;
512 if (0 != 519 if (0 !=
513 GNUNET_TESTING_peer_run ("test-namestore-api-zone-iteration-stop", 520 GNUNET_TESTING_peer_run ("test-namestore-api-zone-iteration-stop",
514 "test_namestore_api.conf", 521 cfg_name,
515 &run, 522 &run,
516 NULL)) 523 NULL))
517 { 524 {
518 res = 1; 525 res = 1;
519 } 526 }
527 GNUNET_free (cfg_name);
520 if (NULL != directory) 528 if (NULL != directory)
521 { 529 {
522 GNUNET_DISK_directory_remove (directory); 530 GNUNET_DISK_directory_remove (directory);
diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c
index 2bc7d34a3..5b088d90b 100644
--- a/src/namestore/test_namestore_api_zone_to_name.c
+++ b/src/namestore/test_namestore_api_zone_to_name.c
@@ -221,7 +221,7 @@ run (void *cls,
221 /* load privat key */ 221 /* load privat key */
222 { 222 {
223 char *zonekey_file; 223 char *zonekey_file;
224 224
225 GNUNET_asprintf (&zonekey_file, 225 GNUNET_asprintf (&zonekey_file,
226 "zonefiles%s%s", 226 "zonefiles%s%s",
227 DIR_SEPARATOR_STR, 227 DIR_SEPARATOR_STR,
@@ -242,13 +242,13 @@ run (void *cls,
242 sizeof (s_zone_value)); 242 sizeof (s_zone_value));
243 { 243 {
244 struct GNUNET_GNSRECORD_Data rd; 244 struct GNUNET_GNSRECORD_Data rd;
245 245
246 rd.expiration_time = GNUNET_TIME_absolute_get().abs_value_us; 246 rd.expiration_time = GNUNET_TIME_absolute_get().abs_value_us;
247 rd.record_type = GNUNET_GNSRECORD_TYPE_PKEY; 247 rd.record_type = GNUNET_GNSRECORD_TYPE_PKEY;
248 rd.data_size = sizeof (s_zone_value); 248 rd.data_size = sizeof (s_zone_value);
249 rd.data = &s_zone_value; 249 rd.data = &s_zone_value;
250 rd.flags = 0; 250 rd.flags = 0;
251 251
252 nsh = GNUNET_NAMESTORE_connect (cfg); 252 nsh = GNUNET_NAMESTORE_connect (cfg);
253 GNUNET_break (NULL != nsh); 253 GNUNET_break (NULL != nsh);
254 GNUNET_NAMESTORE_records_store (nsh, 254 GNUNET_NAMESTORE_records_store (nsh,
@@ -266,17 +266,24 @@ int
266main (int argc, 266main (int argc,
267 char *argv[]) 267 char *argv[])
268{ 268{
269 const char *plugin_name;
270 char *cfg_name;
271
269 (void) argc; 272 (void) argc;
270 (void) argv; 273 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
274 GNUNET_asprintf (&cfg_name,
275 "test_namestore_api_%s.conf",
276 plugin_name);
271 res = 1; 277 res = 1;
272 if (0 != 278 if (0 !=
273 GNUNET_TESTING_peer_run ("test-namestore-api-zone-to-name", 279 GNUNET_TESTING_peer_run ("test-namestore-api-zone-to-name",
274 "test_namestore_api.conf", 280 cfg_name,
275 &run, 281 &run,
276 NULL)) 282 NULL))
277 { 283 {
278 res = 1; 284 res = 1;
279 } 285 }
286 GNUNET_free (cfg_name);
280 if (NULL != directory) 287 if (NULL != directory)
281 { 288 {
282 GNUNET_DISK_directory_remove (directory); 289 GNUNET_DISK_directory_remove (directory);