From a5e3e870f27c8ef3a3cd5d59a686a3050f9c64fb Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 1 May 2018 12:44:39 +0200 Subject: [PATCH] more extensive namestore tests for the non-sqlite plugins, with bugfixes --- src/include/gnunet_namestore_plugin.h | 2 +- src/namestore/Makefile.am | 420 +++++++++++++++--- src/namestore/gnunet-service-namestore.c | 11 +- src/namestore/perf_namestore_api_flat.conf | 7 + .../perf_namestore_api_postgres.conf | 7 + src/namestore/perf_namestore_api_sqlite.conf | 4 + .../perf_namestore_api_zone_iteration.c | 2 +- src/namestore/plugin_namestore_flat.c | 79 ++-- src/namestore/plugin_namestore_postgres.c | 41 +- src/namestore/plugin_namestore_sqlite.c | 11 +- src/namestore/test_namestore_api_flat.conf | 3 - .../test_namestore_api_lookup_nick.c | 16 +- .../test_namestore_api_lookup_private.c | 14 +- .../test_namestore_api_lookup_public.c | 10 +- .../test_namestore_api_lookup_shadow.c | 16 +- .../test_namestore_api_lookup_shadow_filter.c | 12 +- src/namestore/test_namestore_api_monitoring.c | 10 +- .../test_namestore_api_monitoring_existing.c | 14 +- .../test_namestore_api_postgres.conf | 3 - src/namestore/test_namestore_api_remove.c | 30 +- ...namestore_api_remove_not_existing_record.c | 12 +- src/namestore/test_namestore_api_sqlite.conf | 4 +- src/namestore/test_namestore_api_store.c | 10 +- .../test_namestore_api_store_update.c | 10 +- .../test_namestore_api_zone_iteration.c | 10 +- .../test_namestore_api_zone_iteration_nick.c | 12 +- ...mestore_api_zone_iteration_specific_zone.c | 12 +- .../test_namestore_api_zone_iteration_stop.c | 10 +- .../test_namestore_api_zone_to_name.c | 17 +- 29 files changed, 639 insertions(+), 170 deletions(-) create mode 100644 src/namestore/perf_namestore_api_flat.conf create mode 100644 src/namestore/perf_namestore_api_postgres.conf create mode 100644 src/namestore/perf_namestore_api_sqlite.conf 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 * @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, 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 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 \ 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, 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 index 000000000..26e2f2c51 --- /dev/null +++ b/src/namestore/perf_namestore_api_flat.conf @@ -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 index 000000000..259ce35e7 --- /dev/null +++ b/src/namestore/perf_namestore_api_postgres.conf @@ -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 index 000000000..72b609226 --- /dev/null +++ b/src/namestore/perf_namestore_api_sqlite.conf @@ -0,0 +1,4 @@ +@INLINE@ test_namestore_api.conf + +[namecache] +DISABLE = 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, 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 != 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, 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, 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, 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;idbh, + "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; } 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) 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;ilookup_label, 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 @@ [namestore] DATABASE = flat - -[namecache] -DISABLE = 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 @@ 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); 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, 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 */ 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, 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); 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 @@ 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 */ 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, 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); 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, 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); 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, 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 */ 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 @@ [namestore] DATABASE = postgres - -[namecache] -DISABLE = 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, 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); 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, 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); 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 @@ @INLINE@ test_namestore_api.conf -[namecache] -DISABLE = YES +[namestore] +DATABASE = 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, 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); 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, 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); 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, 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); 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, 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); 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, 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); 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, 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); 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, /* 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); -- 2.25.1