2 This file is part of GNUnet.
3 Copyright (C) 2011 GNUnet e.V.
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., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, 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 many messages to send
36 #define TOTAL_PACKETS 200 /* Cannot exceed 64k! */
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, 20)
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 acknowledgements sent.
125 * Number of payload packed explicitly (app level) acknowledged.
127 static int ack_received;
130 * Total number of peers asked to run.
132 static unsigned long long peers_requested;
135 * Number of currently running peers (should be same as @c peers_requested).
137 static unsigned long long peers_running;
140 * Test context (to shut down).
142 struct GNUNET_CADET_TEST_Context *test_ctx;
145 * Task called to disconnect peers.
147 static struct GNUNET_SCHEDULER_Task *disconnect_task;
150 * Task To perform tests
152 static struct GNUNET_SCHEDULER_Task *test_task;
155 * Task runnining #data_task().
157 static struct GNUNET_SCHEDULER_Task *data_job;
160 * Cadet handle for the root peer
162 static struct GNUNET_CADET_Handle *h1;
165 * Cadet handle for the first leaf peer
167 static struct GNUNET_CADET_Handle *h2;
170 * Channel handle for the root peer
172 static struct GNUNET_CADET_Channel *ch;
175 * Channel handle for the dest peer
177 static struct GNUNET_CADET_Channel *incoming_ch;
180 * Transmit handle for root data calls
182 static struct GNUNET_CADET_TransmitHandle *th;
185 * Transmit handle for root data calls
187 static struct GNUNET_CADET_TransmitHandle *incoming_th;
191 * Time we started the data transmission (after channel has been established
194 static struct GNUNET_TIME_Absolute start_time;
199 static struct GNUNET_TESTBED_Peer **testbed_peers;
202 * Statistics operation handle.
204 static struct GNUNET_TESTBED_Operation *stats_op;
209 static unsigned int ka_sent;
212 * Keepalives received.
214 static unsigned int ka_received;
218 * Get the client number considered as the "target" or "receiver", depending on
219 * the test type and size.
221 * @return Peer # of the target client, either 0 (for backward tests) or
222 * the last peer in the line (for other tests).
225 get_expected_target ()
227 if (SPEED == test && GNUNET_YES == test_backwards)
230 return peers_requested - 1;
235 * Show the results of the test (banwidth acheived) and log them to GAUGER
240 static struct GNUNET_TIME_Absolute end_time;
241 static struct GNUNET_TIME_Relative total_time;
243 end_time = GNUNET_TIME_absolute_get();
244 total_time = GNUNET_TIME_absolute_get_difference(start_time, end_time);
245 FPRINTF (stderr, "\nResults of test \"%s\"\n", test_name);
246 FPRINTF (stderr, "Test time %s\n",
247 GNUNET_STRINGS_relative_time_to_string (total_time,
249 FPRINTF (stderr, "Test bandwidth: %f kb/s\n",
250 4 * TOTAL_PACKETS * 1.0 / (total_time.rel_value_us / 1000)); // 4bytes * ms
251 FPRINTF (stderr, "Test throughput: %f packets/s\n\n",
252 TOTAL_PACKETS * 1000.0 / (total_time.rel_value_us / 1000)); // packets * ms
253 GAUGER ("CADET", test_name,
254 TOTAL_PACKETS * 1000.0 / (total_time.rel_value_us / 1000),
260 * Disconnect from cadet services af all peers, call shutdown.
262 * @param cls Closure (line number from which termination was requested).
263 * @param tc Task Context.
266 disconnect_cadet_peers (void *cls)
268 long line = (long) cls;
271 disconnect_task = NULL;
272 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
273 "disconnecting cadet service of peers, called from line %ld\n",
275 for (i = 0; i < 2; i++)
277 GNUNET_TESTBED_operation_done (t_op[i]);
283 GNUNET_CADET_notify_transmit_ready_cancel (th);
286 GNUNET_CADET_channel_destroy (ch);
289 if (NULL != incoming_ch)
291 if (NULL != incoming_th)
293 GNUNET_CADET_notify_transmit_ready_cancel (incoming_th);
296 GNUNET_CADET_channel_destroy (incoming_ch);
299 GNUNET_CADET_TEST_cleanup (test_ctx);
300 GNUNET_SCHEDULER_shutdown ();
305 * Shut down peergroup, clean up.
307 * @param cls Closure (unused).
308 * @param tc Task Context.
311 shutdown_task (void *cls)
313 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending test.\n");
314 if (NULL != data_job)
316 GNUNET_SCHEDULER_cancel (data_job);
319 if (NULL != test_task)
321 GNUNET_SCHEDULER_cancel (test_task);
324 if (NULL != disconnect_task)
326 GNUNET_SCHEDULER_cancel (disconnect_task);
327 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
334 * Stats callback. Finish the stats testbed operation and when all stats have
335 * been iterated, shutdown the test.
337 * @param cls Closure (line number from which termination was requested).
338 * @param op the operation that has been finished
339 * @param emsg error message in case the operation has failed; will be NULL if
340 * operation has executed successfully.
343 stats_cont (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
345 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " KA sent: %u, KA received: %u\n",
346 ka_sent, ka_received);
347 if (KEEPALIVE == test && (ka_sent < 2 || ka_sent > ka_received + 1))
349 GNUNET_TESTBED_operation_done (stats_op);
351 if (NULL != disconnect_task)
352 GNUNET_SCHEDULER_cancel (disconnect_task);
353 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
359 * Process statistic values.
361 * @param cls closure (line number, unused)
362 * @param peer the peer the statistic belong to
363 * @param subsystem name of subsystem that created the statistic
364 * @param name the name of the datum
365 * @param value the current value
366 * @param is_persistent #GNUNET_YES if the value is persistent, #GNUNET_NO if not
367 * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration
370 stats_iterator (void *cls,
371 const struct GNUNET_TESTBED_Peer *peer,
372 const char *subsystem,
377 static const char *s_sent = "# keepalives sent";
378 static const char *s_recv = "# keepalives received";
381 i = GNUNET_TESTBED_get_index (peer);
382 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
383 "STATS PEER %u - %s [%s]: %llu\n",
387 (unsigned long long) value);
388 if (0 == strncmp (s_sent, name, strlen (s_sent)) && 0 == i)
391 if (0 == strncmp(s_recv, name, strlen (s_recv)) && peers_requested - 1 == i)
399 * Task to gather all statistics.
401 * @param cls Closure (NULL).
404 gather_stats_and_exit (void *cls)
408 disconnect_task = NULL;
409 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
410 "gathering statistics from line %d\n",
416 GNUNET_CADET_notify_transmit_ready_cancel (th);
419 GNUNET_CADET_channel_destroy (ch);
422 stats_op = GNUNET_TESTBED_get_statistics (peers_running, testbed_peers,
424 stats_iterator, stats_cont, cls);
430 * Abort test: schedule disconnect and shutdown immediately
432 * @param line Line in the code the abort is requested from (__LINE__).
435 abort_test (long line)
437 if (disconnect_task != NULL)
439 GNUNET_SCHEDULER_cancel (disconnect_task);
440 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Aborting test from %ld\n", line);
441 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
447 * Transmit ready callback.
449 * @param cls Closure (message type).
450 * @param size Size of the tranmist buffer.
451 * @param buf Pointer to the beginning of the buffer.
453 * @return Number of bytes written to buf.
456 tmt_rdy (void *cls, size_t size, void *buf);
460 * Task to request a new data transmission.
462 * @param cls Closure (peer #).
465 data_task (void *cls)
467 struct GNUNET_CADET_Channel *channel;
468 static struct GNUNET_CADET_TransmitHandle **pth;
472 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Data task\n");
473 if (GNUNET_YES == test_backwards)
475 channel = incoming_ch;
477 src = peers_requested - 1;
486 GNUNET_assert (NULL != channel);
487 GNUNET_assert (NULL == *pth);
489 *pth = GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO,
490 GNUNET_TIME_UNIT_FOREVER_REL,
491 size_payload + data_sent,
492 &tmt_rdy, (void *) src);
495 unsigned long i = (unsigned long) cls;
497 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Retransmission\n");
500 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, " in 1 ms\n");
501 data_job = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS,
502 &data_task, (void *) 1L);
507 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
509 (unsigned long long) i);
510 data_job = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,
512 &data_task, (void *) i);
519 * Transmit ready callback
521 * @param cls Closure (peer # which is sending the data).
522 * @param size Size of the buffer we have.
523 * @param buf Buffer to copy data to.
526 tmt_rdy (void *cls, size_t size, void *buf)
528 struct GNUNET_MessageHeader *msg = buf;
531 long id = (long) cls;
532 unsigned int counter;
534 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tmt_rdy on %ld, filling buffer\n", id);
537 else if ((peers_requested - 1) == id)
541 counter = get_expected_target () == id ? ack_sent : data_sent;
542 msg_size = size_payload + counter;
543 if (size < msg_size || NULL == buf)
545 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
546 "size %u, buf %p, data_sent %u, ack_received %u\n",
551 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ok %u, ok goal %u\n", ok, ok_goal);
552 GNUNET_break (ok >= ok_goal - 2);
556 msg->size = htons (msg_size);
557 msg->type = htons (1);
558 data = (uint32_t *) &msg[1];
559 *data = htonl (counter);
560 if (GNUNET_NO == initialized)
562 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "sending initializer\n");
563 msg_size = size_payload + 1000;
564 if (SPEED_ACK == test)
567 else if (SPEED == test || SPEED_ACK == test)
569 if (get_expected_target() == id)
574 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
575 " Sent message %u size %u\n",
577 (unsigned int) msg_size);
578 if (data_sent < TOTAL_PACKETS && SPEED == test)
580 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Scheduling message %d\n",
582 data_job = GNUNET_SCHEDULER_add_now (&data_task, NULL);
591 * Function is called whenever a message is received.
593 * @param cls closure (set from GNUNET_CADET_connect, peer number)
594 * @param channel connection to the other end
595 * @param channel_ctx place to store local state associated with the channel
596 * @param message the actual message
597 * @return GNUNET_OK to keep the connection open,
598 * GNUNET_SYSERR to close it (signal serious error)
601 data_callback (void *cls, struct GNUNET_CADET_Channel *channel,
603 const struct GNUNET_MessageHeader *message)
605 struct GNUNET_CADET_TransmitHandle **pth;
606 long client = (long) cls;
607 long expected_target_client;
610 unsigned int counter;
613 counter = get_expected_target () == client ? data_received : ack_received;
615 GNUNET_CADET_receive_done (channel);
619 if (NULL != disconnect_task)
621 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " reschedule timeout\n");
622 GNUNET_SCHEDULER_cancel (disconnect_task);
623 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
624 &gather_stats_and_exit,
632 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Root client got a message!\n");
633 GNUNET_assert (channel == ch);
638 GNUNET_assert (client == peers_requested - 1);
639 GNUNET_assert (channel == incoming_ch);
641 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Leaf client %ld got a message.\n",
645 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Client %ld not valid.\n", client);
648 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: (%d/%d)\n", ok, ok_goal);
649 data = (uint32_t *) &message[1];
650 payload = ntohl (*data);
651 if (payload == counter)
653 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " payload as expected: %u\n", payload);
657 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, " payload %u, expected: %u\n",
660 expected_target_client = get_expected_target ();
662 if (GNUNET_NO == initialized)
664 initialized = GNUNET_YES;
665 start_time = GNUNET_TIME_absolute_get ();
668 GNUNET_assert (peers_requested - 1 == client);
669 data_job = GNUNET_SCHEDULER_add_now (&data_task, NULL);
675 if (client == expected_target_client) /* Normally 4 */
678 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " received data %u\n", data_received);
679 if (SPEED != test || (ok_goal - 2) == ok)
682 GNUNET_assert (NULL == *pth);
683 *pth = GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO,
684 GNUNET_TIME_UNIT_FOREVER_REL,
685 size_payload + ack_sent,
686 &tmt_rdy, (void *) client);
691 if (data_received < TOTAL_PACKETS)
695 else /* Normally 0 */
697 if (SPEED_ACK == test || SPEED == test)
700 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " received ack %u\n", ack_received);
702 GNUNET_assert (NULL == *pth);
703 *pth = GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO,
704 GNUNET_TIME_UNIT_FOREVER_REL,
705 size_payload + data_sent,
706 &tmt_rdy, (void *) client);
707 if (ack_received < TOTAL_PACKETS && SPEED != test)
709 if (ok == 2 && SPEED == test)
713 if (test == P2P_SIGNAL)
715 if (NULL != incoming_th)
717 GNUNET_CADET_notify_transmit_ready_cancel (incoming_th);
720 GNUNET_CADET_channel_destroy (incoming_ch);
727 GNUNET_CADET_notify_transmit_ready_cancel (th);
730 GNUNET_CADET_channel_destroy (ch);
740 * Data handlers for every message type of CADET's payload.
741 * {callback_function, message_type, size_expected}
743 static struct GNUNET_CADET_MessageHandler handlers[] = {
744 {&data_callback, 1, sizeof (struct GNUNET_MessageHeader)},
750 * Method called whenever another peer has added us to a channel
751 * the other peer initiated.
753 * @param cls Closure.
754 * @param channel New handle to the channel.
755 * @param initiator Peer that started the channel.
756 * @param port Port this channel is connected to.
757 * @param options channel option flags
758 * @return Initial channel context for the channel
759 * (can be NULL -- that's not an error).
762 incoming_channel (void *cls, struct GNUNET_CADET_Channel *channel,
763 const struct GNUNET_PeerIdentity *initiator,
764 uint32_t port, enum GNUNET_CADET_ChannelOption options)
766 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
767 "Incoming channel from %s to peer %d\n",
768 GNUNET_i2s (initiator),
771 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok);
772 if ((long) cls == peers_requested - 1)
773 incoming_ch = channel;
776 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
777 "Incoming channel for unknown client %lu\n", (long) cls);
780 if (NULL != disconnect_task)
782 GNUNET_SCHEDULER_cancel (disconnect_task);
783 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
784 &gather_stats_and_exit,
792 * Function called whenever an inbound channel is destroyed. Should clean up
793 * any associated state.
795 * @param cls closure (set from GNUNET_CADET_connect, peer number)
796 * @param channel connection to the other end (henceforth invalid)
797 * @param channel_ctx place where local state associated
798 * with the channel is stored
801 channel_cleaner (void *cls, const struct GNUNET_CADET_Channel *channel,
806 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
807 "Incoming channel disconnected at peer %ld\n", i);
808 if (peers_running - 1 == i)
811 GNUNET_break (channel == incoming_ch);
816 if (P2P_SIGNAL == test)
820 GNUNET_break (channel == ch);
824 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
825 "Unknown peer! %d\n",
827 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok);
829 if (NULL != disconnect_task)
831 GNUNET_SCHEDULER_cancel (disconnect_task);
832 disconnect_task = GNUNET_SCHEDULER_add_now (&gather_stats_and_exit,
841 * START THE TESTCASE ITSELF, AS WE ARE CONNECTED TO THE CADET SERVICES.
843 * Testcase continues when the root receives confirmation of connected peers,
844 * on callback function ch.
846 * @param cls Closure (unused).
851 enum GNUNET_CADET_ChannelOption flags;
854 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "do_test\n");
856 if (NULL != disconnect_task)
858 GNUNET_SCHEDULER_cancel (disconnect_task);
859 disconnect_task = NULL;
862 flags = GNUNET_CADET_OPTION_DEFAULT;
863 if (SPEED_REL == test)
866 flags |= GNUNET_CADET_OPTION_RELIABLE;
868 ch = GNUNET_CADET_channel_create (h1, NULL, p_id[1], 1, flags);
870 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
871 &gather_stats_and_exit,
873 if (KEEPALIVE == test)
874 return; /* Don't send any data. */
876 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending data initializer...\n");
881 th = GNUNET_CADET_notify_transmit_ready (ch, GNUNET_NO,
882 GNUNET_TIME_UNIT_FOREVER_REL,
884 &tmt_rdy, (void *) 0L);
889 * Callback to be called when the requested peer information is available
891 * @param cls the closure from GNUNET_TESTBED_peer_get_information()
892 * @param op the operation this callback corresponds to
893 * @param pinfo the result; will be NULL if the operation has failed
894 * @param emsg error message if the operation has failed;
895 * NULL if the operation is successfull
899 struct GNUNET_TESTBED_Operation *op,
900 const struct GNUNET_TESTBED_PeerInformation *pinfo,
905 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "id callback for %ld\n", i);
907 if (NULL == pinfo || NULL != emsg)
909 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "pi_cb: %s\n", emsg);
910 abort_test (__LINE__);
913 p_id[i] = pinfo->result.id;
914 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " id: %s\n", GNUNET_i2s (p_id[i]));
918 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got all IDs, starting test\n");
919 test_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
924 * test main: start test when all peers are connected
926 * @param cls Closure.
927 * @param ctx Argument to give to GNUNET_CADET_TEST_cleanup on test end.
928 * @param num_peers Number of peers that are running.
929 * @param peers Array of peers.
930 * @param cadetes Handle to each of the CADETs of the peers.
934 struct GNUNET_CADET_TEST_Context *ctx,
935 unsigned int num_peers,
936 struct GNUNET_TESTBED_Peer **peers,
937 struct GNUNET_CADET_Handle **cadets)
939 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test main\n");
942 peers_running = num_peers;
943 GNUNET_assert (peers_running == peers_requested);
944 testbed_peers = peers;
946 h2 = cadets[num_peers - 1];
947 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
948 &disconnect_cadet_peers,
950 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
951 t_op[0] = GNUNET_TESTBED_peer_get_information (peers[0],
952 GNUNET_TESTBED_PIT_IDENTITY,
953 &pi_cb, (void *) 0L);
954 t_op[1] = GNUNET_TESTBED_peer_get_information (peers[num_peers - 1],
955 GNUNET_TESTBED_PIT_IDENTITY,
956 &pi_cb, (void *) 1L);
957 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "requested peer ids\n");
965 main (int argc, char *argv[])
967 initialized = GNUNET_NO;
968 static uint32_t ports[2];
969 const char *config_file;
971 GNUNET_log_setup ("test", "DEBUG", NULL);
972 config_file = "test_cadet.conf";
974 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Start\n");
976 /* Find out requested size */
977 if (strstr (argv[0], "_2_") != NULL)
979 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "DIRECT CONNECTIONs\n");
982 else if (strstr (argv[0], "_5_") != NULL)
984 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "5 PEER LINE\n");
989 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "SIZE UNKNOWN, USING 2\n");
993 /* Find out requested test */
994 if (strstr (argv[0], "_forward") != NULL)
996 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "FORWARD\n");
998 test_name = "unicast";
1001 else if (strstr (argv[0], "_signal") != NULL)
1003 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "SIGNAL\n");
1005 test_name = "signal";
1008 else if (strstr (argv[0], "_speed_ack") != NULL)
1010 /* Test is supposed to generate the following callbacks:
1011 * 1 incoming channel (@dest)
1012 * TOTAL_PACKETS received data packet (@dest)
1013 * TOTAL_PACKETS received data packet (@orig)
1014 * 1 received channel destroy (@dest)
1016 ok_goal = TOTAL_PACKETS * 2 + 2;
1017 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "SPEED_ACK\n");
1019 test_name = "speed ack";
1021 else if (strstr (argv[0], "_speed") != NULL)
1023 /* Test is supposed to generate the following callbacks:
1024 * 1 incoming channel (@dest)
1025 * 1 initial packet (@dest)
1026 * TOTAL_PACKETS received data packet (@dest)
1027 * 1 received data packet (@orig)
1028 * 1 received channel destroy (@dest)
1030 ok_goal = TOTAL_PACKETS + 4;
1031 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "SPEED\n");
1032 if (strstr (argv[0], "_reliable") != NULL)
1035 test_name = "speed reliable";
1036 config_file = "test_cadet_drop.conf";
1041 test_name = "speed";
1044 else if (strstr (argv[0], "_keepalive") != NULL)
1047 /* Test is supposed to generate the following callbacks:
1048 * 1 incoming channel (@dest)
1050 * 1 received channel destroy (@dest)
1056 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "UNKNOWN\n");
1061 if (strstr (argv[0], "backwards") != NULL)
1063 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "BACKWARDS (LEAF TO ROOT)\n");
1064 test_backwards = GNUNET_YES;
1065 GNUNET_asprintf (&test_name, "backwards %s", test_name);
1071 GNUNET_CADET_TEST_run ("test_cadet_small",
1075 NULL, /* tmain cls */
1083 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1084 "FAILED! (%d/%d)\n", ok, ok_goal);
1087 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "success\n");
1091 /* end of test_cadet.c */