2 This file is part of GNUnet.
3 Copyright (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 many messages to send
36 #define TOTAL_PACKETS 500
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 called to shutdown test.
157 static struct GNUNET_SCHEDULER_Task * shutdown_handle;
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 * Time we started the data transmission (after channel has been established
183 static struct GNUNET_TIME_Absolute start_time;
188 static struct GNUNET_TESTBED_Peer **testbed_peers;
191 * Statistics operation handle.
193 static struct GNUNET_TESTBED_Operation *stats_op;
198 static unsigned int ka_sent;
201 * Keepalives received.
203 static unsigned int ka_received;
207 * Get the client number considered as the "target" or "receiver", depending on
208 * the test type and size.
210 * @return Peer # of the target client, either 0 (for backward tests) or
211 * the last peer in the line (for other tests).
214 get_expected_target ()
216 if (SPEED == test && GNUNET_YES == test_backwards)
219 return peers_requested - 1;
223 * Show the results of the test (banwidth acheived) and log them to GAUGER
228 static struct GNUNET_TIME_Absolute end_time;
229 static struct GNUNET_TIME_Relative total_time;
231 end_time = GNUNET_TIME_absolute_get();
232 total_time = GNUNET_TIME_absolute_get_difference(start_time, end_time);
233 FPRINTF (stderr, "\nResults of test \"%s\"\n", test_name);
234 FPRINTF (stderr, "Test time %s\n",
235 GNUNET_STRINGS_relative_time_to_string (total_time,
237 FPRINTF (stderr, "Test bandwidth: %f kb/s\n",
238 4 * TOTAL_PACKETS * 1.0 / (total_time.rel_value_us / 1000)); // 4bytes * ms
239 FPRINTF (stderr, "Test throughput: %f packets/s\n\n",
240 TOTAL_PACKETS * 1000.0 / (total_time.rel_value_us / 1000)); // packets * ms
241 GAUGER ("CADET", test_name,
242 TOTAL_PACKETS * 1000.0 / (total_time.rel_value_us / 1000),
248 * Shut down peergroup, clean up.
250 * @param cls Closure (unused).
251 * @param tc Task Context.
254 shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
256 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending test.\n");
257 shutdown_handle = NULL;
262 * Disconnect from cadet services af all peers, call shutdown.
264 * @param cls Closure (line number from which termination was requested).
265 * @param tc Task Context.
268 disconnect_cadet_peers (void *cls,
269 const struct GNUNET_SCHEDULER_TaskContext *tc)
271 long line = (long) cls;
274 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
275 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
276 "disconnecting cadet peers due to SHUTDOWN! called from %ld\n",
279 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
280 "disconnecting cadet service of peers, called from line %ld\n",
282 disconnect_task = NULL;
283 for (i = 0; i < 2; i++)
285 GNUNET_TESTBED_operation_done (t_op[i]);
289 GNUNET_CADET_channel_destroy (ch);
292 if (NULL != incoming_ch)
294 GNUNET_CADET_channel_destroy (incoming_ch);
297 GNUNET_CADET_TEST_cleanup (test_ctx);
298 if (NULL != shutdown_handle)
300 GNUNET_SCHEDULER_cancel (shutdown_handle);
302 shutdown_handle = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
308 * Stats callback. Finish the stats testbed operation and when all stats have
309 * been iterated, shutdown the test.
311 * @param cls Closure (line number from which termination was requested).
312 * @param op the operation that has been finished
313 * @param emsg error message in case the operation has failed; will be NULL if
314 * operation has executed successfully.
317 stats_cont (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
319 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " KA sent: %u, KA received: %u\n",
320 ka_sent, ka_received);
321 if (KEEPALIVE == test && (ka_sent < 2 || ka_sent > ka_received + 1))
323 GNUNET_TESTBED_operation_done (stats_op);
325 if (NULL != disconnect_task)
326 GNUNET_SCHEDULER_cancel (disconnect_task);
327 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers, cls);
333 * Process statistic values.
335 * @param cls closure (line number, unused)
336 * @param peer the peer the statistic belong to
337 * @param subsystem name of subsystem that created the statistic
338 * @param name the name of the datum
339 * @param value the current value
340 * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not
341 * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
344 stats_iterator (void *cls, const struct GNUNET_TESTBED_Peer *peer,
345 const char *subsystem, const char *name,
346 uint64_t value, int is_persistent)
348 static const char *s_sent = "# keepalives sent";
349 static const char *s_recv = "# keepalives received";
352 i = GNUNET_TESTBED_get_index (peer);
353 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "STATS PEER %u - %s [%s]: %llu\n",
354 i, subsystem, name, value);
355 if (0 == strncmp (s_sent, name, strlen (s_sent)) && 0 == i)
358 if (0 == strncmp(s_recv, name, strlen (s_recv)) && peers_requested - 1 == i)
366 * Task to gather all statistics.
368 * @param cls Closure (NULL).
369 * @param tc Task Context.
372 gather_stats_and_exit (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
374 disconnect_task = NULL;
376 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "gathering statistics\n");
378 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
380 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
388 GNUNET_CADET_channel_destroy (ch);
391 stats_op = GNUNET_TESTBED_get_statistics (peers_running, testbed_peers,
393 stats_iterator, stats_cont, cls);
399 * Abort test: schedule disconnect and shutdown immediately
401 * @param line Line in the code the abort is requested from (__LINE__).
404 abort_test (long line)
406 if (disconnect_task != NULL)
408 GNUNET_SCHEDULER_cancel (disconnect_task);
409 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Aborting test from %ld\n", line);
410 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
416 * Transmit ready callback.
418 * @param cls Closure (message type).
419 * @param size Size of the tranmist buffer.
420 * @param buf Pointer to the beginning of the buffer.
422 * @return Number of bytes written to buf.
425 tmt_rdy (void *cls, size_t size, void *buf);
429 * Task to schedule a new data transmission.
431 * @param cls Closure (peer #).
432 * @param tc Task Context.
435 data_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
437 struct GNUNET_CADET_TransmitHandle *th;
438 struct GNUNET_CADET_Channel *channel;
441 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Data task\n");
443 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
446 if (GNUNET_YES == test_backwards)
448 channel = incoming_ch;
449 src = peers_requested - 1;
462 th = GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO,
463 GNUNET_TIME_UNIT_FOREVER_REL,
464 size_payload + data_sent,
465 &tmt_rdy, (void *) src);
468 unsigned long i = (unsigned long) cls;
470 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Retransmission\n");
473 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, " in 1 ms\n");
474 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS,
475 &data_task, (void *) 1L);
480 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "in %u ms\n", i);
481 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(
482 GNUNET_TIME_UNIT_MILLISECONDS,
484 &data_task, (void *) i);
491 * Transmit ready callback
493 * @param cls Closure (peer # which is sending the data).
494 * @param size Size of the buffer we have.
495 * @param buf Buffer to copy data to.
498 tmt_rdy (void *cls, size_t size, void *buf)
500 struct GNUNET_MessageHeader *msg = buf;
503 long id = (long) cls;
504 unsigned int counter;
506 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tmt_rdy on %ld, filling buffer\n", id);
507 counter = get_expected_target () == id ? ack_sent : data_sent;
508 msg_size = size_payload + counter;
509 if (size < msg_size || NULL == buf)
511 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
512 "size %u, buf %p, data_sent %u, ack_received %u\n",
513 size, buf, data_sent, ack_received);
514 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ok %u, ok goal %u\n", ok, ok_goal);
515 GNUNET_break (ok >= ok_goal - 2);
519 msg->size = htons (msg_size);
520 msg->type = htons (1);
521 data = (uint32_t *) &msg[1];
522 *data = htonl (counter);
523 if (GNUNET_NO == initialized)
525 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "sending initializer\n");
526 msg_size = size_payload + 1000;
527 if (SPEED_ACK == test)
530 else if (SPEED == test || SPEED_ACK == test)
532 if (get_expected_target() == id)
537 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " Sent message %d size %u\n",
539 if (data_sent < TOTAL_PACKETS && SPEED == test)
541 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Scheduling message %d\n",
543 GNUNET_SCHEDULER_add_now (&data_task, NULL);
552 * Function is called whenever a message is received.
554 * @param cls closure (set from GNUNET_CADET_connect)
555 * @param channel connection to the other end
556 * @param channel_ctx place to store local state associated with the channel
557 * @param message the actual message
558 * @return GNUNET_OK to keep the connection open,
559 * GNUNET_SYSERR to close it (signal serious error)
562 data_callback (void *cls, struct GNUNET_CADET_Channel *channel,
564 const struct GNUNET_MessageHeader *message)
566 long client = (long) cls;
567 long expected_target_client;
570 unsigned int counter;
573 counter = get_expected_target () == client ? data_received : ack_received;
575 GNUNET_CADET_receive_done (channel);
579 if (NULL != disconnect_task)
581 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " reschedule timeout\n");
582 GNUNET_SCHEDULER_cancel (disconnect_task);
583 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
584 &gather_stats_and_exit,
592 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Root client got a message!\n");
596 GNUNET_assert (client == peers_requested - 1);
597 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Leaf client %li got a message.\n",
601 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Client %li not valid.\n", client);
604 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: (%d/%d)\n", ok, ok_goal);
605 data = (uint32_t *) &message[1];
606 payload = ntohl (*data);
607 if (payload == counter)
609 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " payload as expected: %u\n", payload);
613 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, " payload %u, expected: %u\n",
616 expected_target_client = get_expected_target ();
618 if (GNUNET_NO == initialized)
620 initialized = GNUNET_YES;
621 start_time = GNUNET_TIME_absolute_get ();
624 GNUNET_assert (peers_requested - 1 == client);
625 GNUNET_SCHEDULER_add_now (&data_task, NULL);
631 if (client == expected_target_client) /* Normally 4 */
634 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " received data %u\n", data_received);
635 if (SPEED != test || (ok_goal - 2) == ok)
638 GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO,
639 GNUNET_TIME_UNIT_FOREVER_REL,
640 size_payload + ack_sent, &tmt_rdy,
646 if (data_received < TOTAL_PACKETS)
650 else /* Normally 0 */
652 if (SPEED_ACK == test || SPEED == test)
655 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " received ack %u\n", ack_received);
656 GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO,
657 GNUNET_TIME_UNIT_FOREVER_REL,
658 size_payload + data_sent, &tmt_rdy,
660 if (ack_received < TOTAL_PACKETS && SPEED != test)
662 if (ok == 2 && SPEED == test)
666 if (test == P2P_SIGNAL)
668 GNUNET_CADET_channel_destroy (incoming_ch);
673 GNUNET_CADET_channel_destroy (ch);
683 * Handlers, for diverse services
685 static struct GNUNET_CADET_MessageHandler handlers[] = {
686 {&data_callback, 1, sizeof (struct GNUNET_MessageHeader)},
692 * Method called whenever another peer has added us to a channel
693 * the other peer initiated.
695 * @param cls Closure.
696 * @param channel New handle to the channel.
697 * @param initiator Peer that started the channel.
698 * @param port Port this channel is connected to.
699 * @param options channel option flags
700 * @return Initial channel context for the channel
701 * (can be NULL -- that's not an error).
704 incoming_channel (void *cls, struct GNUNET_CADET_Channel *channel,
705 const struct GNUNET_PeerIdentity *initiator,
706 uint32_t port, enum GNUNET_CADET_ChannelOption options)
708 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
709 "Incoming channel from %s to peer %d\n",
710 GNUNET_i2s (initiator), (long) cls);
712 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok);
713 if ((long) cls == peers_requested - 1)
714 incoming_ch = channel;
717 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
718 "Incoming channel for unknown client %lu\n", (long) cls);
721 if (NULL != disconnect_task)
723 GNUNET_SCHEDULER_cancel (disconnect_task);
724 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
725 &gather_stats_and_exit,
733 * Function called whenever an inbound channel is destroyed. Should clean up
734 * any associated state.
736 * @param cls closure (set from GNUNET_CADET_connect)
737 * @param channel connection to the other end (henceforth invalid)
738 * @param channel_ctx place where local state associated
739 * with the channel is stored
742 channel_cleaner (void *cls, const struct GNUNET_CADET_Channel *channel,
747 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
748 "Incoming channel disconnected at peer %ld\n", i);
749 if (peers_running - 1 == i)
752 GNUNET_break (channel == incoming_ch);
757 if (P2P_SIGNAL == test)
761 GNUNET_break (channel == ch);
765 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
766 "Unknown peer! %d\n", i);
767 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok);
769 if (NULL != disconnect_task)
771 GNUNET_SCHEDULER_cancel (disconnect_task);
772 disconnect_task = GNUNET_SCHEDULER_add_now (&gather_stats_and_exit,
781 * START THE TESTCASE ITSELF, AS WE ARE CONNECTED TO THE CADET SERVICES.
783 * Testcase continues when the root receives confirmation of connected peers,
784 * on callback funtion ch.
786 * @param cls Closure (unused).
787 * @param tc Task Context.
790 do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
792 enum GNUNET_CADET_ChannelOption flags;
794 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
797 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test_task\n");
799 if (NULL != disconnect_task)
801 GNUNET_SCHEDULER_cancel (disconnect_task);
804 flags = GNUNET_CADET_OPTION_DEFAULT;
805 if (SPEED_REL == test)
808 flags |= GNUNET_CADET_OPTION_RELIABLE;
810 ch = GNUNET_CADET_channel_create (h1, NULL, p_id[1], 1, flags);
812 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
813 &gather_stats_and_exit,
815 if (KEEPALIVE == test)
816 return; /* Don't send any data. */
818 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending data initializer...\n");
823 GNUNET_CADET_notify_transmit_ready (ch, GNUNET_NO,
824 GNUNET_TIME_UNIT_FOREVER_REL,
826 &tmt_rdy, (void *) 0L);
830 * Callback to be called when the requested peer information is available
832 * @param cls the closure from GNUNET_TESTBED_peer_get_information()
833 * @param op the operation this callback corresponds to
834 * @param pinfo the result; will be NULL if the operation has failed
835 * @param emsg error message if the operation has failed;
836 * NULL if the operation is successfull
840 struct GNUNET_TESTBED_Operation *op,
841 const struct GNUNET_TESTBED_PeerInformation *pinfo,
846 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "id callback for %ld\n", i);
848 if (NULL == pinfo || NULL != emsg)
850 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "pi_cb: %s\n", emsg);
851 abort_test (__LINE__);
854 p_id[i] = pinfo->result.id;
855 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " id: %s\n", GNUNET_i2s (p_id[i]));
859 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got all IDs, starting test\n");
860 test_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
865 * test main: start test when all peers are connected
867 * @param cls Closure.
868 * @param ctx Argument to give to GNUNET_CADET_TEST_cleanup on test end.
869 * @param num_peers Number of peers that are running.
870 * @param peers Array of peers.
871 * @param cadetes Handle to each of the CADETs of the peers.
875 struct GNUNET_CADET_TEST_Context *ctx,
876 unsigned int num_peers,
877 struct GNUNET_TESTBED_Peer **peers,
878 struct GNUNET_CADET_Handle **cadets)
880 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test main\n");
883 peers_running = num_peers;
884 GNUNET_assert (peers_running == peers_requested);
885 testbed_peers = peers;
887 h2 = cadets[num_peers - 1];
888 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
889 &disconnect_cadet_peers,
891 shutdown_handle = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
892 &shutdown_task, NULL);
893 t_op[0] = GNUNET_TESTBED_peer_get_information (peers[0],
894 GNUNET_TESTBED_PIT_IDENTITY,
895 &pi_cb, (void *) 0L);
896 t_op[1] = GNUNET_TESTBED_peer_get_information (peers[num_peers - 1],
897 GNUNET_TESTBED_PIT_IDENTITY,
898 &pi_cb, (void *) 1L);
899 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "requested peer ids\n");
907 main (int argc, char *argv[])
909 initialized = GNUNET_NO;
910 static uint32_t ports[2];
911 const char *config_file;
913 GNUNET_log_setup ("test", "DEBUG", NULL);
914 config_file = "test_cadet.conf";
916 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Start\n");
918 /* Find out requested size */
919 if (strstr (argv[0], "_2_") != NULL)
921 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "DIRECT CONNECTIONs\n");
924 else if (strstr (argv[0], "_5_") != NULL)
926 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "5 PEER LINE\n");
931 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "SIZE UNKNOWN, USING 2\n");
935 /* Find out requested test */
936 if (strstr (argv[0], "_forward") != NULL)
938 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "FORWARD\n");
940 test_name = "unicast";
943 else if (strstr (argv[0], "_signal") != NULL)
945 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "SIGNAL\n");
947 test_name = "signal";
950 else if (strstr (argv[0], "_speed_ack") != NULL)
952 /* Test is supposed to generate the following callbacks:
953 * 1 incoming channel (@dest)
954 * TOTAL_PACKETS received data packet (@dest)
955 * TOTAL_PACKETS received data packet (@orig)
956 * 1 received channel destroy (@dest)
958 ok_goal = TOTAL_PACKETS * 2 + 2;
959 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "SPEED_ACK\n");
961 test_name = "speed ack";
963 else if (strstr (argv[0], "_speed") != NULL)
965 /* Test is supposed to generate the following callbacks:
966 * 1 incoming channel (@dest)
967 * 1 initial packet (@dest)
968 * TOTAL_PACKETS received data packet (@dest)
969 * 1 received data packet (@orig)
970 * 1 received channel destroy (@dest)
972 ok_goal = TOTAL_PACKETS + 4;
973 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "SPEED\n");
974 if (strstr (argv[0], "_reliable") != NULL)
977 test_name = "speed reliable";
978 config_file = "test_cadet_drop.conf";
986 else if (strstr (argv[0], "_keepalive") != NULL)
989 /* Test is supposed to generate the following callbacks:
990 * 1 incoming channel (@dest)
992 * 1 received channel destroy (@dest)
998 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "UNKNOWN\n");
1003 if (strstr (argv[0], "backwards") != NULL)
1005 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "BACKWARDS (LEAF TO ROOT)\n");
1006 test_backwards = GNUNET_YES;
1007 GNUNET_asprintf (&test_name, "backwards %s", test_name);
1013 GNUNET_CADET_TEST_run ("test_cadet_small",
1017 NULL, /* tmain cls */
1025 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1026 "FAILED! (%d/%d)\n", ok, ok_goal);
1029 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "success\n");
1033 /* end of test_cadet.c */