missed a few places
authorChristian Grothoff <christian@grothoff.org>
Wed, 9 May 2018 15:45:28 +0000 (17:45 +0200)
committerChristian Grothoff <christian@grothoff.org>
Wed, 9 May 2018 15:45:28 +0000 (17:45 +0200)
src/namestore/test_namestore_api_flat.conf
src/namestore/test_namestore_api_monitoring_existing.c
src/namestore/test_namestore_api_postgres.conf
src/namestore/test_namestore_api_sqlite.conf
src/namestore/test_namestore_api_zone_iteration_stop.c
src/namestore/test_plugin_namestore_flat.conf

index 49fe2546837bc62c715e3bf1ee6aee43d36d254f..6a28306e3767f42b35f7263e94d98565cb7c6d47 100644 (file)
@@ -2,3 +2,6 @@
 
 [namestore]
 DATABASE = flat
+
+[namestore-flat]
+FILENAME = $GNUNET_TEST_HOME/namestore/flat.db
index 25c098fe325d1496acf86f41eab5efc3659bd05a..3e9e70923f0b8eecee4760e19afdc8ad27226d6b 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2013 GNUnet e.V.
+     Copyright (C) 2013, 2018 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -18,7 +18,7 @@
      Boston, MA 02110-1301, USA.
 */
 /**
- * @file namestore/test_namestore_api_monitoring.c
+ * @file namestore/test_namestore_api_monitoring_existing.c
  * @brief testcase for zone monitoring functionality: add records first, then monitor
  */
 #include "platform.h"
@@ -27,7 +27,7 @@
 #include "namestore.h"
 
 
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100)
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
 
 static const struct GNUNET_CONFIGURATION_Handle *cfg;
 
@@ -58,15 +58,29 @@ static struct GNUNET_GNSRECORD_Data *s_rd_3;
 struct GNUNET_NAMESTORE_QueueEntry * ns_ops[3];
 
 
+/**
+ * Re-establish the connection to the service.
+ *
+ * @param cls handle to use to re-connect.
+ */
+static void
+endbadly (void *cls)
+{
+  endbadly_task = NULL;
+  GNUNET_break (0);
+  GNUNET_SCHEDULER_shutdown ();
+  res = 1;
+}
+
+
 static void
-do_shutdown ()
+end (void *cls)
 {
   if (NULL != zm)
   {
     GNUNET_NAMESTORE_zone_monitor_stop (zm);
     zm = NULL;
   }
-
   if (NULL != ns_ops[0])
   {
     GNUNET_NAMESTORE_cancel(ns_ops[0]);
@@ -82,7 +96,11 @@ do_shutdown ()
     GNUNET_NAMESTORE_cancel(ns_ops[2]);
     ns_ops[2] = NULL;
   }
-
+  if (NULL != endbadly_task)
+  {
+    GNUNET_SCHEDULER_cancel (endbadly_task);
+    endbadly_task = NULL;
+  }
   if (NULL != nsh)
   {
     GNUNET_NAMESTORE_disconnect (nsh);
@@ -122,27 +140,6 @@ do_shutdown ()
 }
 
 
-/**
- * Re-establish the connection to the service.
- *
- * @param cls handle to use to re-connect.
- */
-static void
-endbadly (void *cls)
-{
-  do_shutdown ();
-  res = 1;
-}
-
-
-static void
-end (void *cls)
-{
-  do_shutdown ();
-  res = 0;
-}
-
-
 static void
 zone_proc (void *cls,
           const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key,
@@ -164,9 +161,7 @@ zone_proc (void *cls,
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Monitoring returned wrong zone key\n");
     GNUNET_break (0);
-    GNUNET_SCHEDULER_cancel (endbadly_task);
-    endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly,
-                                              NULL);
+    GNUNET_SCHEDULER_shutdown ();
     return;
   }
 
@@ -201,17 +196,16 @@ zone_proc (void *cls,
                                       1);
   if (2 == ++returned_records)
   {
-    if (endbadly_task != NULL)
+    GNUNET_SCHEDULER_shutdown ();
+    if (GNUNET_YES == fail)
     {
-      GNUNET_SCHEDULER_cancel (endbadly_task);
-      endbadly_task = NULL;
+      GNUNET_break (0);
+      res = 1;
     }
-    if (GNUNET_YES == fail)
-      GNUNET_SCHEDULER_add_now (&endbadly,
-                                NULL);
     else
-      GNUNET_SCHEDULER_add_now (&end,
-                                NULL);
+    {
+      res = 0;
+    }
   }
 }
 
@@ -258,8 +252,9 @@ put_cont (void *cls,
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Failed to created records\n");
     GNUNET_break (0);
-    GNUNET_SCHEDULER_cancel (endbadly_task);
-    endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
+    res = 1;
+    GNUNET_SCHEDULER_shutdown ();
+    return;
   }
 
   if (3 == c)
@@ -279,8 +274,8 @@ put_cont (void *cls,
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                   "Failed to create zone monitor\n");
       GNUNET_break (0);
-      endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly,
-                                                NULL);
+      res = 1;
+      GNUNET_SCHEDULER_shutdown ();
       return;
     }
   }
@@ -319,6 +314,8 @@ run (void *cls,
   GNUNET_assert (privkey != NULL);
 
   cfg = mycfg;
+  GNUNET_SCHEDULER_add_shutdown (&end,
+                                 NULL);
   endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
                                                 &endbadly,
                                                 NULL);
index 397cb4b2f6283b64437088495818eaf1983ab92d..9960e63155d190bba0b5f4710145f6e98d8e06d9 100644 (file)
@@ -2,3 +2,8 @@
 
 [namestore]
 DATABASE = postgres
+
+
+[namestore-postgres]
+CONFIG = connect_timeout=10; dbname=gnunetcheck
+TEMPORARY_TABLE = YES
index 5416daec388411e4f8a28d7382ec7353d6be1883..82663400aabd9317c310495216e7a14428db9503 100644 (file)
@@ -2,3 +2,6 @@
 
 [namestore]
 DATABASE = sqlite
+
+[namestore-sqlite]
+FILENAME = $GNUNET_TEST_HOME/namestore/sqlite_test.db
index c7be5feadd3bd61055a2490af85e9cda0864fd3a..c7358fc6eaa8d86c1beda61db6958b6c353cbd0e 100644 (file)
@@ -56,7 +56,6 @@ static char * s_name_3;
 
 static struct GNUNET_GNSRECORD_Data *s_rd_3;
 
-static char *directory;
 
 
 /**
@@ -475,14 +474,9 @@ run (void *cls,
      const struct GNUNET_CONFIGURATION_Handle *cfg,
      struct GNUNET_TESTING_Peer *peer)
 {
-  GNUNET_assert (GNUNET_OK ==
-                 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_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
+                                                &endbadly,
+                                                NULL);
   nsh = GNUNET_NAMESTORE_connect (cfg);
   GNUNET_break (NULL != nsh);
   /* first, iterate over empty namestore */
@@ -515,6 +509,8 @@ main (int argc, char *argv[])
   GNUNET_asprintf (&cfg_name,
                    "test_namestore_api_%s.conf",
                    plugin_name);
+  GNUNET_DISK_purge_cfg_dir (cfg_name,
+                             "GNUNET_TEST_HOME");
   res = 1;
   if (0 !=
       GNUNET_TESTING_peer_run ("test-namestore-api-zone-iteration-stop",
@@ -524,12 +520,10 @@ main (int argc, char *argv[])
   {
     res = 1;
   }
+  GNUNET_DISK_purge_cfg_dir (cfg_name,
+                             "GNUNET_TEST_HOME");
   GNUNET_free (cfg_name);
-  if (NULL != directory)
-  {
-      GNUNET_DISK_directory_remove (directory);
-      GNUNET_free (directory);
-  }
+
   return res;
 }
 
index 6a5491df728f834b8e12c06b389fd31c69e8eaed..5c632f0d1e3ae37c3d37e7d5bab14fb9f7c45ba7 100644 (file)
@@ -1,5 +1,2 @@
 [namestore-flat]
-FILENAME = $GNUNET_TMP/gnunet-test-plugin-namestore-sqlite/flatdb
-
-[namestore]
-# PREFIX = valgrind --log-file=/home/schanzen/dev/gnunet/src/namestore/vg_log
+FILENAME = $GNUNET_TMP/gnunet-test-plugin-namestore-flat/flatdb