aboutsummaryrefslogtreecommitdiff
path: root/src/testbed
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2012-08-31 07:52:40 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2012-08-31 07:52:40 +0000
commit1a29a996fa7071cd798fbd75c85edbd6daaaeb3c (patch)
treebffd2fb0ae30b7d51bd670702c619b34d25942d2 /src/testbed
parent970b7619ab2c7cbaad1d8b0cb365faef97fdb0e5 (diff)
downloadgnunet-1a29a996fa7071cd798fbd75c85edbd6daaaeb3c.tar.gz
gnunet-1a29a996fa7071cd798fbd75c85edbd6daaaeb3c.zip
Removed RunHandle return from GNUNET_TESTBED_run
Diffstat (limited to 'src/testbed')
-rw-r--r--src/testbed/gnunet-service-testbed.c2
-rw-r--r--src/testbed/test_testbed_api_testbed_run.c35
-rw-r--r--src/testbed/testbed_api_testbed.c208
-rw-r--r--src/testbed/x64_misc.supp24
4 files changed, 156 insertions, 113 deletions
diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c
index ef0ce2d0b..560740315 100644
--- a/src/testbed/gnunet-service-testbed.c
+++ b/src/testbed/gnunet-service-testbed.c
@@ -1898,7 +1898,7 @@ handle_peer_stop (void *cls,
1898 GNUNET_TESTING_peer_stop (peer->details.local.peer)) 1898 GNUNET_TESTING_peer_stop (peer->details.local.peer))
1899 { 1899 {
1900 send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id), 1900 send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
1901 "Failed to stop peer"); 1901 "Peer not running");
1902 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1902 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1903 return; 1903 return;
1904 } 1904 }
diff --git a/src/testbed/test_testbed_api_testbed_run.c b/src/testbed/test_testbed_api_testbed_run.c
index dc6bd1ea6..b9fd60d35 100644
--- a/src/testbed/test_testbed_api_testbed_run.c
+++ b/src/testbed/test_testbed_api_testbed_run.c
@@ -29,9 +29,14 @@
29#include "gnunet_testbed_service.h" 29#include "gnunet_testbed_service.h"
30 30
31/** 31/**
32 * Testbed run handle 32 * Number of peers we want to start
33 */ 33 */
34static struct GNUNET_TESTBED_RunHandle *rh; 34#define NUM_PEERS 2
35
36/**
37 * The array of peers; we fill this as the peers are given to us by the testbed
38 */
39static struct GNUNET_TESTBED_Peer *peers[NUM_PEERS];
35 40
36/** 41/**
37 * Abort task identifier 42 * Abort task identifier
@@ -39,6 +44,11 @@ static struct GNUNET_TESTBED_RunHandle *rh;
39static GNUNET_SCHEDULER_TaskIdentifier abort_task; 44static GNUNET_SCHEDULER_TaskIdentifier abort_task;
40 45
41/** 46/**
47 * Current peer id
48 */
49unsigned int peer_id;
50
51/**
42 * Testing result 52 * Testing result
43 */ 53 */
44static int result; 54static int result;
@@ -55,8 +65,7 @@ do_shutdown (void *cls, const const struct GNUNET_SCHEDULER_TaskContext *tc)
55{ 65{
56 if (GNUNET_SCHEDULER_NO_TASK != abort_task) 66 if (GNUNET_SCHEDULER_NO_TASK != abort_task)
57 GNUNET_SCHEDULER_cancel (abort_task); 67 GNUNET_SCHEDULER_cancel (abort_task);
58 if (NULL != rh) 68 GNUNET_SCHEDULER_shutdown ();
59 GNUNET_TESTBED_shutdown_run (rh);
60} 69}
61 70
62 71
@@ -67,7 +76,7 @@ do_shutdown (void *cls, const const struct GNUNET_SCHEDULER_TaskContext *tc)
67 * @param tc the task context 76 * @param tc the task context
68 */ 77 */
69static void 78static void
70do_abort (void *cls, const const struct GNUNET_SCHEDULER_TaskContext *tc) 79do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
71{ 80{
72 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n"); 81 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n");
73 abort_task = GNUNET_SCHEDULER_NO_TASK; 82 abort_task = GNUNET_SCHEDULER_NO_TASK;
@@ -101,9 +110,17 @@ static void
101controller_event_cb (void *cls, 110controller_event_cb (void *cls,
102 const struct GNUNET_TESTBED_EventInformation *event) 111 const struct GNUNET_TESTBED_EventInformation *event)
103{ 112{
104 if (GNUNET_TESTBED_ET_PEER_START == event->type) 113
105 return; 114 switch (event->type)
106 GNUNET_break (0); 115 {
116 case GNUNET_TESTBED_ET_PEER_START:
117 GNUNET_assert (NULL == peers[peer_id]);
118 GNUNET_assert (NULL != event->details.peer_start.peer);
119 peers[peer_id++] = event->details.peer_start.peer;
120 break;
121 default:
122 GNUNET_break (0);
123 }
107} 124}
108 125
109 126
@@ -127,7 +144,7 @@ run (void *cls, char *const *args, const char *cfgfile,
127 event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT); 144 event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT);
128 event_mask |= (1LL << GNUNET_TESTBED_ET_DISCONNECT); 145 event_mask |= (1LL << GNUNET_TESTBED_ET_DISCONNECT);
129 event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED); 146 event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
130 rh = GNUNET_TESTBED_run (NULL, config, 2, event_mask, &controller_event_cb, 147 GNUNET_TESTBED_run (NULL, config, 2, event_mask, &controller_event_cb,
131 NULL, &master_task, NULL); 148 NULL, &master_task, NULL);
132 abort_task = GNUNET_SCHEDULER_add_delayed 149 abort_task = GNUNET_SCHEDULER_add_delayed
133 (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5), &do_abort, NULL); 150 (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5), &do_abort, NULL);
diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c
index 95eb5d093..e20b3a10a 100644
--- a/src/testbed/testbed_api_testbed.c
+++ b/src/testbed/testbed_api_testbed.c
@@ -56,7 +56,7 @@ struct DLLOperation
56 /** 56 /**
57 * Context information for GNUNET_TESTBED_run() 57 * Context information for GNUNET_TESTBED_run()
58 */ 58 */
59 struct GNUNET_TESTBED_RunHandle *rh; 59 struct RunContext *rc;
60 60
61 /** 61 /**
62 * Closure 62 * Closure
@@ -78,7 +78,7 @@ struct DLLOperation
78/** 78/**
79 * Testbed Run Handle 79 * Testbed Run Handle
80 */ 80 */
81struct GNUNET_TESTBED_RunHandle 81struct RunContext
82{ 82{
83 /** 83 /**
84 * The controller handle 84 * The controller handle
@@ -239,19 +239,19 @@ GNUNET_TESTBED_destroy (struct GNUNET_TESTBED_Testbed *testbed)
239static void 239static void
240start_peers_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 240start_peers_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
241{ 241{
242 struct GNUNET_TESTBED_RunHandle *rh = cls; 242 struct RunContext *rc = cls;
243 struct DLLOperation *dll_op; 243 struct DLLOperation *dll_op;
244 unsigned int peer; 244 unsigned int peer;
245 245
246 LOG (GNUNET_ERROR_TYPE_DEBUG, "Starting Peers\n"); 246 LOG (GNUNET_ERROR_TYPE_DEBUG, "Starting Peers\n");
247 for (peer = 0; peer < rh->num_peers; peer++) 247 for (peer = 0; peer < rc->num_peers; peer++)
248 { 248 {
249 dll_op = GNUNET_malloc (sizeof (struct DLLOperation)); 249 dll_op = GNUNET_malloc (sizeof (struct DLLOperation));
250 dll_op->op = GNUNET_TESTBED_peer_start (rh->peers[peer]); 250 dll_op->op = GNUNET_TESTBED_peer_start (rc->peers[peer]);
251 dll_op->cls = rh->peers[peer]; 251 dll_op->cls = rc->peers[peer];
252 GNUNET_CONTAINER_DLL_insert_tail (rh->dll_op_head, rh->dll_op_tail, dll_op); 252 GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail, dll_op);
253 } 253 }
254 rh->peer_count = 0; 254 rc->peer_count = 0;
255} 255}
256 256
257 257
@@ -268,12 +268,12 @@ static void
268peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) 268peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
269{ 269{
270 struct DLLOperation *dll_op = cls; 270 struct DLLOperation *dll_op = cls;
271 struct GNUNET_TESTBED_RunHandle *rh; 271 struct RunContext *rc;
272 272
273 GNUNET_assert (NULL != dll_op); 273 GNUNET_assert (NULL != dll_op);
274 rh = dll_op->rh; 274 rc = dll_op->rc;
275 GNUNET_assert (NULL != rh); 275 GNUNET_assert (NULL != rc);
276 GNUNET_CONTAINER_DLL_remove (rh->dll_op_head, rh->dll_op_tail, dll_op); 276 GNUNET_CONTAINER_DLL_remove (rc->dll_op_head, rc->dll_op_tail, dll_op);
277 GNUNET_TESTBED_operation_done (dll_op->op); 277 GNUNET_TESTBED_operation_done (dll_op->op);
278 GNUNET_free (dll_op); 278 GNUNET_free (dll_op);
279 if (NULL == peer) 279 if (NULL == peer)
@@ -284,12 +284,12 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
284 /* FIXME: GNUNET_TESTBED_shutdown_run()? */ 284 /* FIXME: GNUNET_TESTBED_shutdown_run()? */
285 return; 285 return;
286 } 286 }
287 rh->peers[rh->peer_count] = peer; 287 rc->peers[rc->peer_count] = peer;
288 rh->peer_count++; 288 rc->peer_count++;
289 if (rh->peer_count < rh->num_peers) 289 if (rc->peer_count < rc->num_peers)
290 return; 290 return;
291 LOG (GNUNET_ERROR_TYPE_DEBUG, "Required peers created successfully\n"); 291 LOG (GNUNET_ERROR_TYPE_DEBUG, "Required peers created successfully\n");
292 GNUNET_SCHEDULER_add_now (&start_peers_task, rh); 292 GNUNET_SCHEDULER_add_now (&start_peers_task, rc);
293} 293}
294 294
295 295
@@ -300,30 +300,30 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
300 * @param tc the task context from scheduler 300 * @param tc the task context from scheduler
301 */ 301 */
302static void 302static void
303shutdown_run_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 303cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
304{ 304{
305 struct GNUNET_TESTBED_RunHandle *rh = cls; 305 struct RunContext *rc = cls;
306 struct DLLOperation *dll_op; 306 struct DLLOperation *dll_op;
307 307
308 GNUNET_assert (NULL == rh->peers); 308 GNUNET_assert (NULL == rc->peers);
309 if (NULL != rh->c) 309 if (NULL != rc->c)
310 GNUNET_TESTBED_controller_disconnect (rh->c); 310 GNUNET_TESTBED_controller_disconnect (rc->c);
311 if (NULL != rh->cproc) 311 if (NULL != rc->cproc)
312 GNUNET_TESTBED_controller_stop (rh->cproc); 312 GNUNET_TESTBED_controller_stop (rc->cproc);
313 if (NULL != rh->h) 313 if (NULL != rc->h)
314 GNUNET_TESTBED_host_destroy (rh->h); 314 GNUNET_TESTBED_host_destroy (rc->h);
315 if (NULL != rh->dll_op_head) 315 if (NULL != rc->dll_op_head)
316 { 316 {
317 LOG (GNUNET_ERROR_TYPE_WARNING, 317 LOG (GNUNET_ERROR_TYPE_WARNING,
318 _("Some operations are still pending. Cancelling them\n")); 318 _("Some operations are still pending. Cancelling them\n"));
319 while (NULL != (dll_op = rh->dll_op_head)) 319 while (NULL != (dll_op = rc->dll_op_head))
320 { 320 {
321 GNUNET_TESTBED_operation_cancel (dll_op->op); 321 GNUNET_TESTBED_operation_cancel (dll_op->op);
322 GNUNET_CONTAINER_DLL_remove (rh->dll_op_head, rh->dll_op_tail, dll_op); 322 GNUNET_CONTAINER_DLL_remove (rc->dll_op_head, rc->dll_op_tail, dll_op);
323 GNUNET_free (dll_op); 323 GNUNET_free (dll_op);
324 } 324 }
325 } 325 }
326 GNUNET_free (rh); 326 GNUNET_free (rc);
327} 327}
328 328
329 329
@@ -337,49 +337,49 @@ shutdown_run_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
337static void 337static void
338event_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) 338event_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
339{ 339{
340 struct GNUNET_TESTBED_RunHandle *rh = cls; 340 struct RunContext *rc = cls;
341 struct DLLOperation *dll_op; 341 struct DLLOperation *dll_op;
342 342
343 if ((GNUNET_YES == rh->in_shutdown) && 343 if ((GNUNET_YES == rc->in_shutdown) &&
344 (GNUNET_TESTBED_ET_OPERATION_FINISHED == event->type)) 344 (GNUNET_TESTBED_ET_OPERATION_FINISHED == event->type))
345 { 345 {
346 for (dll_op = rh->dll_op_head; NULL != dll_op; dll_op = dll_op->next) 346 for (dll_op = rc->dll_op_head; NULL != dll_op; dll_op = dll_op->next)
347 { 347 {
348 if (event->details.operation_finished.operation == dll_op->op) 348 if (event->details.operation_finished.operation == dll_op->op)
349 break; 349 break;
350 } 350 }
351 if (NULL == dll_op) 351 if (NULL == dll_op)
352 goto call_cc; 352 goto call_cc;
353 GNUNET_CONTAINER_DLL_remove (rh->dll_op_head, rh->dll_op_tail, dll_op); 353 GNUNET_CONTAINER_DLL_remove (rc->dll_op_head, rc->dll_op_tail, dll_op);
354 GNUNET_TESTBED_operation_done (dll_op->op); 354 GNUNET_TESTBED_operation_done (dll_op->op);
355 GNUNET_free (dll_op); 355 GNUNET_free (dll_op);
356 rh->peer_count++; 356 rc->peer_count++;
357 if (rh->peer_count < rh->num_peers) 357 if (rc->peer_count < rc->num_peers)
358 return; 358 return;
359 GNUNET_free (rh->peers); 359 GNUNET_free (rc->peers);
360 rh->peers = NULL; 360 rc->peers = NULL;
361 LOG (GNUNET_ERROR_TYPE_DEBUG, "All peers successfully destroyed\n"); 361 LOG (GNUNET_ERROR_TYPE_DEBUG, "All peers successfully destroyed\n");
362 GNUNET_SCHEDULER_add_now (&shutdown_run_task, rh); 362 GNUNET_SCHEDULER_add_now (&cleanup_task, rc);
363 return; 363 return;
364 } 364 }
365 365
366 call_cc: 366 call_cc:
367 rh->cc (rh->cc_cls, event); 367 rc->cc (rc->cc_cls, event);
368 if (GNUNET_TESTBED_ET_PEER_START != event->type) 368 if (GNUNET_TESTBED_ET_PEER_START != event->type)
369 return; 369 return;
370 for (dll_op = rh->dll_op_head; NULL != dll_op; dll_op = dll_op->next) 370 for (dll_op = rc->dll_op_head; NULL != dll_op; dll_op = dll_op->next)
371 if ((NULL != dll_op->cls) && 371 if ((NULL != dll_op->cls) &&
372 (event->details.peer_start.peer == dll_op->cls)) 372 (event->details.peer_start.peer == dll_op->cls))
373 break; 373 break;
374 GNUNET_assert (NULL != dll_op); 374 GNUNET_assert (NULL != dll_op);
375 GNUNET_CONTAINER_DLL_remove (rh->dll_op_head, rh->dll_op_tail, dll_op); 375 GNUNET_CONTAINER_DLL_remove (rc->dll_op_head, rc->dll_op_tail, dll_op);
376 GNUNET_TESTBED_operation_done (dll_op->op); 376 GNUNET_TESTBED_operation_done (dll_op->op);
377 GNUNET_free (dll_op); 377 GNUNET_free (dll_op);
378 rh->peer_count++; 378 rc->peer_count++;
379 if (rh->peer_count < rh->num_peers) 379 if (rc->peer_count < rc->num_peers)
380 return; 380 return;
381 LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers started successfully\n"); 381 LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers started successfully\n");
382 GNUNET_SCHEDULER_add_continuation (rh->master, rh->master_cls, 382 GNUNET_SCHEDULER_add_continuation (rc->master, rc->master_cls,
383 GNUNET_SCHEDULER_REASON_PREREQ_DONE); 383 GNUNET_SCHEDULER_REASON_PREREQ_DONE);
384} 384}
385 385
@@ -398,7 +398,7 @@ static void
398controller_status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, 398controller_status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
399 int status) 399 int status)
400{ 400{
401 struct GNUNET_TESTBED_RunHandle *rh = cls; 401 struct RunContext *rc = cls;
402 struct DLLOperation *dll_op; 402 struct DLLOperation *dll_op;
403 unsigned int peer; 403 unsigned int peer;
404 404
@@ -407,20 +407,53 @@ controller_status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
407 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Testbed startup failed\n"); 407 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Testbed startup failed\n");
408 return; 408 return;
409 } 409 }
410 rh->c = GNUNET_TESTBED_controller_connect (cfg, rh->h, rh->event_mask, 410 rc->c = GNUNET_TESTBED_controller_connect (cfg, rc->h, rc->event_mask,
411 &event_cb, rh); 411 &event_cb, rc);
412 rh->peers = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Peer *) 412 rc->peers = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Peer *)
413 * rh->num_peers); 413 * rc->num_peers);
414 GNUNET_assert (NULL != rh->c); 414 GNUNET_assert (NULL != rc->c);
415 rh->peer_count = 0; 415 rc->peer_count = 0;
416 for (peer = 0; peer < rh->num_peers; peer++) 416 for (peer = 0; peer < rc->num_peers; peer++)
417 { 417 {
418 dll_op = GNUNET_malloc (sizeof (struct DLLOperation)); 418 dll_op = GNUNET_malloc (sizeof (struct DLLOperation));
419 dll_op->rh = rh; 419 dll_op->rc = rc;
420 dll_op->op = GNUNET_TESTBED_peer_create (rh->c, rh->h, cfg, peer_create_cb, 420 dll_op->op = GNUNET_TESTBED_peer_create (rc->c, rc->h, cfg, peer_create_cb,
421 dll_op); 421 dll_op);
422 GNUNET_CONTAINER_DLL_insert_tail (rh->dll_op_head, rh->dll_op_tail, dll_op); 422 GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail, dll_op);
423 }
424}
425
426
427/**
428 * Stops the testbed run and releases any used resources
429 *
430 * @param rc the tesbed run handle
431 * @param tc the task context from scheduler
432 */
433void
434shutdown_run_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
435{
436 struct RunContext *rc = cls;
437 struct DLLOperation *dll_op;
438 unsigned int peer;
439
440 rc->in_shutdown = GNUNET_YES;
441 if (NULL != rc->c)
442 {
443 if (NULL != rc->peers)
444 {
445 rc->peer_count = 0;
446 for (peer = 0; peer < rc->num_peers; peer++)
447 {
448 dll_op = GNUNET_malloc (sizeof (struct DLLOperation));
449 dll_op->op = GNUNET_TESTBED_peer_destroy (rc->peers[peer]);
450 GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail,
451 dll_op);
452 }
453 return;
454 }
423 } 455 }
456 GNUNET_SCHEDULER_add_now (&cleanup_task, rc);
424} 457}
425 458
426 459
@@ -446,9 +479,8 @@ controller_status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
446 * @param cc controller callback to invoke on events 479 * @param cc controller callback to invoke on events
447 * @param cc_cls closure for cc 480 * @param cc_cls closure for cc
448 * @param master task to run once the testbed is ready 481 * @param master task to run once the testbed is ready
449 * @return the handle for this testbed run
450 */ 482 */
451struct GNUNET_TESTBED_RunHandle * 483void
452GNUNET_TESTBED_run (const char *host_filename, 484GNUNET_TESTBED_run (const char *host_filename,
453 const struct GNUNET_CONFIGURATION_Handle *cfg, 485 const struct GNUNET_CONFIGURATION_Handle *cfg,
454 unsigned int num_peers, 486 unsigned int num_peers,
@@ -458,57 +490,27 @@ GNUNET_TESTBED_run (const char *host_filename,
458 GNUNET_SCHEDULER_Task master, 490 GNUNET_SCHEDULER_Task master,
459 void *master_cls) 491 void *master_cls)
460{ 492{
461 struct GNUNET_TESTBED_RunHandle *rh; 493 struct RunContext *rc;
462 494
463 event_mask |= (1LL << GNUNET_TESTBED_ET_PEER_START); 495 event_mask |= (1LL << GNUNET_TESTBED_ET_PEER_START);
464 rh = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_RunHandle)); 496 rc = GNUNET_malloc (sizeof (struct RunContext));
465 GNUNET_break (NULL == host_filename); /* Currently we do not support host 497 GNUNET_break (NULL == host_filename); /* Currently we do not support host
466 files */ 498 files */
467 host_filename = NULL; 499 host_filename = NULL;
468 rh->h = GNUNET_TESTBED_host_create (NULL, NULL, 0); 500 rc->h = GNUNET_TESTBED_host_create (NULL, NULL, 0);
469 GNUNET_assert (NULL != rh->h); 501 GNUNET_assert (NULL != rc->h);
470 rh->cproc = GNUNET_TESTBED_controller_start ("127.0.0.1", rh->h, cfg, 502 rc->cproc = GNUNET_TESTBED_controller_start ("127.0.0.1", rc->h, cfg,
471 &controller_status_cb, rh); 503 &controller_status_cb, rc);
472 GNUNET_assert (NULL != rh->cproc); 504 GNUNET_assert (NULL != rc->cproc);
473 rh->num_peers = num_peers; 505 rc->num_peers = num_peers;
474 rh->event_mask = event_mask; 506 rc->event_mask = event_mask;
475 rh->cc = cc; 507 rc->cc = cc;
476 rh->cc_cls = cc_cls; 508 rc->cc_cls = cc_cls;
477 rh->master = master; 509 rc->master = master;
478 rh->master_cls = master_cls; 510 rc->master_cls = master_cls;
479 rh->in_shutdown = GNUNET_NO; 511 rc->in_shutdown = GNUNET_NO;
480 return rh; 512 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
481} 513 &shutdown_run_task, rc);
482
483
484/**
485 * Stops the testbed run and releases any used resources
486 *
487 * @param rh the tesbed run handle
488 */
489void
490GNUNET_TESTBED_shutdown_run (struct GNUNET_TESTBED_RunHandle *rh)
491{
492 struct DLLOperation *dll_op;
493 unsigned int peer;
494
495 rh->in_shutdown = GNUNET_YES;
496 if (NULL != rh->c)
497 {
498 if (NULL != rh->peers)
499 {
500 rh->peer_count = 0;
501 for (peer = 0; peer < rh->num_peers; peer++)
502 {
503 dll_op = GNUNET_malloc (sizeof (struct DLLOperation));
504 dll_op->op = GNUNET_TESTBED_peer_destroy (rh->peers[peer]);
505 GNUNET_CONTAINER_DLL_insert_tail (rh->dll_op_head, rh->dll_op_tail,
506 dll_op);
507 }
508 return;
509 }
510 }
511 GNUNET_SCHEDULER_add_now (&shutdown_run_task, rh);
512} 514}
513 515
514/* end of testbed_api_testbed.c */ 516/* end of testbed_api_testbed.c */
diff --git a/src/testbed/x64_misc.supp b/src/testbed/x64_misc.supp
new file mode 100644
index 000000000..7998f068d
--- /dev/null
+++ b/src/testbed/x64_misc.supp
@@ -0,0 +1,24 @@
1{
2 <unknown invalid free>
3 Memcheck:Free
4 fun:free
5 fun:free_mem
6 fun:__libc_freeres
7 fun:_vgnU_freeres
8 fun:__run_exit_handlers
9 fun:exit
10 fun:(below main)
11}
12{
13 <gnunet_crypto_init>
14 Memcheck:Leak
15 fun:malloc
16 obj:/usr/lib/libgcrypt.so.11.5.3
17 ...
18 obj:/usr/lib/libgcrypt.so.11.5.3
19 fun:gcry_control
20 fun:GNUNET_CRYPTO_random_init
21 obj:/home/harsha/repos/gnunet/src/util/.libs/libgnunetutil.so.8.0.0
22 obj:/home/harsha/repos/gnunet/src/util/.libs/libgnunetutil.so.8.0.0
23}
24