aboutsummaryrefslogtreecommitdiff
path: root/src/testing/test_testing_topology.c
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-06-28 12:21:40 +0000
committerNathan S. Evans <evans@in.tum.de>2010-06-28 12:21:40 +0000
commit134afc9acfb4b12c84cdf8b56b2eabb856fde3e7 (patch)
treef62956e6c9ac0b39f37afc101270ce8660004831 /src/testing/test_testing_topology.c
parent59ca0059f61b1e2538f2890625601a88b2119f66 (diff)
downloadgnunet-134afc9acfb4b12c84cdf8b56b2eabb856fde3e7.tar.gz
gnunet-134afc9acfb4b12c84cdf8b56b2eabb856fde3e7.zip
callback for peergroup shutdown in testing, requisite testcase changes
Diffstat (limited to 'src/testing/test_testing_topology.c')
-rw-r--r--src/testing/test_testing_topology.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/src/testing/test_testing_topology.c b/src/testing/test_testing_topology.c
index d7bb836e9..ba9084e31 100644
--- a/src/testing/test_testing_topology.c
+++ b/src/testing/test_testing_topology.c
@@ -25,7 +25,7 @@
25#include "gnunet_testing_lib.h" 25#include "gnunet_testing_lib.h"
26#include "gnunet_core_service.h" 26#include "gnunet_core_service.h"
27 27
28#define VERBOSE GNUNET_YES 28#define VERBOSE GNUNET_NO
29 29
30/** 30/**
31 * How long until we fail the whole testcase? 31 * How long until we fail the whole testcase?
@@ -137,6 +137,30 @@ struct TestMessageContext
137 137
138static struct TestMessageContext *test_messages; 138static struct TestMessageContext *test_messages;
139 139
140/**
141 * Check whether peers successfully shut down.
142 */
143void shutdown_callback (void *cls,
144 const char *emsg)
145{
146 if (emsg != NULL)
147 {
148#if VERBOSE
149 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
150 "Shutdown of peers failed!\n");
151#endif
152 if (ok == 0)
153 ok = 666;
154 }
155 else
156 {
157#if VERBOSE
158 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
159 "All peers successfully shut down!\n");
160#endif
161 }
162}
163
140static void 164static void
141finish_testing () 165finish_testing ()
142{ 166{
@@ -179,11 +203,8 @@ finish_testing ()
179 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 203 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
180 "Calling daemons_stop\n"); 204 "Calling daemons_stop\n");
181#endif 205#endif
182 GNUNET_TESTING_daemons_stop (pg, TIMEOUT); 206 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
183#if VERBOSE 207
184 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
185 "daemons_stop finished\n");
186#endif
187 if (dotOutFile != NULL) 208 if (dotOutFile != NULL)
188 { 209 {
189 fprintf(dotOutFile, "}"); 210 fprintf(dotOutFile, "}");
@@ -282,7 +303,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
282 303
283 if (pg != NULL) 304 if (pg != NULL)
284 { 305 {
285 GNUNET_TESTING_daemons_stop (pg, TIMEOUT); 306 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
286 ok = 7331; /* Opposite of leet */ 307 ok = 7331; /* Opposite of leet */
287 } 308 }
288 else 309 else
@@ -295,8 +316,6 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
295 } 316 }
296} 317}
297 318
298
299
300static size_t 319static size_t
301transmit_ready (void *cls, size_t size, void *buf) 320transmit_ready (void *cls, size_t size, void *buf)
302{ 321{