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 cadet/test_cadet.c
23 * @brief Test for the cadet service: retransmission of traffic.
27 #include "cadet_test_lib.h"
28 #include "gnunet_cadet_service.h"
29 #include "gnunet_statistics_service.h"
34 * How namy messages to send
36 #define TOTAL_PACKETS 1000
39 * How long until we give up on connecting the peers?
41 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120)
44 * Time to wait for stuff that should be rather fast
46 #define SHORT_TIME GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
49 * DIFFERENT TESTS TO RUN
60 * Which test are we running?
65 * String with test name
70 * Flag to send traffic leaf->root in speed tests to test BCK_ACK logic.
72 static int test_backwards = GNUNET_NO;
75 * How many events have happened
80 * Number of events expected to conclude the test successfully.
85 * Size of each test packet
87 size_t size_payload = sizeof (struct GNUNET_MessageHeader) + sizeof (uint32_t);
90 * Operation to get peer ids.
92 struct GNUNET_TESTBED_Operation *t_op[2];
97 struct GNUNET_PeerIdentity *p_id[2];
105 * Is the setup initialized?
107 static int initialized;
110 * Number of payload packes sent
112 static int data_sent;
115 * Number of payload packets received
117 static int data_received;
120 * Number of payload packed explicitly (app level) acknowledged
125 * Total number of peers asked to run.
127 static unsigned long long peers_requested;
130 * Number of currently running peers (should be same as @c peers_requested).
132 static unsigned long long peers_running;
135 * Test context (to shut down).
137 struct GNUNET_CADET_TEST_Context *test_ctx;
140 * Task called to disconnect peers.
142 static GNUNET_SCHEDULER_TaskIdentifier disconnect_task;
145 * Task To perform tests
147 static GNUNET_SCHEDULER_TaskIdentifier test_task;
150 * Task called to shutdown test.
152 static GNUNET_SCHEDULER_TaskIdentifier shutdown_handle;
155 * Cadet handle for the root peer
157 static struct GNUNET_CADET_Handle *h1;
160 * Cadet handle for the first leaf peer
162 static struct GNUNET_CADET_Handle *h2;
165 * Channel handle for the root peer
167 static struct GNUNET_CADET_Channel *ch;
170 * Channel handle for the dest peer
172 static struct GNUNET_CADET_Channel *incoming_ch;
175 * Time we started the data transmission (after channel has been established
178 static struct GNUNET_TIME_Absolute start_time;
183 static struct GNUNET_TESTBED_Peer **testbed_peers;
186 * Statistics operation handle.
188 static struct GNUNET_TESTBED_Operation *stats_op;
193 static unsigned int ka_sent;
196 * Keepalives received.
198 static unsigned int ka_received;
202 * Show the results of the test (banwidth acheived) and log them to GAUGER
207 static struct GNUNET_TIME_Absolute end_time;
208 static struct GNUNET_TIME_Relative total_time;
210 end_time = GNUNET_TIME_absolute_get();
211 total_time = GNUNET_TIME_absolute_get_difference(start_time, end_time);
212 FPRINTF (stderr, "\nResults of test \"%s\"\n", test_name);
213 FPRINTF (stderr, "Test time %s\n",
214 GNUNET_STRINGS_relative_time_to_string (total_time,
216 FPRINTF (stderr, "Test bandwidth: %f kb/s\n",
217 4 * TOTAL_PACKETS * 1.0 / (total_time.rel_value_us / 1000)); // 4bytes * ms
218 FPRINTF (stderr, "Test throughput: %f packets/s\n\n",
219 TOTAL_PACKETS * 1000.0 / (total_time.rel_value_us / 1000)); // packets * ms
220 GAUGER ("CADET", test_name,
221 TOTAL_PACKETS * 1000.0 / (total_time.rel_value_us / 1000),
227 * Shut down peergroup, clean up.
229 * @param cls Closure (unused).
230 * @param tc Task Context.
233 shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
235 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending test.\n");
236 shutdown_handle = GNUNET_SCHEDULER_NO_TASK;
241 * Disconnect from cadet services af all peers, call shutdown.
243 * @param cls Closure (unused).
244 * @param tc Task Context.
247 disconnect_cadet_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
249 long line = (long) cls;
252 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
253 "disconnecting cadet service of peers, called from line %ld\n",
255 disconnect_task = GNUNET_SCHEDULER_NO_TASK;
256 for (i = 0; i < 2; i++)
258 GNUNET_TESTBED_operation_done (t_op[i]);
262 GNUNET_CADET_channel_destroy (ch);
265 if (NULL != incoming_ch)
267 GNUNET_CADET_channel_destroy (incoming_ch);
270 GNUNET_CADET_TEST_cleanup (test_ctx);
271 if (GNUNET_SCHEDULER_NO_TASK != shutdown_handle)
273 GNUNET_SCHEDULER_cancel (shutdown_handle);
275 shutdown_handle = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
280 * Abort test: schedule disconnect and shutdown immediately
282 * @param line Line in the code the abort is requested from (__LINE__).
285 abort_test (long line)
287 if (disconnect_task != GNUNET_SCHEDULER_NO_TASK)
289 GNUNET_SCHEDULER_cancel (disconnect_task);
290 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
296 * Transmit ready callback.
298 * @param cls Closure (message type).
299 * @param size Size of the tranmist buffer.
300 * @param buf Pointer to the beginning of the buffer.
302 * @return Number of bytes written to buf.
305 tmt_rdy (void *cls, size_t size, void *buf);
309 * Task to schedule a new data transmission.
311 * @param cls Closure (peer #).
312 * @param tc Task Context.
315 data_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
317 struct GNUNET_CADET_TransmitHandle *th;
318 struct GNUNET_CADET_Channel *channel;
320 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
323 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Data task\n");
324 if (GNUNET_YES == test_backwards)
326 channel = incoming_ch;
332 th = GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO,
333 GNUNET_TIME_UNIT_FOREVER_REL,
334 size_payload + data_sent,
335 &tmt_rdy, (void *) 1L);
338 unsigned long i = (unsigned long) cls;
340 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Retransmission\n");
343 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, " in 1 ms\n");
344 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS,
345 &data_task, (void *)1UL);
350 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "in %u ms\n", i);
351 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(
352 GNUNET_TIME_UNIT_MILLISECONDS,
354 &data_task, (void *)i);
361 * Transmit ready callback
363 * @param cls Closure (unused).
364 * @param size Size of the buffer we have.
365 * @param buf Buffer to copy data to.
368 tmt_rdy (void *cls, size_t size, void *buf)
370 struct GNUNET_MessageHeader *msg = buf;
374 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
375 "tmt_rdy called, filling buffer\n");
376 msg_size = size_payload + data_sent;
377 if (size < msg_size || NULL == buf)
379 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
380 "size %u, buf %p, data_sent %u, data_received %u\n",
381 size, buf, data_sent, data_received);
382 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ok %u, ok goal %u\n", ok, ok_goal);
383 GNUNET_break (ok >= ok_goal - 2);
387 msg->size = htons (size);
388 msg->type = htons ((long) cls);
389 data = (uint32_t *) &msg[1];
390 *data = htonl (data_sent);
391 if (GNUNET_NO == initialized)
393 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "sending initializer\n");
395 else if (SPEED == test)
398 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " Sent message %d size %u\n",
399 data_sent, msg_size);
400 if (data_sent < TOTAL_PACKETS)
402 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Scheduling message %d\n",
404 GNUNET_SCHEDULER_add_now (&data_task, NULL);
413 * Function is called whenever a message is received.
415 * @param cls closure (set from GNUNET_CADET_connect)
416 * @param channel connection to the other end
417 * @param channel_ctx place to store local state associated with the channel
418 * @param message the actual message
419 * @return GNUNET_OK to keep the connection open,
420 * GNUNET_SYSERR to close it (signal serious error)
423 data_callback (void *cls, struct GNUNET_CADET_Channel *channel,
425 const struct GNUNET_MessageHeader *message)
427 long client = (long) cls;
428 long expected_target_client;
433 GNUNET_CADET_receive_done (channel);
437 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
439 GNUNET_SCHEDULER_cancel (disconnect_task);
440 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
441 &disconnect_cadet_peers,
449 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Root client got a message!\n");
453 GNUNET_assert (client == peers_requested - 1);
454 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Leaf client %li got a message.\n",
458 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Client %li not valid.\n", client);
461 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: (%d/%d)\n", ok, ok_goal);
462 data = (uint32_t *) &message[1];
463 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " payload: (%u)\n", ntohl (*data));
464 if (SPEED == test && GNUNET_YES == test_backwards)
466 expected_target_client = 0L;
470 expected_target_client = peers_requested - 1;
473 if (GNUNET_NO == initialized)
475 initialized = GNUNET_YES;
476 start_time = GNUNET_TIME_absolute_get ();
479 GNUNET_assert (peers_requested - 1 == client);
480 GNUNET_SCHEDULER_add_now (&data_task, NULL);
485 if (client == expected_target_client) // Normally 4
488 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " received data %u\n", data_received);
489 if (SPEED != test || (ok_goal - 2) == ok)
491 GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO,
492 GNUNET_TIME_UNIT_FOREVER_REL,
493 size_payload + data_sent,
494 &tmt_rdy, (void *) 1L);
499 if (data_received < TOTAL_PACKETS)
505 if (test == SPEED_ACK || test == SPEED)
508 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " received ack %u\n", data_ack);
509 GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO,
510 GNUNET_TIME_UNIT_FOREVER_REL,
511 size_payload + data_sent,
512 &tmt_rdy, (void *) 1L);
513 if (data_ack < TOTAL_PACKETS && SPEED != test)
515 if (ok == 2 && SPEED == test)
519 if (test == P2P_SIGNAL)
521 GNUNET_CADET_channel_destroy (incoming_ch);
526 GNUNET_CADET_channel_destroy (ch);
531 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
533 GNUNET_SCHEDULER_cancel (disconnect_task);
534 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
535 &disconnect_cadet_peers,
544 * Stats callback. Finish the stats testbed operation and when all stats have
545 * been iterated, shutdown the test.
548 * @param op the operation that has been finished
549 * @param emsg error message in case the operation has failed; will be NULL if
550 * operation has executed successfully.
553 stats_cont (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
555 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "stats_cont for peer %u\n", cls);
556 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " KA sent: %u, KA received: %u\n",
557 ka_sent, ka_received);
558 if (ka_sent < 2 || ka_sent > ka_received + 1)
560 GNUNET_TESTBED_operation_done (stats_op);
562 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
563 GNUNET_SCHEDULER_cancel (disconnect_task);
564 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
571 * Process statistic values.
574 * @param peer the peer the statistic belong to
575 * @param subsystem name of subsystem that created the statistic
576 * @param name the name of the datum
577 * @param value the current value
578 * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not
579 * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
582 stats_iterator (void *cls, const struct GNUNET_TESTBED_Peer *peer,
583 const char *subsystem, const char *name,
584 uint64_t value, int is_persistent)
586 static const char *s_sent = "# keepalives sent";
587 static const char *s_recv = "# keepalives received";
590 i = GNUNET_TESTBED_get_index (peer);
591 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " %u - %s [%s]: %llu\n",
592 i, subsystem, name, value);
593 if (0 == strncmp (s_sent, name, strlen (s_sent)) && 0 == i)
596 if (0 == strncmp(s_recv, name, strlen (s_recv)) && peers_requested - 1 == i)
604 * Task check that keepalives were sent and received.
606 * @param cls Closure (NULL).
607 * @param tc Task Context.
610 check_keepalives (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
612 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
615 disconnect_task = GNUNET_SCHEDULER_NO_TASK;
616 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "check keepalives\n");
617 GNUNET_CADET_channel_destroy (ch);
618 stats_op = GNUNET_TESTBED_get_statistics (peers_running, testbed_peers,
620 stats_iterator, stats_cont, NULL);
625 * Handlers, for diverse services
627 static struct GNUNET_CADET_MessageHandler handlers[] = {
628 {&data_callback, 1, sizeof (struct GNUNET_MessageHeader)},
634 * Method called whenever another peer has added us to a channel
635 * the other peer initiated.
637 * @param cls Closure.
638 * @param channel New handle to the channel.
639 * @param initiator Peer that started the channel.
640 * @param port Port this channel is connected to.
641 * @param options channel option flags
642 * @return Initial channel context for the channel
643 * (can be NULL -- that's not an error).
646 incoming_channel (void *cls, struct GNUNET_CADET_Channel *channel,
647 const struct GNUNET_PeerIdentity *initiator,
648 uint32_t port, enum GNUNET_CADET_ChannelOption options)
650 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
651 "Incoming channel from %s to peer %d\n",
652 GNUNET_i2s (initiator), (long) cls);
654 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok);
655 if ((long) cls == peers_requested - 1)
656 incoming_ch = channel;
659 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
660 "Incoming channel for unknown client %lu\n", (long) cls);
663 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
665 GNUNET_SCHEDULER_cancel (disconnect_task);
666 if (KEEPALIVE == test)
668 struct GNUNET_TIME_Relative delay;
669 delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS , 5);
671 GNUNET_SCHEDULER_add_delayed (delay, &check_keepalives, NULL);
674 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
675 &disconnect_cadet_peers,
683 * Function called whenever an inbound channel is destroyed. Should clean up
684 * any associated state.
686 * @param cls closure (set from GNUNET_CADET_connect)
687 * @param channel connection to the other end (henceforth invalid)
688 * @param channel_ctx place where local state associated
689 * with the channel is stored
692 channel_cleaner (void *cls, const struct GNUNET_CADET_Channel *channel,
697 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
698 "Incoming channel disconnected at peer %ld\n", i);
699 if (peers_running - 1 == i)
702 GNUNET_break (channel == incoming_ch);
707 if (P2P_SIGNAL == test)
711 GNUNET_break (channel == ch);
715 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
716 "Unknown peer! %d\n", i);
717 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok);
719 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
721 GNUNET_SCHEDULER_cancel (disconnect_task);
722 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
731 * START THE TESTCASE ITSELF, AS WE ARE CONNECTED TO THE CADET SERVICES.
733 * Testcase continues when the root receives confirmation of connected peers,
734 * on callback funtion ch.
736 * @param cls Closure (unsued).
737 * @param tc Task Context.
740 do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
742 enum GNUNET_CADET_ChannelOption flags;
744 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
747 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test_task\n");
749 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
751 GNUNET_SCHEDULER_cancel (disconnect_task);
754 flags = GNUNET_CADET_OPTION_DEFAULT;
755 if (SPEED_REL == test)
758 flags |= GNUNET_CADET_OPTION_RELIABLE;
760 ch = GNUNET_CADET_channel_create (h1, NULL, p_id[1], 1, flags);
762 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
763 &disconnect_cadet_peers,
765 if (KEEPALIVE == test)
766 return; /* Don't send any data. */
768 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
769 "Sending data initializer...\n");
773 GNUNET_CADET_notify_transmit_ready (ch, GNUNET_NO,
774 GNUNET_TIME_UNIT_FOREVER_REL,
775 size_payload, &tmt_rdy, (void *) 1L);
779 * Callback to be called when the requested peer information is available
781 * @param cls the closure from GNUNET_TESTBED_peer_get_information()
782 * @param op the operation this callback corresponds to
783 * @param pinfo the result; will be NULL if the operation has failed
784 * @param emsg error message if the operation has failed;
785 * NULL if the operation is successfull
789 struct GNUNET_TESTBED_Operation *op,
790 const struct GNUNET_TESTBED_PeerInformation *pinfo,
795 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "id callback for %ld\n", i);
797 if (NULL == pinfo || NULL != emsg)
799 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "pi_cb: %s\n", emsg);
800 abort_test (__LINE__);
803 p_id[i] = pinfo->result.id;
804 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " id: %s\n", GNUNET_i2s (p_id[i]));
808 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got all IDs, starting test\n");
809 test_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
814 * test main: start test when all peers are connected
816 * @param cls Closure.
817 * @param ctx Argument to give to GNUNET_CADET_TEST_cleanup on test end.
818 * @param num_peers Number of peers that are running.
819 * @param peers Array of peers.
820 * @param cadetes Handle to each of the CADETs of the peers.
824 struct GNUNET_CADET_TEST_Context *ctx,
825 unsigned int num_peers,
826 struct GNUNET_TESTBED_Peer **peers,
827 struct GNUNET_CADET_Handle **cadets)
829 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test main\n");
832 peers_running = num_peers;
833 GNUNET_assert (peers_running == peers_requested);
834 testbed_peers = peers;
836 h2 = cadets[num_peers - 1];
837 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
838 &disconnect_cadet_peers,
840 shutdown_handle = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
841 &shutdown_task, NULL);
842 t_op[0] = GNUNET_TESTBED_peer_get_information (peers[0],
843 GNUNET_TESTBED_PIT_IDENTITY,
844 &pi_cb, (void *) 0L);
845 t_op[1] = GNUNET_TESTBED_peer_get_information (peers[num_peers - 1],
846 GNUNET_TESTBED_PIT_IDENTITY,
847 &pi_cb, (void *) 1L);
848 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "requested peer ids\n");
856 main (int argc, char *argv[])
858 initialized = GNUNET_NO;
859 static uint32_t ports[2];
860 const char *config_file;
862 GNUNET_log_setup ("test", "DEBUG", NULL);
863 config_file = "test_cadet.conf";
865 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Start\n");
867 /* Find out requested size */
868 if (strstr (argv[0], "_2_") != NULL)
870 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "DIRECT CONNECTIONs\n");
873 else if (strstr (argv[0], "_5_") != NULL)
875 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "5 PEER LINE\n");
880 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "SIZE UNKNOWN, USING 2\n");
884 /* Find out requested test */
885 if (strstr (argv[0], "_forward") != NULL)
887 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "FORWARD\n");
889 test_name = "unicast";
892 else if (strstr (argv[0], "_signal") != NULL)
894 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "SIGNAL\n");
896 test_name = "signal";
899 else if (strstr (argv[0], "_speed_ack") != NULL)
901 /* Test is supposed to generate the following callbacks:
902 * 1 incoming channel (@dest)
903 * TOTAL_PACKETS received data packet (@dest)
904 * TOTAL_PACKETS received data packet (@orig)
905 * 1 received channel destroy (@dest)
907 ok_goal = TOTAL_PACKETS * 2 + 2;
908 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "SPEED_ACK\n");
910 test_name = "speed ack";
912 else if (strstr (argv[0], "_speed") != NULL)
914 /* Test is supposed to generate the following callbacks:
915 * 1 incoming channel (@dest)
916 * 1 initial packet (@dest)
917 * TOTAL_PACKETS received data packet (@dest)
918 * 1 received data packet (@orig)
919 * 1 received channel destroy (@dest)
921 ok_goal = TOTAL_PACKETS + 4;
922 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "SPEED\n");
923 if (strstr (argv[0], "_reliable") != NULL)
926 test_name = "speed reliable";
927 config_file = "test_cadet_drop.conf";
935 else if (strstr (argv[0], "_keepalive") != NULL)
938 /* Test is supposed to generate the following callbacks:
939 * 1 incoming channel (@dest)
941 * 1 received channel destroy (@dest)
947 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "UNKNOWN\n");
952 if (strstr (argv[0], "backwards") != NULL)
954 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "BACKWARDS (LEAF TO ROOT)\n");
955 test_backwards = GNUNET_YES;
956 GNUNET_asprintf (&test_name, "backwards %s", test_name);
962 GNUNET_CADET_TEST_run ("test_cadet_small",
966 NULL, /* tmain cls */
974 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
975 "FAILED! (%d/%d)\n", ok, ok_goal);
978 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "success\n");
982 /* end of test_cadet.c */