aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-05-09 17:45:28 +0200
committerChristian Grothoff <christian@grothoff.org>2018-05-09 17:45:28 +0200
commit2cac1c7df7a50fdf9a3861d3f095eff9cfadc34a (patch)
tree821ddc2508237f6a72fdb7c6407f825cc61e634d /src
parent8bb475af99260f1d107dbc8908268ae93960aa83 (diff)
downloadgnunet-2cac1c7df7a50fdf9a3861d3f095eff9cfadc34a.tar.gz
gnunet-2cac1c7df7a50fdf9a3861d3f095eff9cfadc34a.zip
missed a few places
Diffstat (limited to 'src')
-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 49fe25468..6a28306e3 100644
--- a/src/namestore/test_namestore_api_flat.conf
+++ b/src/namestore/test_namestore_api_flat.conf
@@ -2,3 +2,6 @@
2 2
3[namestore] 3[namestore]
4DATABASE = flat 4DATABASE = flat
5
6[namestore-flat]
7FILENAME = $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 25c098fe3..3e9e70923 100644
--- a/src/namestore/test_namestore_api_monitoring_existing.c
+++ b/src/namestore/test_namestore_api_monitoring_existing.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2013 GNUnet e.V. 3 Copyright (C) 2013, 2018 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -18,7 +18,7 @@
18 Boston, MA 02110-1301, USA. 18 Boston, MA 02110-1301, USA.
19*/ 19*/
20/** 20/**
21 * @file namestore/test_namestore_api_monitoring.c 21 * @file namestore/test_namestore_api_monitoring_existing.c
22 * @brief testcase for zone monitoring functionality: add records first, then monitor 22 * @brief testcase for zone monitoring functionality: add records first, then monitor
23 */ 23 */
24#include "platform.h" 24#include "platform.h"
@@ -27,7 +27,7 @@
27#include "namestore.h" 27#include "namestore.h"
28 28
29 29
30#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100) 30#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
31 31
32static const struct GNUNET_CONFIGURATION_Handle *cfg; 32static const struct GNUNET_CONFIGURATION_Handle *cfg;
33 33
@@ -58,15 +58,29 @@ static struct GNUNET_GNSRECORD_Data *s_rd_3;
58struct GNUNET_NAMESTORE_QueueEntry * ns_ops[3]; 58struct GNUNET_NAMESTORE_QueueEntry * ns_ops[3];
59 59
60 60
61/**
62 * Re-establish the connection to the service.
63 *
64 * @param cls handle to use to re-connect.
65 */
66static void
67endbadly (void *cls)
68{
69 endbadly_task = NULL;
70 GNUNET_break (0);
71 GNUNET_SCHEDULER_shutdown ();
72 res = 1;
73}
74
75
61static void 76static void
62do_shutdown () 77end (void *cls)
63{ 78{
64 if (NULL != zm) 79 if (NULL != zm)
65 { 80 {
66 GNUNET_NAMESTORE_zone_monitor_stop (zm); 81 GNUNET_NAMESTORE_zone_monitor_stop (zm);
67 zm = NULL; 82 zm = NULL;
68 } 83 }
69
70 if (NULL != ns_ops[0]) 84 if (NULL != ns_ops[0])
71 { 85 {
72 GNUNET_NAMESTORE_cancel(ns_ops[0]); 86 GNUNET_NAMESTORE_cancel(ns_ops[0]);
@@ -82,7 +96,11 @@ do_shutdown ()
82 GNUNET_NAMESTORE_cancel(ns_ops[2]); 96 GNUNET_NAMESTORE_cancel(ns_ops[2]);
83 ns_ops[2] = NULL; 97 ns_ops[2] = NULL;
84 } 98 }
85 99 if (NULL != endbadly_task)
100 {
101 GNUNET_SCHEDULER_cancel (endbadly_task);
102 endbadly_task = NULL;
103 }
86 if (NULL != nsh) 104 if (NULL != nsh)
87 { 105 {
88 GNUNET_NAMESTORE_disconnect (nsh); 106 GNUNET_NAMESTORE_disconnect (nsh);
@@ -122,27 +140,6 @@ do_shutdown ()
122} 140}
123 141
124 142
125/**
126 * Re-establish the connection to the service.
127 *
128 * @param cls handle to use to re-connect.
129 */
130static void
131endbadly (void *cls)
132{
133 do_shutdown ();
134 res = 1;
135}
136
137
138static void
139end (void *cls)
140{
141 do_shutdown ();
142 res = 0;
143}
144
145
146static void 143static void
147zone_proc (void *cls, 144zone_proc (void *cls,
148 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 145 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key,
@@ -164,9 +161,7 @@ zone_proc (void *cls,
164 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 161 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
165 "Monitoring returned wrong zone key\n"); 162 "Monitoring returned wrong zone key\n");
166 GNUNET_break (0); 163 GNUNET_break (0);
167 GNUNET_SCHEDULER_cancel (endbadly_task); 164 GNUNET_SCHEDULER_shutdown ();
168 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly,
169 NULL);
170 return; 165 return;
171 } 166 }
172 167
@@ -201,17 +196,16 @@ zone_proc (void *cls,
201 1); 196 1);
202 if (2 == ++returned_records) 197 if (2 == ++returned_records)
203 { 198 {
204 if (endbadly_task != NULL) 199 GNUNET_SCHEDULER_shutdown ();
200 if (GNUNET_YES == fail)
205 { 201 {
206 GNUNET_SCHEDULER_cancel (endbadly_task); 202 GNUNET_break (0);
207 endbadly_task = NULL; 203 res = 1;
208 } 204 }
209 if (GNUNET_YES == fail)
210 GNUNET_SCHEDULER_add_now (&endbadly,
211 NULL);
212 else 205 else
213 GNUNET_SCHEDULER_add_now (&end, 206 {
214 NULL); 207 res = 0;
208 }
215 } 209 }
216} 210}
217 211
@@ -258,8 +252,9 @@ put_cont (void *cls,
258 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 252 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
259 "Failed to created records\n"); 253 "Failed to created records\n");
260 GNUNET_break (0); 254 GNUNET_break (0);
261 GNUNET_SCHEDULER_cancel (endbadly_task); 255 res = 1;
262 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); 256 GNUNET_SCHEDULER_shutdown ();
257 return;
263 } 258 }
264 259
265 if (3 == c) 260 if (3 == c)
@@ -279,8 +274,8 @@ put_cont (void *cls,
279 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 274 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
280 "Failed to create zone monitor\n"); 275 "Failed to create zone monitor\n");
281 GNUNET_break (0); 276 GNUNET_break (0);
282 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, 277 res = 1;
283 NULL); 278 GNUNET_SCHEDULER_shutdown ();
284 return; 279 return;
285 } 280 }
286 } 281 }
@@ -319,6 +314,8 @@ run (void *cls,
319 GNUNET_assert (privkey != NULL); 314 GNUNET_assert (privkey != NULL);
320 315
321 cfg = mycfg; 316 cfg = mycfg;
317 GNUNET_SCHEDULER_add_shutdown (&end,
318 NULL);
322 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 319 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
323 &endbadly, 320 &endbadly,
324 NULL); 321 NULL);
diff --git a/src/namestore/test_namestore_api_postgres.conf b/src/namestore/test_namestore_api_postgres.conf
index 397cb4b2f..9960e6315 100644
--- a/src/namestore/test_namestore_api_postgres.conf
+++ b/src/namestore/test_namestore_api_postgres.conf
@@ -2,3 +2,8 @@
2 2
3[namestore] 3[namestore]
4DATABASE = postgres 4DATABASE = postgres
5
6
7[namestore-postgres]
8CONFIG = connect_timeout=10; dbname=gnunetcheck
9TEMPORARY_TABLE = YES
diff --git a/src/namestore/test_namestore_api_sqlite.conf b/src/namestore/test_namestore_api_sqlite.conf
index 5416daec3..82663400a 100644
--- a/src/namestore/test_namestore_api_sqlite.conf
+++ b/src/namestore/test_namestore_api_sqlite.conf
@@ -2,3 +2,6 @@
2 2
3[namestore] 3[namestore]
4DATABASE = sqlite 4DATABASE = sqlite
5
6[namestore-sqlite]
7FILENAME = $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 c7be5fead..c7358fc6e 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;
56 56
57static struct GNUNET_GNSRECORD_Data *s_rd_3; 57static struct GNUNET_GNSRECORD_Data *s_rd_3;
58 58
59static char *directory;
60 59
61 60
62/** 61/**
@@ -475,14 +474,9 @@ run (void *cls,
475 const struct GNUNET_CONFIGURATION_Handle *cfg, 474 const struct GNUNET_CONFIGURATION_Handle *cfg,
476 struct GNUNET_TESTING_Peer *peer) 475 struct GNUNET_TESTING_Peer *peer)
477{ 476{
478 GNUNET_assert (GNUNET_OK == 477 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
479 GNUNET_CONFIGURATION_get_value_string (cfg, 478 &endbadly,
480 "PATHS", 479 NULL);
481 "GNUNET_TEST_HOME",
482 &directory));
483 GNUNET_DISK_directory_remove (directory);
484
485 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &endbadly, NULL);
486 nsh = GNUNET_NAMESTORE_connect (cfg); 480 nsh = GNUNET_NAMESTORE_connect (cfg);
487 GNUNET_break (NULL != nsh); 481 GNUNET_break (NULL != nsh);
488 /* first, iterate over empty namestore */ 482 /* first, iterate over empty namestore */
@@ -515,6 +509,8 @@ main (int argc, char *argv[])
515 GNUNET_asprintf (&cfg_name, 509 GNUNET_asprintf (&cfg_name,
516 "test_namestore_api_%s.conf", 510 "test_namestore_api_%s.conf",
517 plugin_name); 511 plugin_name);
512 GNUNET_DISK_purge_cfg_dir (cfg_name,
513 "GNUNET_TEST_HOME");
518 res = 1; 514 res = 1;
519 if (0 != 515 if (0 !=
520 GNUNET_TESTING_peer_run ("test-namestore-api-zone-iteration-stop", 516 GNUNET_TESTING_peer_run ("test-namestore-api-zone-iteration-stop",
@@ -524,12 +520,10 @@ main (int argc, char *argv[])
524 { 520 {
525 res = 1; 521 res = 1;
526 } 522 }
523 GNUNET_DISK_purge_cfg_dir (cfg_name,
524 "GNUNET_TEST_HOME");
527 GNUNET_free (cfg_name); 525 GNUNET_free (cfg_name);
528 if (NULL != directory) 526
529 {
530 GNUNET_DISK_directory_remove (directory);
531 GNUNET_free (directory);
532 }
533 return res; 527 return res;
534} 528}
535 529
diff --git a/src/namestore/test_plugin_namestore_flat.conf b/src/namestore/test_plugin_namestore_flat.conf
index 6a5491df7..5c632f0d1 100644
--- a/src/namestore/test_plugin_namestore_flat.conf
+++ b/src/namestore/test_plugin_namestore_flat.conf
@@ -1,5 +1,2 @@
1[namestore-flat] 1[namestore-flat]
2FILENAME = $GNUNET_TMP/gnunet-test-plugin-namestore-sqlite/flatdb 2FILENAME = $GNUNET_TMP/gnunet-test-plugin-namestore-flat/flatdb
3
4[namestore]
5# PREFIX = valgrind --log-file=/home/schanzen/dev/gnunet/src/namestore/vg_log