2 This file is part of GNUnet.
3 (C) 2011 Christian Grothoff (and other contributing authors)
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
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
21 * @file mesh/test_mesh_small.c
23 * @brief Test for the mesh service: retransmission of traffic.
26 #include "gnunet_testing_lib.h"
27 #include "gnunet_mesh_service.h"
29 #define VERBOSE GNUNET_YES
30 #define REMOVE_DIR GNUNET_YES
34 struct MeshPeer *prev;
36 struct MeshPeer *next;
38 struct GNUNET_TESTING_Daemon *daemon;
40 struct GNUNET_MESH_Handle *mesh_handle;
46 unsigned long long total_mesh_bytes;
51 * How long until we give up on connecting the peers?
53 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1500)
56 * Time to wait for stuff that should be rather fast
58 #define SHORT_TIME GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
61 * DIFFERENT TESTS TO RUN
68 * Which test are we running?
73 * How many events have happened
77 static int peers_in_tunnel;
79 static int peers_responded;
87 * Total number of peers in the test.
89 static unsigned long long num_peers;
92 * Global configuration file
94 static struct GNUNET_CONFIGURATION_Handle *testing_cfg;
97 * Total number of currently running peers.
99 static unsigned long long peers_running;
102 * Total number of connections in the whole network.
104 static unsigned int total_connections;
107 * The currently running peer group.
109 static struct GNUNET_TESTING_PeerGroup *pg;
112 * File to report results to.
114 static struct GNUNET_DISK_FileHandle *output_file;
117 * File to log connection info, statistics to.
119 static struct GNUNET_DISK_FileHandle *data_file;
122 * How many data points to capture before triggering next round?
124 static struct GNUNET_TIME_Relative wait_time;
127 * Task called to disconnect peers.
129 static GNUNET_SCHEDULER_TaskIdentifier disconnect_task;
132 * Task To perform tests
134 static GNUNET_SCHEDULER_TaskIdentifier test_task;
137 * Task called to shutdown test.
139 static GNUNET_SCHEDULER_TaskIdentifier shutdown_handle;
141 static char *topology_file;
143 static struct GNUNET_TESTING_Daemon *d1;
145 static GNUNET_PEER_Id pid1;
147 static struct GNUNET_TESTING_Daemon *d2;
149 static struct GNUNET_TESTING_Daemon *d3;
151 static struct GNUNET_MESH_Handle *h1;
153 static struct GNUNET_MESH_Handle *h2;
155 static struct GNUNET_MESH_Handle *h3;
157 static struct GNUNET_MESH_Tunnel *t;
159 static struct GNUNET_MESH_Tunnel *incoming_t;
161 static struct GNUNET_MESH_Tunnel *incoming_t2;
163 static uint16_t *mesh_peers;
166 * Check whether peers successfully shut down.
169 shutdown_callback (void *cls, const char *emsg)
174 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
175 "***************** test: Shutdown of peers failed!\n");
182 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
183 "***************** test: All peers successfully shut down!\n");
190 shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
193 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
194 "***************** test: Ending test.\n");
197 if (disconnect_task != GNUNET_SCHEDULER_NO_TASK)
199 GNUNET_SCHEDULER_cancel (disconnect_task);
200 disconnect_task = GNUNET_SCHEDULER_NO_TASK;
203 if (data_file != NULL)
204 GNUNET_DISK_file_close (data_file);
205 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
206 GNUNET_CONFIGURATION_destroy (testing_cfg);
211 disconnect_mesh_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
213 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
214 "***************** test: disconnecting mesh service of peers\n");
215 disconnect_task = GNUNET_SCHEDULER_NO_TASK;
216 GNUNET_MESH_disconnect (h1);
217 GNUNET_MESH_disconnect (h2);
218 if (test == MULTICAST)
219 GNUNET_MESH_disconnect (h3);
220 if (GNUNET_SCHEDULER_NO_TASK != shutdown_handle)
222 GNUNET_SCHEDULER_cancel (shutdown_handle);
223 shutdown_handle = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
229 * Transmit ready callback
232 tmt_rdy (void *cls, size_t size, void *buf)
234 struct GNUNET_MessageHeader *msg = buf;
236 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
237 "***************** test: tmt_rdy called\n");
238 if (size < sizeof (struct GNUNET_MessageHeader) || NULL == buf)
240 msg->size = htons (sizeof (struct GNUNET_MessageHeader));
241 msg->type = htons ((long) cls);
242 return sizeof (struct GNUNET_MessageHeader);
247 * Function is called whenever a message is received.
249 * @param cls closure (set from GNUNET_MESH_connect)
250 * @param tunnel connection to the other end
251 * @param tunnel_ctx place to store local state associated with the tunnel
252 * @param sender who sent the message
253 * @param message the actual message
254 * @param atsi performance data for the connection
255 * @return GNUNET_OK to keep the connection open,
256 * GNUNET_SYSERR to close it (signal serious error)
259 data_callback (void *cls, struct GNUNET_MESH_Tunnel *tunnel, void **tunnel_ctx,
260 const struct GNUNET_PeerIdentity *sender,
261 const struct GNUNET_MessageHeader *message,
262 const struct GNUNET_ATS_Information *atsi)
264 long client = (long) cls;
269 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
270 "***************** test: Origin client got a response!\n");
273 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
275 GNUNET_SCHEDULER_cancel (disconnect_task);
277 GNUNET_SCHEDULER_add_delayed (SHORT_TIME, &disconnect_mesh_peers,
280 if (test == MULTICAST && peers_responded < 2)
282 GNUNET_MESH_tunnel_destroy (tunnel);
286 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
287 "***************** test: Destination client %u got a message.\n",
290 GNUNET_MESH_notify_transmit_ready (tunnel, GNUNET_NO, 0,
291 GNUNET_TIME_UNIT_FOREVER_REL, sender,
292 sizeof (struct GNUNET_MessageHeader),
293 &tmt_rdy, (void *) 1L);
294 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
296 GNUNET_SCHEDULER_cancel (disconnect_task);
298 GNUNET_SCHEDULER_add_delayed (SHORT_TIME, &disconnect_mesh_peers,
310 * Handlers, for diverse services
312 static struct GNUNET_MESH_MessageHandler handlers[] = {
313 {&data_callback, 1, sizeof (struct GNUNET_MessageHeader)},
319 * Method called whenever another peer has added us to a tunnel
320 * the other peer initiated.
323 * @param tunnel new handle to the tunnel
324 * @param initiator peer that started the tunnel
325 * @param atsi performance information for the tunnel
326 * @return initial tunnel context for the tunnel
327 * (can be NULL -- that's not an error)
330 incoming_tunnel (void *cls, struct GNUNET_MESH_Tunnel *tunnel,
331 const struct GNUNET_PeerIdentity *initiator,
332 const struct GNUNET_ATS_Information *atsi)
334 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
335 "***************** test: Incoming tunnel from %s to peer %d\n",
336 GNUNET_i2s (initiator), (long) cls);
338 if ((long) cls == 1L)
341 incoming_t2 = tunnel;
342 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
344 GNUNET_SCHEDULER_cancel (disconnect_task);
346 GNUNET_SCHEDULER_add_delayed (SHORT_TIME, &disconnect_mesh_peers, NULL);
352 * Function called whenever an inbound tunnel is destroyed. Should clean up
353 * any associated state.
355 * @param cls closure (set from GNUNET_MESH_connect)
356 * @param tunnel connection to the other end (henceforth invalid)
357 * @param tunnel_ctx place where local state associated
358 * with the tunnel is stored
361 tunnel_cleaner (void *cls, const struct GNUNET_MESH_Tunnel *tunnel,
366 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
367 "***************** test: Incoming tunnel disconnected at peer %d\n",
374 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
375 "***************** test: Unknown peer! %d\n", i);
377 if (peers_in_tunnel > 0)
380 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
382 GNUNET_SCHEDULER_cancel (disconnect_task);
383 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_mesh_peers, NULL);
391 * Method called whenever a tunnel falls apart.
394 * @param peer peer identity the tunnel stopped working with
397 dh (void *cls, const struct GNUNET_PeerIdentity *peer)
399 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
400 "***************** test: peer %s disconnected\n",
407 * Method called whenever a peer connects to a tunnel.
410 * @param peer peer identity the tunnel was created to, NULL on timeout
411 * @param atsi performance data for the connection
414 ch (void *cls, const struct GNUNET_PeerIdentity *peer,
415 const struct GNUNET_ATS_Information *atsi)
417 struct GNUNET_PeerIdentity *dest;
419 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
420 "***************** test: peer %s connected\n", GNUNET_i2s (peer));
422 if (0 == memcmp (&d2->id, peer, sizeof (d2->id)) && (long) cls == 1L)
424 if (test == MULTICAST && 0 == memcmp (&d3->id, peer, sizeof (d3->id)) &&
434 if (peers_in_tunnel < 2)
441 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
443 GNUNET_SCHEDULER_cancel (disconnect_task);
445 GNUNET_SCHEDULER_add_delayed (SHORT_TIME, &disconnect_mesh_peers, NULL);
446 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
447 "***************** test: Sending data...\n");
449 GNUNET_MESH_notify_transmit_ready (t, GNUNET_NO, 0,
450 GNUNET_TIME_UNIT_FOREVER_REL, dest,
451 sizeof (struct GNUNET_MessageHeader),
452 &tmt_rdy, (void *) 1L);
456 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
457 "***************** test: Disconnect already run?\n");
458 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
459 "***************** test: Aborting...\n");
466 do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
468 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "***************** test: test_task\n");
469 if (test == MULTICAST)
471 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
472 "***************** test: add peer 3\n");
473 GNUNET_MESH_peer_request_connect_add (t, &d3->id);
475 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "***************** test: add peer 2\n");
476 GNUNET_MESH_peer_request_connect_add (t, &d2->id);
477 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
478 "***************** test: schedule timeout in 30s\n");
479 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
481 GNUNET_SCHEDULER_cancel (disconnect_task);
483 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
484 (GNUNET_TIME_UNIT_SECONDS, 30),
485 &disconnect_mesh_peers, NULL);
491 * Prototype of a callback function indicating that two peers
492 * are currently connected.
495 * @param first peer id for first daemon
496 * @param second peer id for the second daemon
497 * @param distance distance between the connected peers
498 * @param emsg error message (NULL on success)
501 topo_cb (void *cls, const struct GNUNET_PeerIdentity *first,
502 const struct GNUNET_PeerIdentity *second, const char *emsg)
506 struct GNUNET_PeerIdentity id;
508 GNUNET_PEER_resolve (1, &id);
509 p1 = GNUNET_PEER_search (first);
512 p2 = GNUNET_PEER_search (second);
513 if (p2 == 0 || p2 > num_peers)
515 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
516 "***************** test: %s is UNKNOWN!? (%u)\n",
517 GNUNET_i2s (second), p2);
521 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
522 "***************** test: %s IS a neighbor\n",
523 GNUNET_i2s (second));
526 p1 = GNUNET_PEER_search (second);
529 p2 = GNUNET_PEER_search (first);
530 if (p2 == 0 || p2 > num_peers)
532 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
533 "***************** test: %s is UNKNOWN!? (%u)\n",
534 GNUNET_i2s (first), p2);
538 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
539 "***************** test: %s IS a neighbor\n",
546 * connect_mesh_service: connect to the mesh service of one of the peers
550 connect_mesh_service (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
552 GNUNET_MESH_ApplicationType app;
554 struct GNUNET_PeerIdentity id;
556 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
557 "***************** test: connect_mesh_service\n");
559 for (i = 1; i <= num_peers; i++)
561 GNUNET_PEER_resolve (i, &id);
562 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
563 "***************** test: peer %s has %u conns to d1\n",
564 GNUNET_i2s (&id), mesh_peers[i]);
565 if (mesh_peers[i] == 0)
568 GNUNET_assert (i < num_peers);
569 d2 = GNUNET_TESTING_daemon_get_by_id (pg, &id);
570 if (test == MULTICAST)
572 for (i++; i <= num_peers; i++)
574 GNUNET_PEER_resolve (i, &id);
575 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
576 "***************** test: peer %s has %u conns to d1\n",
577 GNUNET_i2s (&id), mesh_peers[i]);
578 if (mesh_peers[i] == 0)
581 GNUNET_assert (i < num_peers);
582 d3 = GNUNET_TESTING_daemon_get_by_id (pg, &id);
584 app = (GNUNET_MESH_ApplicationType) 0;
587 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
588 "***************** test: connecting to mesh service of peer %s (%u)\n",
589 GNUNET_i2s (&d1->id), mesh_peers[0]);
590 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
591 "***************** test: connecting to mesh service of peer %s (%u)\n",
592 GNUNET_i2s (&d2->id), i);
593 if (test == MULTICAST)
595 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
596 "***************** test: connecting to mesh service of peer %s (%u)\n",
597 GNUNET_i2s (&d3->id), i);
600 h1 = GNUNET_MESH_connect (d1->cfg, 10, (void *) 1L, NULL, &tunnel_cleaner,
602 h2 = GNUNET_MESH_connect (d2->cfg, 10, (void *) 2L, &incoming_tunnel,
603 &tunnel_cleaner, handlers, &app);
604 if (test == MULTICAST)
606 h3 = GNUNET_MESH_connect (d3->cfg, 10, (void *) 3L, &incoming_tunnel,
607 &tunnel_cleaner, handlers, &app);
609 t = GNUNET_MESH_tunnel_create (h1, NULL, &ch, &dh, (void *) 1L);
612 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
613 (GNUNET_TIME_UNIT_SECONDS, 6), &do_test,
620 * peergroup_ready: start test when all peers are connected
622 * @param emsg error message
625 peergroup_ready (void *cls, const char *emsg)
633 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
634 "***************** test: Peergroup callback called with error, aborting test!\n");
635 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
636 "***************** test: Error from testing: `%s'\n", emsg);
638 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
642 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
643 "************************************************************\n");
644 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
645 "***************** test: Peer Group started successfully!\n");
646 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
647 "***************** test: Have %u connections\n",
651 if (data_file != NULL)
654 buf_len = GNUNET_asprintf (&buf, "CONNECTIONS_0: %u\n", total_connections);
656 GNUNET_DISK_file_write (data_file, buf, buf_len);
659 peers_running = GNUNET_TESTING_daemons_running (pg);
660 for (i = 0; i < num_peers; i++)
662 GNUNET_PEER_Id peer_id;
664 d1 = GNUNET_TESTING_daemon_get (pg, i);
665 peer_id = GNUNET_PEER_intern (&d1->id);
666 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "***************** test: %u: %s\n",
667 peer_id, GNUNET_i2s (&d1->id));
669 d1 = GNUNET_TESTING_daemon_get (pg, 0);
670 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
671 "***************** test: Peer looking: %s\n",
672 GNUNET_i2s (&d1->id));
673 pid1 = GNUNET_PEER_intern (&d1->id);
674 mesh_peers[pid1] = 100;
675 GNUNET_TESTING_get_topology (pg, &topo_cb, NULL);
677 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
678 (GNUNET_TIME_UNIT_SECONDS, 4),
679 &connect_mesh_service, NULL);
681 GNUNET_SCHEDULER_add_delayed (wait_time, &disconnect_mesh_peers, NULL);
687 * Function that will be called whenever two daemons are connected by
688 * the testing library.
691 * @param first peer id for first daemon
692 * @param second peer id for the second daemon
693 * @param distance distance between the connected peers
694 * @param first_cfg config for the first daemon
695 * @param second_cfg config for the second daemon
696 * @param first_daemon handle for the first daemon
697 * @param second_daemon handle for the second daemon
698 * @param emsg error message (NULL on success)
701 connect_cb (void *cls, const struct GNUNET_PeerIdentity *first,
702 const struct GNUNET_PeerIdentity *second, uint32_t distance,
703 const struct GNUNET_CONFIGURATION_Handle *first_cfg,
704 const struct GNUNET_CONFIGURATION_Handle *second_cfg,
705 struct GNUNET_TESTING_Daemon *first_daemon,
706 struct GNUNET_TESTING_Daemon *second_daemon, const char *emsg)
714 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
715 "***************** test: Problem with new connection (%s)\n",
717 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "***************** test: (%s)\n",
719 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "***************** test: (%s)\n",
720 GNUNET_i2s (second));
727 * run: load configuration options and schedule test to run (start peergroup)
730 * @param cfgfile configuration file name (can be NULL)
731 * @param cfg configuration handle
734 run (void *cls, char *const *args, const char *cfgfile,
735 const struct GNUNET_CONFIGURATION_Handle *cfg)
738 unsigned long long temp_wait;
739 struct GNUNET_TESTING_Host *hosts;
743 testing_cfg = GNUNET_CONFIGURATION_dup (cfg);
745 GNUNET_log_setup ("test_mesh_small",
754 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
755 "***************** test: Starting daemons.\n");
756 GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing",
757 "use_progressbars", "YES");
761 GNUNET_CONFIGURATION_get_value_number (testing_cfg, "testing",
762 "num_peers", &num_peers))
764 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
765 "Option TESTING:NUM_PEERS is required!\n");
769 mesh_peers = GNUNET_malloc (sizeof (uint16_t) * (num_peers + 1));
772 GNUNET_CONFIGURATION_get_value_number (testing_cfg, "test_mesh_small",
773 "wait_time", &temp_wait))
775 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
776 "Option test_mesh_small:wait_time is required!\n");
781 GNUNET_CONFIGURATION_get_value_string (testing_cfg, "testing",
782 "topology_output_file",
785 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
786 "Option test_mesh_small:topology_output_file is required!\n");
791 GNUNET_CONFIGURATION_get_value_string (testing_cfg, "test_mesh_small",
796 GNUNET_DISK_file_open (data_filename,
797 GNUNET_DISK_OPEN_READWRITE |
798 GNUNET_DISK_OPEN_CREATE,
799 GNUNET_DISK_PERM_USER_READ |
800 GNUNET_DISK_PERM_USER_WRITE);
801 if (data_file == NULL)
803 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to open %s for output!\n",
805 GNUNET_free (data_filename);
810 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, temp_wait);
813 GNUNET_CONFIGURATION_get_value_string (cfg, "test_mesh_small",
814 "output_file", &temp_str))
817 GNUNET_DISK_file_open (temp_str,
818 GNUNET_DISK_OPEN_READWRITE |
819 GNUNET_DISK_OPEN_CREATE,
820 GNUNET_DISK_PERM_USER_READ |
821 GNUNET_DISK_PERM_USER_WRITE);
822 if (output_file == NULL)
823 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to open %s for output!\n",
826 GNUNET_free_non_null (temp_str);
828 hosts = GNUNET_TESTING_hosts_load (testing_cfg);
830 pg = GNUNET_TESTING_peergroup_start (testing_cfg, num_peers, TIMEOUT,
831 &connect_cb, &peergroup_ready, NULL,
833 GNUNET_assert (pg != NULL);
835 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_get_forever (),
836 &shutdown_task, NULL);
842 * test_mesh_small command line options
844 static struct GNUNET_GETOPT_CommandLineOption options[] = {
845 {'V', "verbose", NULL,
846 gettext_noop ("be verbose (print progress information)"),
847 0, &GNUNET_GETOPT_set_one, &verbose},
848 GNUNET_GETOPT_OPTION_END
856 main (int argc, char *argv[])
858 char *const argv2[] = {
861 "test_mesh_small.conf",
869 /* Each peer is supposed to generate the following callbacks:
870 * 1 incoming tunnel (@dest)
871 * 1 connected peer (@orig)
872 * 1 received data packet (@dest)
873 * 1 received data packet (@orig)
874 * 1 received tunnel destroy (@dest)
875 * _________________________________
876 * 5 x ok expected per peer
880 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "***************** test: Start\n");
881 if (strstr (argv[0], "test_mesh_small_unicast") != NULL)
883 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "***************** test: UNICAST\n");
887 else if (strstr (argv[0], "test_mesh_small_multicast") != NULL)
889 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "***************** test: MULTICAST\n");
895 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "***************** test: UNKNOWN\n");
900 GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
902 gettext_noop ("Test mesh in a small network."), options,
905 GNUNET_DISK_directory_remove ("/tmp/test_mesh_small");
909 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
910 "***************** test: FAILED! (%d/%d)\n", ok, ok_goal);
913 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "***************** test: success\n");
917 /* end of test_mesh_small.c */