aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/namestore/test_namestore_api_flat.conf3
-rw-r--r--src/namestore/test_namestore_api_monitoring_existing.c81
-rw-r--r--src/namestore/test_namestore_api_postgres.conf5
-rw-r--r--src/namestore/test_namestore_api_sqlite.conf3
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_stop.c22
-rw-r--r--src/namestore/test_plugin_namestore_flat.conf5
6 files changed, 59 insertions, 60 deletions
diff --git a/src/namestore/test_namestore_api_flat.conf b/src/namestore/test_namestore_api_flat.conf
index 49fe254683..6a28306e37 100644
--- a/src/namestore/test_namestore_api_flat.conf
+++ b/src/namestore/test_namestore_api_flat.conf
@@ -2,3 +2,6 @@
[namestore]
DATABASE = flat
+
+[namestore-flat]
+FILENAME = $GNUNET_TEST_HOME/namestore/flat.db
diff --git a/src/namestore/test_namestore_api_monitoring_existing.c b/src/namestore/test_namestore_api_monitoring_existing.c
index 25c098fe32..3e9e70923f 100644
--- a/src/namestore/test_namestore_api_monitoring_existing.c
+++ b/src/namestore/test_namestore_api_monitoring_existing.c
@@ -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);
diff --git a/src/namestore/test_namestore_api_postgres.conf b/src/namestore/test_namestore_api_postgres.conf
index 397cb4b2f6..9960e63155 100644
--- a/src/namestore/test_namestore_api_postgres.conf
+++ b/src/namestore/test_namestore_api_postgres.conf
@@ -2,3 +2,8 @@
[namestore]
DATABASE = postgres
+
+
+[namestore-postgres]
+CONFIG = connect_timeout=10; dbname=gnunetcheck
+TEMPORARY_TABLE = YES
diff --git a/src/namestore/test_namestore_api_sqlite.conf b/src/namestore/test_namestore_api_sqlite.conf
index 5416daec38..82663400aa 100644
--- a/src/namestore/test_namestore_api_sqlite.conf
+++ b/src/namestore/test_namestore_api_sqlite.conf
@@ -2,3 +2,6 @@
[namestore]
DATABASE = sqlite
+
+[namestore-sqlite]
+FILENAME = $GNUNET_TEST_HOME/namestore/sqlite_test.db
diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c b/src/namestore/test_namestore_api_zone_iteration_stop.c
index c7be5feadd..c7358fc6ea 100644
--- a/src/namestore/test_namestore_api_zone_iteration_stop.c
+++ b/src/namestore/test_namestore_api_zone_iteration_stop.c
@@ -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;
}
diff --git a/src/namestore/test_plugin_namestore_flat.conf b/src/namestore/test_plugin_namestore_flat.conf
index 6a5491df72..5c632f0d1e 100644
--- a/src/namestore/test_plugin_namestore_flat.conf
+++ b/src/namestore/test_plugin_namestore_flat.conf
@@ -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