more extensive namestore tests for the non-sqlite plugins, with bugfixes
authorChristian Grothoff <christian@grothoff.org>
Tue, 1 May 2018 10:44:39 +0000 (12:44 +0200)
committerChristian Grothoff <christian@grothoff.org>
Tue, 1 May 2018 10:44:39 +0000 (12:44 +0200)
29 files changed:
src/include/gnunet_namestore_plugin.h
src/namestore/Makefile.am
src/namestore/gnunet-service-namestore.c
src/namestore/perf_namestore_api_flat.conf [new file with mode: 0644]
src/namestore/perf_namestore_api_postgres.conf [new file with mode: 0644]
src/namestore/perf_namestore_api_sqlite.conf [new file with mode: 0644]
src/namestore/perf_namestore_api_zone_iteration.c
src/namestore/plugin_namestore_flat.c
src/namestore/plugin_namestore_postgres.c
src/namestore/plugin_namestore_sqlite.c
src/namestore/test_namestore_api_flat.conf
src/namestore/test_namestore_api_lookup_nick.c
src/namestore/test_namestore_api_lookup_private.c
src/namestore/test_namestore_api_lookup_public.c
src/namestore/test_namestore_api_lookup_shadow.c
src/namestore/test_namestore_api_lookup_shadow_filter.c
src/namestore/test_namestore_api_monitoring.c
src/namestore/test_namestore_api_monitoring_existing.c
src/namestore/test_namestore_api_postgres.conf
src/namestore/test_namestore_api_remove.c
src/namestore/test_namestore_api_remove_not_existing_record.c
src/namestore/test_namestore_api_sqlite.conf
src/namestore/test_namestore_api_store.c
src/namestore/test_namestore_api_store_update.c
src/namestore/test_namestore_api_zone_iteration.c
src/namestore/test_namestore_api_zone_iteration_nick.c
src/namestore/test_namestore_api_zone_iteration_specific_zone.c
src/namestore/test_namestore_api_zone_iteration_stop.c
src/namestore/test_namestore_api_zone_to_name.c

index c3ab4d8bf722fd273b479c61cac54d5e89611612..e15068222717d860a3b3ea5b732690f70132d9f4 100644 (file)
@@ -99,7 +99,7 @@ struct GNUNET_NAMESTORE_PluginFunctions
    * @param label name of the record in the zone
    * @param iter function to call with the result
    * @param iter_cls closure for @a iter
-   * @return #GNUNET_OK on success, else #GNUNET_SYSERR
+   * @return #GNUNET_OK on success, #GNUNET_NO for no results, else #GNUNET_SYSERR
    */
   int
   (*lookup_records) (void *cls,
index b925261b7a6715766f5a8bc4a9edf1784c2985d7..b1faae86277e26c2db0c937eff888ff45a5cdeeb 100644 (file)
@@ -23,6 +23,22 @@ endif
 FLAT_PLUGIN = libgnunet_plugin_namestore_flat.la
 if HAVE_TESTING
 FLAT_TESTS = test_plugin_namestore_flat \
+ test_namestore_api_store_flat \
+ test_namestore_api_store_update_flat \
+ test_namestore_api_remove_flat \
+ test_namestore_api_zone_iteration_flat \
+ test_namestore_api_lookup_nick_flat \
+ test_namestore_api_monitoring_flat \
+ test_namestore_api_lookup_public_flat \
+ test_namestore_api_lookup_private_flat \
+ test_namestore_api_lookup_shadow_flat \
+ test_namestore_api_lookup_shadow_filter_flat \
+ test_namestore_api_remove_not_existing_record_flat \
+ test_namestore_api_zone_iteration_nick_flat \
+ test_namestore_api_zone_iteration_specific_zone_flat \
+ test_namestore_api_zone_iteration_stop_flat \
+ test_namestore_api_monitoring_existing_flat \
+ test_namestore_api_zone_to_name_flat \
  perf_namestore_api_zone_iteration_flat
 endif
 
@@ -30,6 +46,22 @@ if HAVE_SQLITE
 SQLITE_PLUGIN = libgnunet_plugin_namestore_sqlite.la
 if HAVE_TESTING
 SQLITE_TESTS = test_plugin_namestore_sqlite \
+ test_namestore_api_store_sqlite \
+ test_namestore_api_store_update_sqlite \
+ test_namestore_api_zone_iteration_sqlite \
+ test_namestore_api_remove_sqlite \
+ test_namestore_api_lookup_nick_sqlite \
+ test_namestore_api_monitoring_sqlite \
+ test_namestore_api_lookup_public_sqlite \
+ test_namestore_api_lookup_private_sqlite \
+ test_namestore_api_lookup_shadow_sqlite \
+ test_namestore_api_lookup_shadow_filter_sqlite \
+ test_namestore_api_remove_not_existing_record_sqlite \
+ test_namestore_api_zone_iteration_nick_sqlite \
+ test_namestore_api_zone_iteration_specific_zone_sqlite \
+ test_namestore_api_zone_iteration_stop_sqlite \
+ test_namestore_api_monitoring_existing_sqlite \
+ test_namestore_api_zone_to_name_sqlite \
  perf_namestore_api_zone_iteration_sqlite
 endif
 endif
@@ -38,54 +70,31 @@ if HAVE_POSTGRESQL
 POSTGRES_PLUGIN = libgnunet_plugin_namestore_postgres.la
 if HAVE_TESTING
 POSTGRES_TESTS = test_plugin_namestore_postgres \
+ test_namestore_api_store_postgres \
+ test_namestore_api_store_update_postgres \
+ test_namestore_api_remove_postgres \
+ test_namestore_api_zone_iteration_postgres \
+ test_namestore_api_lookup_nick_postgres \
+ test_namestore_api_monitoring_postgres \
+ test_namestore_api_lookup_public_postgres \
+ test_namestore_api_lookup_private_postgres \
+ test_namestore_api_lookup_shadow_postgres \
+ test_namestore_api_lookup_shadow_filter_postgres \
+ test_namestore_api_remove_not_existing_record_postgres \
+ test_namestore_api_zone_iteration_nick_postgres \
+ test_namestore_api_zone_iteration_specific_zone_postgres \
+ test_namestore_api_zone_iteration_stop_postgres \
+ test_namestore_api_monitoring_existing_postgres \
+ test_namestore_api_zone_to_name_postgres \
  perf_namestore_api_zone_iteration_postgres
 endif
 endif
 
-if HAVE_TESTING
-TESTING_TESTS = \
- test_namestore_api_store.nc \
- test_namestore_api_store_update.nc \
- test_namestore_api_lookup_public.nc \
- test_namestore_api_lookup_private.nc \
- test_namestore_api_lookup_nick.nc \
- test_namestore_api_lookup_shadow.nc \
- test_namestore_api_lookup_shadow_filter.nc \
- test_namestore_api_remove.nc \
- test_namestore_api_remove_not_existing_record.nc \
- test_namestore_api_zone_iteration.nc \
- test_namestore_api_zone_iteration_nick.nc \
- test_namestore_api_zone_iteration_specific_zone.nc \
- test_namestore_api_zone_iteration_stop.nc \
- test_namestore_api_monitoring.nc \
- test_namestore_api_monitoring_existing.nc \
- test_namestore_api_zone_to_name
-endif
-
-# Declare .nc (NO-CONCURRENCY) as a test extension so that we can impart
-# sequential execution order for them
-TEST_EXTENSIONS = .nc
-test_namestore_api_store.log: test_namestore_api_store_update.log
-test_namestore_api_store_update.log: test_namestore_api_lookup_public.log
-test_namestore_api_lookup_public.log: test_namestore_api_lookup_private.log
-test_namestore_api_lookup_private.log: test_namestore_api_lookup_nick.log
-test_namestore_api_lookup_nick.log: test_namestore_api_lookup_shadow.log
-test_namestore_api_lookup_shadow.log: test_namestore_api_lookup_shadow_filter.log
-test_namestore_api_lookup_shadow_filter.log: test_namestore_api_remove.log
-test_namestore_api_remove.log: test_namestore_api_remove_not_existing_record.log
-test_namestore_api_remove_not_existing_record.log: test_namestore_api_zone_iteration.log
-test_namestore_api_zone_iteration.log: test_namestore_api_zone_iteration_nick.log
-test_namestore_api_zone_iteration_nick.log: test_namestore_api_zone_iteration_specific_zone.log
-test_namestore_api_zone_iteration_specific_zone.log: test_namestore_api_zone_iteration_stop.log
-test_namestore_api_zone_iteration_stop.log: test_namestore_api_monitoring.log
-test_namestore_api_monitoring.log: test_namestore_api_monitoring_existing.log
-
 if HAVE_SQLITE
 check_PROGRAMS = \
  $(SQLITE_TESTS) \
  $(POSTGRES_TESTS) \
- $(FLAT_TESTS) \
- $(TESTING_TESTS)
+ $(FLAT_TESTS)
 endif
 
 if HAVE_MHD
@@ -230,110 +239,327 @@ libgnunet_plugin_rest_namestore_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
 
 
-test_namestore_api_store_nc_SOURCES = \
+test_namestore_api_store_flat_SOURCES = \
+ test_namestore_api_store.c
+test_namestore_api_store_flat_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  libgnunetnamestore.la
+
+test_namestore_api_store_sqlite_SOURCES = \
+ test_namestore_api_store.c
+test_namestore_api_store_sqlite_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  libgnunetnamestore.la
+
+test_namestore_api_store_postgres_SOURCES = \
  test_namestore_api_store.c
-test_namestore_api_store_nc_LDADD = \
+test_namestore_api_store_postgres_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
   libgnunetnamestore.la
 
-test_namestore_api_store_update_nc_SOURCES = \
+test_namestore_api_store_update_flat_SOURCES = \
  test_namestore_api_store_update.c
-test_namestore_api_store_update_nc_LDADD = \
+test_namestore_api_store_update_flat_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/namecache/libgnunetnamecache.la \
   libgnunetnamestore.la
 
-test_namestore_api_lookup_public_nc_SOURCES = \
+test_namestore_api_store_update_sqlite_SOURCES = \
+ test_namestore_api_store_update.c
+test_namestore_api_store_update_sqlite_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/namecache/libgnunetnamecache.la \
+  libgnunetnamestore.la
+
+test_namestore_api_store_update_postgres_SOURCES = \
+ test_namestore_api_store_update.c
+test_namestore_api_store_update_postgres_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/namecache/libgnunetnamecache.la \
+  libgnunetnamestore.la
+
+test_namestore_api_lookup_public_flat_SOURCES = \
  test_namestore_api_lookup_public.c
-test_namestore_api_lookup_public_nc_LDADD = \
+test_namestore_api_lookup_public_flat_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/namecache/libgnunetnamecache.la \
+  libgnunetnamestore.la
+
+test_namestore_api_lookup_public_sqlite_SOURCES = \
+ test_namestore_api_lookup_public.c
+test_namestore_api_lookup_public_sqlite_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/namecache/libgnunetnamecache.la \
+  libgnunetnamestore.la
+
+test_namestore_api_lookup_public_postgres_SOURCES = \
+ test_namestore_api_lookup_public.c
+test_namestore_api_lookup_public_postgres_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/namecache/libgnunetnamecache.la \
+  libgnunetnamestore.la
+
+test_namestore_api_lookup_nick_sqlite_SOURCES = \
+ test_namestore_api_lookup_nick.c
+test_namestore_api_lookup_nick_sqlite_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/namecache/libgnunetnamecache.la \
   libgnunetnamestore.la
 
-test_namestore_api_lookup_nick_nc_SOURCES = \
+test_namestore_api_lookup_nick_postgres_SOURCES = \
  test_namestore_api_lookup_nick.c
-test_namestore_api_lookup_nick_nc_LDADD = \
+test_namestore_api_lookup_nick_postgres_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/namecache/libgnunetnamecache.la \
   libgnunetnamestore.la
 
-test_namestore_api_lookup_private_nc_SOURCES = \
+test_namestore_api_lookup_nick_flat_SOURCES = \
+ test_namestore_api_lookup_nick.c
+test_namestore_api_lookup_nick_flat_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/namecache/libgnunetnamecache.la \
+  libgnunetnamestore.la
+
+test_namestore_api_lookup_private_flat_SOURCES = \
+ test_namestore_api_lookup_private.c
+test_namestore_api_lookup_private_flat_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/namecache/libgnunetnamecache.la \
+  libgnunetnamestore.la
+
+test_namestore_api_lookup_private_sqlite_SOURCES = \
  test_namestore_api_lookup_private.c
-test_namestore_api_lookup_private_nc_LDADD = \
+test_namestore_api_lookup_private_sqlite_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/namecache/libgnunetnamecache.la \
   libgnunetnamestore.la
 
-test_namestore_api_lookup_shadow_nc_SOURCES = \
+test_namestore_api_lookup_private_postgres_SOURCES = \
+ test_namestore_api_lookup_private.c
+test_namestore_api_lookup_private_postgres_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/namecache/libgnunetnamecache.la \
+  libgnunetnamestore.la
+
+test_namestore_api_lookup_shadow_flat_SOURCES = \
  test_namestore_api_lookup_shadow.c
-test_namestore_api_lookup_shadow_nc_LDADD = \
+test_namestore_api_lookup_shadow_flat_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/namecache/libgnunetnamecache.la \
   libgnunetnamestore.la
 
-test_namestore_api_lookup_shadow_filter_nc_SOURCES = \
+test_namestore_api_lookup_shadow_sqlite_SOURCES = \
+ test_namestore_api_lookup_shadow.c
+test_namestore_api_lookup_shadow_sqlite_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/namecache/libgnunetnamecache.la \
+  libgnunetnamestore.la
+
+test_namestore_api_lookup_shadow_postgres_SOURCES = \
+ test_namestore_api_lookup_shadow.c
+test_namestore_api_lookup_shadow_postgres_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/namecache/libgnunetnamecache.la \
+  libgnunetnamestore.la
+
+test_namestore_api_lookup_shadow_filter_flat_SOURCES = \
  test_namestore_api_lookup_shadow_filter.c
-test_namestore_api_lookup_shadow_filter_nc_LDADD = \
+test_namestore_api_lookup_shadow_filter_flat_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/namecache/libgnunetnamecache.la \
   libgnunetnamestore.la
 
-test_namestore_api_remove_nc_SOURCES = \
+test_namestore_api_lookup_shadow_filter_sqlite_SOURCES = \
+ test_namestore_api_lookup_shadow_filter.c
+test_namestore_api_lookup_shadow_filter_sqlite_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/namecache/libgnunetnamecache.la \
+  libgnunetnamestore.la
+test_namestore_api_lookup_shadow_filter_postgres_SOURCES = \
+ test_namestore_api_lookup_shadow_filter.c
+test_namestore_api_lookup_shadow_filter_postgres_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/namecache/libgnunetnamecache.la \
+  libgnunetnamestore.la
+
+test_namestore_api_remove_sqlite_SOURCES = \
+ test_namestore_api_remove.c
+test_namestore_api_remove_sqlite_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  libgnunetnamestore.la
+
+test_namestore_api_remove_postgres_SOURCES = \
  test_namestore_api_remove.c
-test_namestore_api_remove_nc_LDADD = \
+test_namestore_api_remove_postgres_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  libgnunetnamestore.la
+
+test_namestore_api_remove_flat_SOURCES = \
+ test_namestore_api_remove.c
+test_namestore_api_remove_flat_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  libgnunetnamestore.la
+
+test_namestore_api_remove_not_existing_record_flat_SOURCES = \
+ test_namestore_api_remove_not_existing_record.c
+test_namestore_api_remove_not_existing_record_flat_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
   libgnunetnamestore.la
 
-test_namestore_api_remove_not_existing_record_nc_SOURCES = \
+test_namestore_api_remove_not_existing_record_sqlite_SOURCES = \
  test_namestore_api_remove_not_existing_record.c
-test_namestore_api_remove_not_existing_record_nc_LDADD = \
+test_namestore_api_remove_not_existing_record_sqlite_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
   libgnunetnamestore.la
 
-test_namestore_api_zone_to_name_SOURCES = \
+test_namestore_api_remove_not_existing_record_postgres_SOURCES = \
+ test_namestore_api_remove_not_existing_record.c
+test_namestore_api_remove_not_existing_record_postgres_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  libgnunetnamestore.la
+
+test_namestore_api_zone_to_name_flat_SOURCES = \
+ test_namestore_api_zone_to_name.c
+test_namestore_api_zone_to_name_flat_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  libgnunetnamestore.la
+
+test_namestore_api_zone_to_name_sqlite_SOURCES = \
  test_namestore_api_zone_to_name.c
-test_namestore_api_zone_to_name_LDADD = \
+test_namestore_api_zone_to_name_sqlite_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   libgnunetnamestore.la
 
-test_namestore_api_monitoring_nc_SOURCES = \
+test_namestore_api_zone_to_name_postgres_SOURCES = \
+ test_namestore_api_zone_to_name.c
+test_namestore_api_zone_to_name_postgres_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  libgnunetnamestore.la
+
+test_namestore_api_monitoring_flat_SOURCES = \
  test_namestore_api_monitoring.c
-test_namestore_api_monitoring_nc_LDADD = \
+test_namestore_api_monitoring_flat_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  libgnunetnamestore.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/util/libgnunetutil.la
+
+test_namestore_api_monitoring_sqlite_SOURCES = \
+ test_namestore_api_monitoring.c
+test_namestore_api_monitoring_sqlite_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  libgnunetnamestore.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/util/libgnunetutil.la
+
+test_namestore_api_monitoring_postgres_SOURCES = \
+ test_namestore_api_monitoring.c
+test_namestore_api_monitoring_postgres_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  libgnunetnamestore.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/util/libgnunetutil.la
+
+test_namestore_api_monitoring_existing_flat_SOURCES = \
+ test_namestore_api_monitoring_existing.c
+test_namestore_api_monitoring_existing_flat_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  libgnunetnamestore.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  $(top_builddir)/src/util/libgnunetutil.la
+
+test_namestore_api_monitoring_existing_sqlite_SOURCES = \
+ test_namestore_api_monitoring_existing.c
+test_namestore_api_monitoring_existing_sqlite_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetnamestore.la \
   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/util/libgnunetutil.la
 
-test_namestore_api_monitoring_existing_nc_SOURCES = \
+test_namestore_api_monitoring_existing_postgres_SOURCES = \
  test_namestore_api_monitoring_existing.c
-test_namestore_api_monitoring_existing_nc_LDADD = \
+test_namestore_api_monitoring_existing_postgres_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetnamestore.la \
   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
   $(top_builddir)/src/util/libgnunetutil.la
 
-test_namestore_api_zone_iteration_nc_SOURCES = \
+test_namestore_api_zone_iteration_flat_SOURCES = \
+ test_namestore_api_zone_iteration.c
+test_namestore_api_zone_iteration_flat_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  libgnunetnamestore.la
+
+test_namestore_api_zone_iteration_sqlite_SOURCES = \
+ test_namestore_api_zone_iteration.c
+test_namestore_api_zone_iteration_sqlite_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  libgnunetnamestore.la
+
+test_namestore_api_zone_iteration_postgres_SOURCES = \
  test_namestore_api_zone_iteration.c
-test_namestore_api_zone_iteration_nc_LDADD = \
+test_namestore_api_zone_iteration_postgres_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
@@ -363,26 +589,73 @@ perf_namestore_api_zone_iteration_flat_LDADD = \
   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
   libgnunetnamestore.la
 
-test_namestore_api_zone_iteration_nick_nc_SOURCES = \
+test_namestore_api_zone_iteration_nick_flat_SOURCES = \
  test_namestore_api_zone_iteration_nick.c
-test_namestore_api_zone_iteration_nick_nc_LDADD = \
+test_namestore_api_zone_iteration_nick_flat_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
   libgnunetnamestore.la
 
+test_namestore_api_zone_iteration_nick_sqlite_SOURCES = \
+ test_namestore_api_zone_iteration_nick.c
+test_namestore_api_zone_iteration_nick_sqlite_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  libgnunetnamestore.la
 
-test_namestore_api_zone_iteration_specific_zone_nc_SOURCES = \
+test_namestore_api_zone_iteration_nick_postgres_SOURCES = \
+ test_namestore_api_zone_iteration_nick.c
+test_namestore_api_zone_iteration_nick_postgres_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  libgnunetnamestore.la
+
+test_namestore_api_zone_iteration_specific_zone_flat_SOURCES = \
+ test_namestore_api_zone_iteration_specific_zone.c
+test_namestore_api_zone_iteration_specific_zone_flat_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  libgnunetnamestore.la
+
+test_namestore_api_zone_iteration_specific_zone_sqlite_SOURCES = \
+ test_namestore_api_zone_iteration_specific_zone.c
+test_namestore_api_zone_iteration_specific_zone_sqlite_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  libgnunetnamestore.la
+
+test_namestore_api_zone_iteration_specific_zone_postgres_SOURCES = \
  test_namestore_api_zone_iteration_specific_zone.c
-test_namestore_api_zone_iteration_specific_zone_nc_LDADD = \
+test_namestore_api_zone_iteration_specific_zone_postgres_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  libgnunetnamestore.la
+
+test_namestore_api_zone_iteration_stop_flat_SOURCES = \
+ test_namestore_api_zone_iteration_stop.c
+test_namestore_api_zone_iteration_stop_flat_LDADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+  libgnunetnamestore.la
+
+test_namestore_api_zone_iteration_stop_sqlite_SOURCES = \
+ test_namestore_api_zone_iteration_stop.c
+test_namestore_api_zone_iteration_stop_sqlite_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
   libgnunetnamestore.la
 
-test_namestore_api_zone_iteration_stop_nc_SOURCES = \
+test_namestore_api_zone_iteration_stop_postgres_SOURCES = \
  test_namestore_api_zone_iteration_stop.c
-test_namestore_api_zone_iteration_stop_nc_LDADD = \
+test_namestore_api_zone_iteration_stop_postgres_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
@@ -416,6 +689,9 @@ EXTRA_DIST = \
   test_namestore_api_postgres.conf \
   test_namestore_api_sqlite.conf \
   test_namestore_api_flat.conf \
+  perf_namestore_api_postgres.conf \
+  perf_namestore_api_sqlite.conf \
+  perf_namestore_api_flat.conf \
   test_plugin_namestore_sqlite.conf \
   test_plugin_namestore_postgres.conf \
   test_plugin_namestore_flat.conf \
index 0456e5c15fd837c6971654fb6111f750ffb62b7f..2172ed0c7d14228ef5ba652303babf48e44b1588 100644 (file)
@@ -1108,12 +1108,11 @@ handle_record_store (void *cls,
                conv_name);
     if ( (0 == rd_count) &&
          (GNUNET_NO ==
-          GSN_database->iterate_records (GSN_database->cls,
-                                         &rp_msg->private_key,
-                                         0,
-                                         1,
-                                         NULL,
-                                         0)) )
+          GSN_database->lookup_records (GSN_database->cls,
+                                        &rp_msg->private_key,
+                                        conv_name,
+                                        NULL,
+                                        0)) )
     {
       /* This name does not exist, so cannot be removed */
       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 (file)
index 0000000..26e2f2c
--- /dev/null
@@ -0,0 +1,7 @@
+@INLINE@ test_namestore_api.conf
+
+[namestore]
+DATABASE = flat
+
+[namecache]
+DISABLE = YES
diff --git a/src/namestore/perf_namestore_api_postgres.conf b/src/namestore/perf_namestore_api_postgres.conf
new file mode 100644 (file)
index 0000000..259ce35
--- /dev/null
@@ -0,0 +1,7 @@
+@INLINE@ test_namestore_api.conf
+
+[namestore]
+DATABASE = postgres
+
+[namecache]
+DISABLE = YES
diff --git a/src/namestore/perf_namestore_api_sqlite.conf b/src/namestore/perf_namestore_api_sqlite.conf
new file mode 100644 (file)
index 0000000..72b6092
--- /dev/null
@@ -0,0 +1,4 @@
+@INLINE@ test_namestore_api.conf
+
+[namecache]
+DISABLE = YES
index 220c3c495ad7d79cd0ea0b0f23803616d2780eaa..4ef8d340739c25e668abc76eabb54ccd6cc4bc0c 100644 (file)
@@ -364,7 +364,7 @@ main (int argc,
 
   plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
   GNUNET_asprintf (&cfg_name,
-                   "test_namestore_api_%s.conf",
+                   "perf_namestore_api_%s.conf",
                    plugin_name);
   res = 1;
   if (0 !=
index f40154915b66a671dc10c6a5a29a36a5b51f5d77..88b3ce9b4abed6589eaa361f074f52c207382fb3 100644 (file)
@@ -436,45 +436,51 @@ namestore_flat_store_records (void *cls,
                                     UINT64_MAX);
   key_len = strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey);
   key = GNUNET_malloc (key_len);
-  GNUNET_memcpy (key, label, strlen (label));
-  GNUNET_memcpy (key+strlen(label),
-          zone_key,
-          sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
+  GNUNET_memcpy (key,
+                 label,
+                 strlen (label));
+  GNUNET_memcpy (key + strlen(label),
+                 zone_key,
+                 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
   GNUNET_CRYPTO_hash (key,
                       key_len,
                       &hkey);
-
-  GNUNET_CONTAINER_multihashmap_remove_all (plugin->hm, &hkey);
-
-  if (0 < rd_count)
+  GNUNET_CONTAINER_multihashmap_remove_all (plugin->hm,
+                                            &hkey);
+  if (0 == rd_count)
   {
-    entry = GNUNET_new (struct FlatFileEntry);
-    entry->private_key = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey);
-    GNUNET_asprintf (&entry->label,
-                     label,
-                     strlen (label));
-    GNUNET_memcpy (entry->private_key,
-                  zone_key,
-                  sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
-    entry->rvalue = rvalue;
-    entry->record_count = rd_count;
-    entry->record_data = GNUNET_new_array (rd_count,
-                                          struct GNUNET_GNSRECORD_Data);
-    for (unsigned int i = 0; i < rd_count; i++)
-    {
-      entry->record_data[i].expiration_time = rd[i].expiration_time;
-      entry->record_data[i].record_type = rd[i].record_type;
-      entry->record_data[i].flags = rd[i].flags;
-      entry->record_data[i].data_size = rd[i].data_size;
-      entry->record_data[i].data = GNUNET_malloc (rd[i].data_size);
-      GNUNET_memcpy ((char*)entry->record_data[i].data, rd[i].data, rd[i].data_size);
-    }
-    return GNUNET_CONTAINER_multihashmap_put (plugin->hm,
-                                              &hkey,
-                                              entry,
-                                              GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+    GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+                     "sqlite",
+                     "Record deleted\n");
+    return GNUNET_OK;
   }
-  return GNUNET_NO;
+  entry = GNUNET_new (struct FlatFileEntry);
+  entry->private_key = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey);
+  GNUNET_asprintf (&entry->label,
+                   label,
+                   strlen (label));
+  GNUNET_memcpy (entry->private_key,
+                 zone_key,
+                 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
+  entry->rvalue = rvalue;
+  entry->record_count = rd_count;
+  entry->record_data = GNUNET_new_array (rd_count,
+                                         struct GNUNET_GNSRECORD_Data);
+  for (unsigned int i = 0; i < rd_count; i++)
+  {
+    entry->record_data[i].expiration_time = rd[i].expiration_time;
+    entry->record_data[i].record_type = rd[i].record_type;
+    entry->record_data[i].flags = rd[i].flags;
+    entry->record_data[i].data_size = rd[i].data_size;
+    entry->record_data[i].data = GNUNET_malloc (rd[i].data_size);
+    GNUNET_memcpy ((char*)entry->record_data[i].data,
+                   rd[i].data,
+                   rd[i].data_size);
+  }
+  return GNUNET_CONTAINER_multihashmap_put (plugin->hm,
+                                            &hkey,
+                                            entry,
+                                            GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
 }
 
 
@@ -486,7 +492,7 @@ namestore_flat_store_records (void *cls,
  * @param label name of the record in the zone
  * @param iter function to call with the result
  * @param iter_cls closure for @a iter
- * @return #GNUNET_OK on success, else #GNUNET_SYSERR
+ * @return #GNUNET_OK on success, #GNUNET_NO for no results, else #GNUNET_SYSERR
  */
 static int
 namestore_flat_lookup_records (void *cls,
@@ -502,7 +508,10 @@ namestore_flat_lookup_records (void *cls,
   size_t key_len;
 
   if (NULL == zone)
+  {
+    GNUNET_break (0);
     return GNUNET_SYSERR;
+  }
   key_len = strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey);
   key = GNUNET_malloc (key_len);
   GNUNET_memcpy (key,
index 69e28b0d0eeaff1637858676c5d5b76ae4375aef..4e4ca1f43b192c4a8f7e52a8e3f92a8dbb480b71 100644 (file)
@@ -212,7 +212,9 @@ namestore_postgres_store_records (void *cls,
   uint32_t rd_count32 = (uint32_t) rd_count;
   size_t data_size;
 
-  memset (&pkey, 0, sizeof (pkey));
+  memset (&pkey,
+          0,
+          sizeof (pkey));
   for (unsigned int i=0;i<rd_count;i++)
     if (GNUNET_GNSRECORD_TYPE_PKEY == rd[i].record_type)
     {
@@ -231,6 +233,32 @@ namestore_postgres_store_records (void *cls,
     GNUNET_break (0);
     return GNUNET_SYSERR;
   }
+  /* first, delete existing records */
+  {
+    struct GNUNET_PQ_QueryParam params[] = {
+      GNUNET_PQ_query_param_auto_from_type (zone_key),
+      GNUNET_PQ_query_param_string (label),
+      GNUNET_PQ_query_param_end
+    };
+    enum GNUNET_DB_QueryStatus res;
+
+    res = GNUNET_PQ_eval_prepared_non_select (plugin->dbh,
+                                              "delete_records",
+                                              params);
+    if ( (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != res) &&
+         (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS != res) )
+    {
+      GNUNET_break (0);
+      return GNUNET_SYSERR;
+    }
+  }
+  if (0 == rd_count)
+  {
+    GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+                     "postgres",
+                     "Record deleted\n");
+    return GNUNET_OK;
+  }
   {
     char data[data_size];
     struct GNUNET_PQ_QueryParam params[] = {
@@ -389,7 +417,7 @@ parse_result_call_iterator (void *cls,
  * @param label name of the record in the zone
  * @param iter function to call with the result
  * @param iter_cls closure for @a iter
- * @return #GNUNET_OK on success, else #GNUNET_SYSERR
+ * @return #GNUNET_OK on success, #GNUNET_NO for no results, else #GNUNET_SYSERR
  */
 static int
 namestore_postgres_lookup_records (void *cls,
@@ -407,6 +435,11 @@ namestore_postgres_lookup_records (void *cls,
   struct ParserContext pc;
   enum GNUNET_DB_QueryStatus res;
 
+  if (NULL == zone)
+  {
+    GNUNET_break (0);
+    return GNUNET_SYSERR;
+  }
   pc.iter = iter;
   pc.iter_cls = iter_cls;
   pc.zone_key = zone;
@@ -415,8 +448,10 @@ namestore_postgres_lookup_records (void *cls,
                                               params,
                                               &parse_result_call_iterator,
                                               &pc);
-  if (res <= 0)
+  if (res < 0)
     return GNUNET_SYSERR;
+  if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == res)
+    return GNUNET_NO;
   return GNUNET_OK;
 }
 
index b54b4dba246892a3c0340e29444cbd3efeb78cab..f62be1e18f8433538a19ebfdadd7427f024ba0b5 100644 (file)
@@ -311,7 +311,7 @@ database_setup (struct Plugin *plugin)
         sq_prepare (plugin->dbh,
                     "SELECT uid,record_count,record_data,label,zone_private_key"
                     " FROM ns098records"
-                   " WHERE _rowid_ >= ?" 
+                   " WHERE _rowid_ >= ?"
                    " ORDER BY _rowid_ ASC"
                    " LIMIT ?",
                     &plugin->iterate_all_zones))  ||
@@ -551,7 +551,7 @@ get_records_and_call_iterator (struct Plugin *plugin,
   int sret;
 
   ret = GNUNET_OK;
-  for (uint64_t i = 0;i<limit ; i++)
+  for (uint64_t i = 0;i<limit;i++)
   {
     sret = sqlite3_step (stmt);
 
@@ -570,7 +570,7 @@ get_records_and_call_iterator (struct Plugin *plugin,
       ret = GNUNET_SYSERR;
       break;
     }
-    
+
     {
       uint64_t seq;
       uint32_t record_count;
@@ -658,7 +658,7 @@ get_records_and_call_iterator (struct Plugin *plugin,
  * @param label name of the record in the zone
  * @param iter function to call with the result
  * @param iter_cls closure for @a iter
- * @return #GNUNET_OK on success, else #GNUNET_SYSERR
+ * @return #GNUNET_OK on success, #GNUNET_NO for no results, else #GNUNET_SYSERR
  */
 static int
 namestore_sqlite_lookup_records (void *cls,
@@ -675,7 +675,10 @@ namestore_sqlite_lookup_records (void *cls,
   };
 
   if (NULL == zone)
+  {
+    GNUNET_break (0);
     return GNUNET_SYSERR;
+  }
   if (GNUNET_OK !=
       GNUNET_SQ_bind (plugin->lookup_label,
                       params))
index 26e2f2c5102c4c715523ecae5e4c177f57d42a12..49fe2546837bc62c715e3bf1ee6aee43d36d254f 100644 (file)
@@ -2,6 +2,3 @@
 
 [namestore]
 DATABASE = flat
-
-[namecache]
-DISABLE = YES
index de958cee21e9a5840ec16da63487d6b74da5f815..50d1fd9a9c6a42c583413268ad806011df6eb927 100644 (file)
@@ -18,8 +18,8 @@
      Boston, MA 02110-1301, USA.
 */
 /**
- * @file namestore/test_namestore_api_store.c
- * @brief testcase for namestore_api.c: store a record
+ * @file namestore/test_namestore_api_lookup_nick.c
+ * @brief testcase for namestore_api.c: NICK records
  */
 #include "platform.h"
 #include "gnunet_namestore_service.h"
@@ -317,15 +317,23 @@ run (void *cls,
 int
 main (int argc, char *argv[])
 {
+  const char *plugin_name;
+  char *cfg_name;
+
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  GNUNET_asprintf (&cfg_name,
+                   "test_namestore_api_%s.conf",
+                   plugin_name);
   res = 1;
   if (0 !=
-      GNUNET_TESTING_peer_run ("test-namestore-api",
-                               "test_namestore_api.conf",
+      GNUNET_TESTING_peer_run ("test-namestore-api-lookup-nick",
+                               cfg_name,
                                &run,
                                NULL))
   {
     res = 1;
   }
+  GNUNET_free (cfg_name);
   if (NULL != directory)
   {
       GNUNET_DISK_directory_remove (directory);
index 57505c48bfffbae836d0a4ff56bfeaac1c2f9f74..7866749f1ae43f40b43874e79e4ae13020f907b0 100644 (file)
@@ -230,15 +230,23 @@ run (void *cls,
 int
 main (int argc, char *argv[])
 {
+  const char *plugin_name;
+  char *cfg_name;
+
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  GNUNET_asprintf (&cfg_name,
+                   "test_namestore_api_%s.conf",
+                   plugin_name);
   res = 1;
   if (0 !=
-      GNUNET_TESTING_peer_run ("test-namestore-api",
-                               "test_namestore_api.conf",
+      GNUNET_TESTING_peer_run ("test-namestore-api-lookup-private",
+                               cfg_name,
                                &run,
                                NULL))
   {
     res = 1;
   }
+  GNUNET_free (cfg_name);
   if (NULL != directory)
   {
       GNUNET_DISK_directory_remove (directory);
@@ -248,4 +256,4 @@ main (int argc, char *argv[])
 }
 
 
-/* end of test_namestore_api_store.c */
+/* end of test_namestore_api_lookup_private.c */
index 09d6b302d7df0228ef70cc1ea93824e922f5852d..02ca16042006c8036bd93a429e8e5d59a4970521 100644 (file)
@@ -237,15 +237,23 @@ run (void *cls,
 int
 main (int argc, char *argv[])
 {
+  const char *plugin_name;
+  char *cfg_name;
+
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  GNUNET_asprintf (&cfg_name,
+                   "test_namestore_api_%s.conf",
+                   plugin_name);
   res = 1;
   if (0 !=
       GNUNET_TESTING_peer_run ("test-namestore-api",
-                               "test_namestore_api.conf",
+                               cfg_name,
                                &run,
                                NULL))
   {
     res = 1;
   }
+  GNUNET_free (cfg_name);
   if (NULL != directory)
   {
       GNUNET_DISK_directory_remove (directory);
index 7f9a9070478961863a7a2780b2be71c7a4bdd7b6..e8033579646ea880fa74fddb42b73b4ae5436cf2 100644 (file)
@@ -18,7 +18,7 @@
      Boston, MA 02110-1301, USA.
 */
 /**
- * @file namestore/test_namestore_api_lookup_shadow_filter.c
+ * @file namestore/test_namestore_api_lookup_shadow.c
  * @brief testcase for namestore_api.c: store a shadow record and perform a lookup
  * test passes if test returns the record but without the shadow flag since no
  * other valid record is available
@@ -267,15 +267,23 @@ run (void *cls,
 int
 main (int argc, char *argv[])
 {
+  const char *plugin_name;
+  char *cfg_name;
+
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  GNUNET_asprintf (&cfg_name,
+                   "test_namestore_api_%s.conf",
+                   plugin_name);
   res = 1;
   if (0 !=
-      GNUNET_TESTING_peer_run ("test-namestore-api",
-                               "test_namestore_api.conf",
+      GNUNET_TESTING_peer_run ("test-namestore-api-lookup-shadow",
+                               cfg_name,
                                &run,
                                NULL))
   {
     res = 1;
   }
+  GNUNET_free (cfg_name);
   if (NULL != directory)
   {
       GNUNET_DISK_directory_remove (directory);
@@ -285,4 +293,4 @@ main (int argc, char *argv[])
 }
 
 
-/* end of test_namestore_api_lookup_shadow_filter.c */
+/* end of test_namestore_api_lookup_shadow.c */
index a22baa17b45479ffbf61d155ffa3496601573cf9..5b8811a2315a8babe80d5701bb074b6e29b4d0a9 100644 (file)
@@ -345,15 +345,23 @@ run (void *cls,
 int
 main (int argc, char *argv[])
 {
+  const char *plugin_name;
+  char *cfg_name;
+
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  GNUNET_asprintf (&cfg_name,
+                   "test_namestore_api_%s.conf",
+                   plugin_name);
   res = 1;
   if (0 !=
-      GNUNET_TESTING_peer_run ("test-namestore-api",
-                               "test_namestore_api.conf",
+      GNUNET_TESTING_peer_run ("test-namestore-api-lookup-shadow-filter",
+                               cfg_name,
                                &run,
                                NULL))
   {
     res = 1;
   }
+  GNUNET_free (cfg_name);
   if (NULL != directory)
   {
       GNUNET_DISK_directory_remove (directory);
index 68a3e4fb8dfd5813c2f08324baade88de942b7ff..f6d4fe2263487bed2fe2c0b881ee665931f3b102 100644 (file)
@@ -374,15 +374,23 @@ run (void *cls,
 int
 main (int argc, char *argv[])
 {
+  const char *plugin_name;
+  char *cfg_name;
+
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  GNUNET_asprintf (&cfg_name,
+                   "test_namestore_api_%s.conf",
+                   plugin_name);
   res = 1;
   if (0 !=
       GNUNET_TESTING_peer_run ("test-namestore-api-monitoring",
-                               "test_namestore_api.conf",
+                               cfg_name,
                                &run,
                                NULL))
   {
     res = 1;
   }
+  GNUNET_free (cfg_name);
   if (NULL != directory)
   {
       GNUNET_DISK_directory_remove (directory);
index 374ad44dd604d8ff5fbb5bbd64e9177c88cac700..17f726eb1377f90ebb5b4a60cbb3a30b73b4a1c1 100644 (file)
@@ -368,15 +368,23 @@ run (void *cls,
 int
 main (int argc, char *argv[])
 {
+  const char *plugin_name;
+  char *cfg_name;
+
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  GNUNET_asprintf (&cfg_name,
+                   "test_namestore_api_%s.conf",
+                   plugin_name);
   res = 1;
   if (0 !=
-      GNUNET_TESTING_peer_run ("test-namestore-api-monitoring",
-                               "test_namestore_api.conf",
+      GNUNET_TESTING_peer_run ("test-namestore-api-monitoring-existing",
+                               cfg_name,
                                &run,
                                NULL))
   {
     res = 1;
   }
+  GNUNET_free (cfg_name);
   if (NULL != directory)
   {
       GNUNET_DISK_directory_remove (directory);
@@ -386,4 +394,4 @@ main (int argc, char *argv[])
 }
 
 
-/* end of test_namestore_api_monitoring.c */
+/* end of test_namestore_api_monitoring_existing.c */
index 259ce35e73834e6635f3d46ab873888698cee769..397cb4b2f6283b64437088495818eaf1983ab92d 100644 (file)
@@ -2,6 +2,3 @@
 
 [namestore]
 DATABASE = postgres
-
-[namecache]
-DISABLE = YES
index 2d670c1ee47ac2874c0852334d7193d3984a97d6..532a751da4f7dab49e8a6df99b94713bf5345371 100644 (file)
@@ -120,7 +120,8 @@ remove_cont (void *cls,
 
 
 static void
-put_cont (void *cls, int32_t success,
+put_cont (void *cls,
+          int32_t success,
          const char *emsg)
 {
   const char *name = cls;
@@ -161,20 +162,27 @@ run (void *cls,
 
   directory = NULL;
   GNUNET_assert (GNUNET_OK ==
-                 GNUNET_CONFIGURATION_get_value_string(cfg, "PATHS", "GNUNET_TEST_HOME", &directory));
+                 GNUNET_CONFIGURATION_get_value_string(cfg,
+                                                       "PATHS",
+                                                       "GNUNET_TEST_HOME",
+                                                       &directory));
   GNUNET_DISK_directory_remove (directory);
 
   endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
-                                               &endbadly, NULL);
+                                               &endbadly,
+                                                NULL);
   GNUNET_asprintf (&hostkey_file,
                   "zonefiles%s%s",
                   DIR_SEPARATOR_STR,
                   "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey");
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Using zonekey file `%s' \n",
+              hostkey_file);
   privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file);
   GNUNET_free (hostkey_file);
   GNUNET_assert (privkey != NULL);
-  GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey);
+  GNUNET_CRYPTO_ecdsa_key_get_public (privkey,
+                                      &pubkey);
 
   removed = GNUNET_NO;
 
@@ -201,15 +209,23 @@ run (void *cls,
 int
 main (int argc, char *argv[])
 {
+  const char *plugin_name;
+  char *cfg_name;
+
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  GNUNET_asprintf (&cfg_name,
+                   "test_namestore_api_%s.conf",
+                   plugin_name);
   res = 1;
   if (0 !=
-      GNUNET_TESTING_peer_run ("test-namestore-api",
-                               "test_namestore_api.conf",
+      GNUNET_TESTING_peer_run ("test-namestore-api-remove",
+                               cfg_name,
                                &run,
                                NULL))
   {
     res = 1;
   }
+  GNUNET_free (cfg_name);
   if (NULL != directory)
   {
       GNUNET_DISK_directory_remove (directory);
index ef199cdf601155a57297a737e28005ce007f72ea..2f20c3636f4de0eae99db0f314c9e238fe036d7d 100644 (file)
@@ -167,15 +167,23 @@ run (void *cls,
 int
 main (int argc, char *argv[])
 {
+  const char *plugin_name;
+  char *cfg_name;
+
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  GNUNET_asprintf (&cfg_name,
+                   "test_namestore_api_%s.conf",
+                   plugin_name);
   res = 1;
   if (0 !=
-      GNUNET_TESTING_peer_run ("test-namestore-api",
-                               "test_namestore_api.conf",
+      GNUNET_TESTING_peer_run ("test-namestore-api-remove-non-existing-record",
+                               cfg_name,
                                &run,
                                NULL))
   {
     res = 1;
   }
+  GNUNET_free (cfg_name);
   if (NULL != directory)
   {
       GNUNET_DISK_directory_remove (directory);
index 72b609226a16ac1066761316c8fa14835bfa5052..5416daec388411e4f8a28d7382ec7353d6be1883 100644 (file)
@@ -1,4 +1,4 @@
 @INLINE@ test_namestore_api.conf
 
-[namecache]
-DISABLE = YES
+[namestore]
+DATABASE = sqlite
index d80676770180898c6bf0fd0955d136c19e5f3b1a..4e51678a18261f39b4fffa893ea5782f76263304 100644 (file)
@@ -159,15 +159,23 @@ run (void *cls,
 int
 main (int argc, char *argv[])
 {
+  const char *plugin_name;
+  char *cfg_name;
+
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  GNUNET_asprintf (&cfg_name,
+                   "test_namestore_api_%s.conf",
+                   plugin_name);
   res = 1;
   if (0 !=
       GNUNET_TESTING_peer_run ("test-namestore-api",
-                               "test_namestore_api.conf",
+                               cfg_name,
                                &run,
                                NULL))
   {
     res = 1;
   }
+  GNUNET_free (cfg_name);
   if (NULL != directory)
   {
     GNUNET_DISK_directory_remove (directory);
index ed5a399bd2f562c96a72358f79d2f574484356b9..0a4551f217235e8c762ef8da807ba8fb1e0ecef9 100644 (file)
@@ -274,15 +274,23 @@ run (void *cls,
 int
 main (int argc, char *argv[])
 {
+  const char *plugin_name;
+  char *cfg_name;
+
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  GNUNET_asprintf (&cfg_name,
+                   "test_namestore_api_%s.conf",
+                   plugin_name);
   res = 1;
   if (0 !=
       GNUNET_TESTING_peer_run ("test-namestore-api-store-update",
-                               "test_namestore_api.conf",
+                               cfg_name,
                                &run,
                                NULL))
   {
     res = 1;
   }
+  GNUNET_free (cfg_name);
   if (NULL != directory)
   {
       GNUNET_DISK_directory_remove (directory);
index 1343d42bf340a1570c3251633bae1e2e44ccd226..806605d94e0654d34dc19b97e71aacb16cec437a 100644 (file)
@@ -487,15 +487,23 @@ run (void *cls,
 int
 main (int argc, char *argv[])
 {
+  const char *plugin_name;
+  char *cfg_name;
+
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  GNUNET_asprintf (&cfg_name,
+                   "test_namestore_api_%s.conf",
+                   plugin_name);
   res = 1;
   if (0 !=
       GNUNET_TESTING_peer_run ("test-namestore-api-zone-iteration",
-                               "test_namestore_api.conf",
+                               cfg_name,
                                &run,
                                NULL))
   {
     res = 1;
   }
+  GNUNET_free (cfg_name);
   if (NULL != directory)
   {
       GNUNET_DISK_directory_remove (directory);
index 395d1854f0ccfe48d6c0928a68a3912d8e01fbfe..a8864686458db7d525f1de1c82c3da4275c6c08d 100644 (file)
@@ -490,15 +490,23 @@ run (void *cls,
 int
 main (int argc, char *argv[])
 {
+  const char *plugin_name;
+  char *cfg_name;
+
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  GNUNET_asprintf (&cfg_name,
+                   "test_namestore_api_%s.conf",
+                   plugin_name);
   res = 1;
   if (0 !=
-      GNUNET_TESTING_peer_run ("test-namestore-api-zone-iteration",
-                               "test_namestore_api.conf",
+      GNUNET_TESTING_peer_run ("test-namestore-api-zone-iteration-nick",
+                               cfg_name,
                                &run,
                                NULL))
   {
     res = 1;
   }
+  GNUNET_free (cfg_name);
   if (NULL != directory)
   {
       GNUNET_DISK_directory_remove (directory);
index d222bf16ccc9353294cb61fe29341da3a5659c10..a4fb320e914656e563a49034be331cf4540c235b 100644 (file)
@@ -485,15 +485,23 @@ run (void *cls,
 int
 main (int argc, char *argv[])
 {
+  const char *plugin_name;
+  char *cfg_name;
+
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  GNUNET_asprintf (&cfg_name,
+                   "test_namestore_api_%s.conf",
+                   plugin_name);
   res = 1;
   if (0 !=
-      GNUNET_TESTING_peer_run ("test-namestore-api-zone-iteration",
-                               "test_namestore_api.conf",
+      GNUNET_TESTING_peer_run ("test-namestore-api-zone-iteration-specific-zone",
+                               cfg_name,
                                &run,
                                NULL))
   {
     res = 1;
   }
+  GNUNET_free (cfg_name);
   if (NULL != directory)
   {
       GNUNET_DISK_directory_remove (directory);
index d23a5f4cb59c77c7b5fd44f0c6b6ecce14ead1b2..c7be5feadd3bd61055a2490af85e9cda0864fd3a 100644 (file)
@@ -508,15 +508,23 @@ run (void *cls,
 int
 main (int argc, char *argv[])
 {
+  const char *plugin_name;
+  char *cfg_name;
+
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  GNUNET_asprintf (&cfg_name,
+                   "test_namestore_api_%s.conf",
+                   plugin_name);
   res = 1;
   if (0 !=
       GNUNET_TESTING_peer_run ("test-namestore-api-zone-iteration-stop",
-                               "test_namestore_api.conf",
+                               cfg_name,
                                &run,
                                NULL))
   {
     res = 1;
   }
+  GNUNET_free (cfg_name);
   if (NULL != directory)
   {
       GNUNET_DISK_directory_remove (directory);
index 2bc7d34a3bb1f8396ca135988fe83d5e0b1741cb..5b088d90b0f1be7dc7db909b500731de0736fd09 100644 (file)
@@ -221,7 +221,7 @@ run (void *cls,
   /* load privat key */
   {
     char *zonekey_file;
-  
+
     GNUNET_asprintf (&zonekey_file,
                     "zonefiles%s%s",
                     DIR_SEPARATOR_STR,
@@ -242,13 +242,13 @@ run (void *cls,
                              sizeof (s_zone_value));
   {
     struct GNUNET_GNSRECORD_Data rd;
-    
+
     rd.expiration_time = GNUNET_TIME_absolute_get().abs_value_us;
     rd.record_type = GNUNET_GNSRECORD_TYPE_PKEY;
     rd.data_size = sizeof (s_zone_value);
     rd.data = &s_zone_value;
     rd.flags = 0;
-    
+
     nsh = GNUNET_NAMESTORE_connect (cfg);
     GNUNET_break (NULL != nsh);
     GNUNET_NAMESTORE_records_store (nsh,
@@ -266,17 +266,24 @@ int
 main (int argc,
       char *argv[])
 {
+  const char *plugin_name;
+  char *cfg_name;
+
   (void) argc;
-  (void) argv;
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  GNUNET_asprintf (&cfg_name,
+                   "test_namestore_api_%s.conf",
+                   plugin_name);
   res = 1;
   if (0 !=
       GNUNET_TESTING_peer_run ("test-namestore-api-zone-to-name",
-                               "test_namestore_api.conf",
+                               cfg_name,
                                &run,
                                NULL))
   {
     res = 1;
   }
+  GNUNET_free (cfg_name);
   if (NULL != directory)
   {
     GNUNET_DISK_directory_remove (directory);