gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated (c751f585f -> 34ae70a81)


From: gnunet
Subject: [gnunet] branch master updated (c751f585f -> 34ae70a81)
Date: Tue, 04 Oct 2022 02:51:22 +0200

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a change to branch master
in repository gnunet.

    from c751f585f Merge branch 'master' of git+ssh://git.gnunet.org/gnunet
     new 1d28c7e16 NAMESTORE: Improve tests; fix reset/init bug
     new 34ae70a81 -gitignore

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/namestore/.gitignore                          |  2 ++
 src/namestore/perf_namestore_api_import.c         |  7 ++++---
 src/namestore/perf_namestore_api_postgres.conf    |  4 ++--
 src/namestore/plugin_namestore_postgres.c         | 12 ++++++++++--
 src/namestore/test_common.c                       | 17 ++++++++++++++++-
 src/namestore/test_plugin_namestore.c             |  8 ++++++++
 src/namestore/test_plugin_namestore_postgres.conf |  2 +-
 7 files changed, 43 insertions(+), 9 deletions(-)

diff --git a/src/namestore/.gitignore b/src/namestore/.gitignore
index 907361276..b26f32d1d 100644
--- a/src/namestore/.gitignore
+++ b/src/namestore/.gitignore
@@ -55,3 +55,5 @@ test_namestore_api_zone_to_name_sqlite
 test_namestore_api_tx_rollback_postgres
 test_namestore_api_tx_rollback_sqlite
 test_namestore_api_edit_records_postgres
+perf_namestore_api_import_sqlite
+perf_namestore_api_import_postgres
diff --git a/src/namestore/perf_namestore_api_import.c 
b/src/namestore/perf_namestore_api_import.c
index a2c989ebf..5822eb920 100644
--- a/src/namestore/perf_namestore_api_import.c
+++ b/src/namestore/perf_namestore_api_import.c
@@ -30,9 +30,9 @@
 
 #define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
 
-#define TEST_BATCH_COUNT 5
+#define TEST_BATCH_COUNT 3
 
-#define TEST_BATCH_SIZE 1000
+#define TEST_BATCH_SIZE 500
 
 #define TEST_RECORD_COUNT TEST_BATCH_COUNT * TEST_BATCH_SIZE
 
@@ -191,6 +191,7 @@ commit_cont (void *cls,
            TEST_RECORD_COUNT,
            GNUNET_STRINGS_relative_time_to_string (delay,
                                                    GNUNET_YES));
+  res = 0;
   GNUNET_SCHEDULER_shutdown ();
 }
 
@@ -437,7 +438,7 @@ main (int argc,
   const char *plugin_name;
   char *cfg_name;
 
-  SETUP_CFG (plugin_name, cfg_name);
+  SETUP_CFG2 ("perf_namestore_api_%s.conf", plugin_name, cfg_name);
   res = 1;
   if (0 !=
       GNUNET_TESTING_peer_run ("perf-namestore-api-import",
diff --git a/src/namestore/perf_namestore_api_postgres.conf 
b/src/namestore/perf_namestore_api_postgres.conf
index 12fc24d4b..5e02c2df3 100644
--- a/src/namestore/perf_namestore_api_postgres.conf
+++ b/src/namestore/perf_namestore_api_postgres.conf
@@ -1,4 +1,4 @@
-@INLINE@ test_namestore_api.conf
+@INLINE@ test_namestore_api_postgres.conf
 
 [namestore]
 DATABASE = postgres
@@ -8,5 +8,5 @@ DISABLE = YES
 
 [namestore-postgres]
 CONFIG = connect_timeout=10 dbname=gnunetcheck
-TEMPORARY_TABLE = YES
+#TEMPORARY_TABLE = YES
 INIT_ON_CONNECT = YES
diff --git a/src/namestore/plugin_namestore_postgres.c 
b/src/namestore/plugin_namestore_postgres.c
index 6e5c1c718..4ac817f42 100644
--- a/src/namestore/plugin_namestore_postgres.c
+++ b/src/namestore/plugin_namestore_postgres.c
@@ -762,7 +762,11 @@ static enum GNUNET_GenericReturnValue
 namestore_postgres_initialize_database (void *cls,
                                         char **emsg)
 {
-  return init_database (cls, emsg, GNUNET_NO);
+  int ret;
+  ret = init_database (cls, emsg, GNUNET_NO);
+  if (GNUNET_SYSERR == ret)
+    return ret;
+  return database_connect (cls);
 }
 
 
@@ -770,7 +774,11 @@ static enum GNUNET_GenericReturnValue
 namestore_postgres_reset_database (void *cls,
                                    char **emsg)
 {
-  return init_database (cls, emsg, GNUNET_YES);
+  int ret;
+  ret = init_database (cls, emsg, GNUNET_YES);
+  if (GNUNET_SYSERR == ret)
+    return ret;
+  return database_connect (cls);
 }
 
 
diff --git a/src/namestore/test_common.c b/src/namestore/test_common.c
index 24a88c180..fbcb51399 100644
--- a/src/namestore/test_common.c
+++ b/src/namestore/test_common.c
@@ -71,7 +71,22 @@ TNC_test_plugin (const char *cfg_name)
   return GNUNET_YES;
 }
 
-
+/**
+ * General setup logic for starting the tests.  Obtains the @a
+ * plugin_name and initializes the @a cfg_name.
+ */
+#define SETUP_CFG2(file_template, plugin_name, cfg_name)                       
             \
+  do                                                                        \
+  {                                                                         \
+    plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);    \
+    GNUNET_asprintf (&cfg_name, file_template, plugin_name); \
+    if (! TNC_test_plugin (cfg_name))                                       \
+    {                                                                       \
+      GNUNET_free (cfg_name);                                               \
+      return 77;                                                            \
+    }                                                                       \
+    GNUNET_DISK_purge_cfg_dir (cfg_name, "GNUNET_TEST_HOME");               \
+  } while (0)
 /**
  * General setup logic for starting the tests.  Obtains the @a
  * plugin_name and initializes the @a cfg_name.
diff --git a/src/namestore/test_plugin_namestore.c 
b/src/namestore/test_plugin_namestore.c
index baea0e444..cc0703238 100644
--- a/src/namestore/test_plugin_namestore.c
+++ b/src/namestore/test_plugin_namestore.c
@@ -66,6 +66,7 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
   struct GNUNET_NAMESTORE_PluginFunctions *ret;
   char *libname;
+  char *emsg;
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               _ ("Loading `%s' namestore plugin\n"),
@@ -78,6 +79,12 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg)
     return NULL;
   }
   GNUNET_free (libname);
+  if (GNUNET_OK != ret->reset_database (ret->cls, &emsg))
+  {
+    fprintf (stderr, "Error resetting database: %s\n", emsg);
+    GNUNET_free (emsg);
+    return NULL;
+  }
   return ret;
 }
 
@@ -101,6 +108,7 @@ test_record (void *cls,
   for (unsigned int i = 0; i < trd_count; i++)
   {
     GNUNET_assert (rd[i].data_size == id % 10);
+    printf ("%s\n", rd[i].data);
     GNUNET_assert (0 == memcmp ("Hello World", rd[i].data, id % 10));
     GNUNET_assert (rd[i].record_type == TEST_RECORD_TYPE);
     GNUNET_assert (rd[i].flags == 0);
diff --git a/src/namestore/test_plugin_namestore_postgres.conf 
b/src/namestore/test_plugin_namestore_postgres.conf
index 3b5cb8699..140d54623 100644
--- a/src/namestore/test_plugin_namestore_postgres.conf
+++ b/src/namestore/test_plugin_namestore_postgres.conf
@@ -1,4 +1,4 @@
 [namestore-postgres]
 CONFIG = connect_timeout=10 dbname=gnunetcheck
 INIT_ON_CONNECT = YES
-TEMPORARY_TABLE = YES
+#TEMPORARY_TABLE = YES

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]