2 This file is part of GNUnet.
3 (C) 2009 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 2, 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 testing/test_testing_topology.c
22 * @brief base testcase for testing all the topologies provided
25 #include "gnunet_testing_lib.h"
26 #include "gnunet_core_service.h"
28 #define VERBOSE GNUNET_NO
31 * How long until we fail the whole testcase?
33 #define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600)
36 * How long until we give up on starting the peers?
38 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 500)
40 #define DEFAULT_NUM_PEERS 4
42 #define MAX_OUTSTANDING_CONNECTIONS 300
44 static float fail_percentage = 0.05;
48 static unsigned long long num_peers;
50 static unsigned int total_connections;
52 static unsigned int failed_connections;
54 static unsigned int total_server_connections;
56 static unsigned int total_messages_received;
58 static unsigned int expected_messages;
60 static unsigned int expected_connections;
62 static unsigned long long peers_left;
64 static struct GNUNET_TESTING_PeerGroup *pg;
66 static struct GNUNET_SCHEDULER_Handle *sched;
68 const struct GNUNET_CONFIGURATION_Handle *main_cfg;
70 GNUNET_SCHEDULER_TaskIdentifier die_task;
72 static char *dotOutFileName;
74 static FILE *dotOutFile;
76 static char *topology_string;
78 static char *blacklist_transports;
80 static int transmit_ready_scheduled;
82 static int transmit_ready_failed;
84 static int transmit_ready_called;
86 static enum GNUNET_TESTING_Topology topology;
88 static enum GNUNET_TESTING_Topology blacklist_topology = GNUNET_TESTING_TOPOLOGY_NONE; /* Don't do any blacklisting */
90 static enum GNUNET_TESTING_Topology connection_topology = GNUNET_TESTING_TOPOLOGY_NONE; /* NONE actually means connect all allowed peers */
92 static enum GNUNET_TESTING_TopologyOption connect_topology_option = GNUNET_TESTING_TOPOLOGY_OPTION_ALL;
94 static double connect_topology_option_modifier = 0.0;
96 static char *test_directory;
100 struct GNUNET_TestMessage
103 * Header of the message
105 struct GNUNET_MessageHeader header;
108 * Unique identifier for this message.
113 struct TestMessageContext
115 /* This is a linked list */
116 struct TestMessageContext *next;
118 /* Handle to the sending peer core */
119 struct GNUNET_CORE_Handle *peer1handle;
121 /* Handle to the receiving peer core */
122 struct GNUNET_CORE_Handle *peer2handle;
124 /* Handle to the sending peer daemon */
125 struct GNUNET_TESTING_Daemon *peer1;
127 /* Handle to the receiving peer daemon */
128 struct GNUNET_TESTING_Daemon *peer2;
130 /* Identifier for this message, so we don't disconnect other peers! */
133 /* Task for disconnecting cores, allow task to be cancelled on shutdown */
134 GNUNET_SCHEDULER_TaskIdentifier disconnect_task;
138 static struct TestMessageContext *test_messages;
141 * Check whether peers successfully shut down.
143 void shutdown_callback (void *cls,
149 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
150 "Shutdown of peers failed!\n");
158 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
159 "All peers successfully shut down!\n");
167 GNUNET_assert (pg != NULL);
168 struct TestMessageContext *pos;
169 struct TestMessageContext *free_pos;
171 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
172 "Called finish testing, stopping daemons.\n");
179 if (pos->peer1handle != NULL)
181 GNUNET_CORE_disconnect(pos->peer1handle);
182 pos->peer1handle = NULL;
184 if (pos->peer2handle != NULL)
186 GNUNET_CORE_disconnect(pos->peer2handle);
187 pos->peer2handle = NULL;
191 if (free_pos->disconnect_task != GNUNET_SCHEDULER_NO_TASK)
193 GNUNET_SCHEDULER_cancel(sched, free_pos->disconnect_task);
195 GNUNET_free(free_pos);
198 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
199 "transmit_ready's scheduled %d, failed %d, transmit_ready's called %d\n", transmit_ready_scheduled, transmit_ready_failed, transmit_ready_called);
203 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
204 "Calling daemons_stop\n");
206 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
208 if (dotOutFile != NULL)
210 fprintf(dotOutFile, "}");
219 disconnect_cores (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
221 struct TestMessageContext *pos = cls;
223 /* Disconnect from the respective cores */
225 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
226 "Disconnecting from peer 1 `%4s'\n", GNUNET_i2s (&pos->peer1->id));
228 if (pos->peer1handle != NULL)
229 GNUNET_CORE_disconnect(pos->peer1handle);
231 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
232 "Disconnecting from peer 2 `%4s'\n", GNUNET_i2s (&pos->peer2->id));
234 if (pos->peer2handle != NULL)
235 GNUNET_CORE_disconnect(pos->peer2handle);
236 /* Set handles to NULL so test case can be ended properly */
237 pos->peer1handle = NULL;
238 pos->peer2handle = NULL;
239 pos->disconnect_task = GNUNET_SCHEDULER_NO_TASK;
240 /* Decrement total connections so new can be established */
241 total_server_connections -= 2;
245 process_mtype (void *cls,
246 const struct GNUNET_PeerIdentity *peer,
247 const struct GNUNET_MessageHeader *message,
248 struct GNUNET_TIME_Relative latency,
251 struct TestMessageContext *pos = cls;
252 struct GNUNET_TestMessage *msg = (struct GNUNET_TestMessage *)message;
253 if (pos->uid != ntohl(msg->uid))
256 total_messages_received++;
258 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
259 "Received message from `%4s', type %d.\n", GNUNET_i2s (peer), ntohs(message->type));
260 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
261 "Total messages received %d, expected %d.\n", total_messages_received, expected_messages);
264 if (total_messages_received == expected_messages)
266 GNUNET_SCHEDULER_cancel (sched, die_task);
267 GNUNET_SCHEDULER_add_now (sched, &finish_testing, NULL);
271 pos->disconnect_task = GNUNET_SCHEDULER_add_now(sched, &disconnect_cores, pos);
278 end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
281 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
282 "End badly was called (%s)... stopping daemons.\n", msg);
283 struct TestMessageContext *pos;
284 struct TestMessageContext *free_pos;
289 if (pos->peer1handle != NULL)
291 GNUNET_CORE_disconnect(pos->peer1handle);
292 pos->peer1handle = NULL;
294 if (pos->peer2handle != NULL)
296 GNUNET_CORE_disconnect(pos->peer2handle);
297 pos->peer2handle = NULL;
301 GNUNET_free(free_pos);
306 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
307 ok = 7331; /* Opposite of leet */
310 ok = 401; /* Never got peers started */
312 if (dotOutFile != NULL)
314 fprintf(dotOutFile, "}");
320 transmit_ready (void *cls, size_t size, void *buf)
322 struct GNUNET_TestMessage *m;
323 struct TestMessageContext *pos = cls;
325 GNUNET_assert (buf != NULL);
326 m = (struct GNUNET_TestMessage *) buf;
327 m->header.type = htons (MTYPE);
328 m->header.size = htons (sizeof (struct GNUNET_TestMessage));
329 m->uid = htonl(pos->uid);
330 transmit_ready_called++;
332 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
333 "transmit ready for peer %s\ntransmit_ready's scheduled %d, transmit_ready's called %d\n", GNUNET_i2s(&pos->peer1->id), transmit_ready_scheduled, transmit_ready_called);
335 return sizeof (struct GNUNET_TestMessage);
339 static struct GNUNET_CORE_MessageHandler no_handlers[] = {
343 static struct GNUNET_CORE_MessageHandler handlers[] = {
344 {&process_mtype, MTYPE, sizeof (struct GNUNET_TestMessage)},
349 init_notify_peer2 (void *cls,
350 struct GNUNET_CORE_Handle *server,
351 const struct GNUNET_PeerIdentity *my_identity,
352 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey)
354 struct TestMessageContext *pos = cls;
357 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
358 "Core connection to `%4s' established, scheduling message send\n",
359 GNUNET_i2s (my_identity));
361 total_server_connections++;
363 if (NULL == GNUNET_CORE_notify_transmit_ready (pos->peer1handle,
367 sizeof (struct GNUNET_TestMessage),
368 &transmit_ready, pos))
370 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
371 "RECEIVED NULL when asking core (1) for transmission to peer `%4s'\n",
372 GNUNET_i2s (&pos->peer2->id));
373 transmit_ready_failed++;
377 transmit_ready_scheduled++;
383 init_notify_peer1 (void *cls,
384 struct GNUNET_CORE_Handle *server,
385 const struct GNUNET_PeerIdentity *my_identity,
386 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey)
388 struct TestMessageContext *pos = cls;
389 total_server_connections++;
392 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
393 "Core connection to `%4s' established, setting up handles\n",
394 GNUNET_i2s (my_identity));
398 * Connect to the receiving peer
400 pos->peer2handle = GNUNET_CORE_connect (sched,
408 GNUNET_YES, NULL, GNUNET_YES, handlers);
414 send_test_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
416 struct TestMessageContext *pos = cls;
418 if ((tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN) || (cls == NULL))
421 if (die_task == GNUNET_SCHEDULER_NO_TASK)
423 die_task = GNUNET_SCHEDULER_add_delayed (sched,
425 &end_badly, "from create topology (timeout)");
428 if (total_server_connections >= MAX_OUTSTANDING_CONNECTIONS)
430 GNUNET_SCHEDULER_add_delayed (sched, GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1),
431 &send_test_messages, pos);
432 return; /* Otherwise we'll double schedule messages here! */
436 * Connect to the sending peer
438 pos->peer1handle = GNUNET_CORE_connect (sched,
446 GNUNET_NO, NULL, GNUNET_NO, no_handlers);
448 GNUNET_assert(pos->peer1handle != NULL);
450 if (total_server_connections < MAX_OUTSTANDING_CONNECTIONS)
452 GNUNET_SCHEDULER_add_now (sched,
453 &send_test_messages, pos->next);
457 GNUNET_SCHEDULER_add_delayed (sched, GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1),
458 &send_test_messages, pos->next);
464 topology_callback (void *cls,
465 const struct GNUNET_PeerIdentity *first,
466 const struct GNUNET_PeerIdentity *second,
468 const struct GNUNET_CONFIGURATION_Handle *first_cfg,
469 const struct GNUNET_CONFIGURATION_Handle *second_cfg,
470 struct GNUNET_TESTING_Daemon *first_daemon,
471 struct GNUNET_TESTING_Daemon *second_daemon,
474 struct TestMessageContext *temp_context;
479 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "connected peer %s to peer %s\n",
480 first_daemon->shortname,
481 second_daemon->shortname);
483 temp_context = GNUNET_malloc(sizeof(struct TestMessageContext));
484 temp_context->peer1 = first_daemon;
485 temp_context->peer2 = second_daemon;
486 temp_context->next = test_messages;
487 temp_context->uid = total_connections;
488 temp_context->disconnect_task = GNUNET_SCHEDULER_NO_TASK;
489 test_messages = temp_context;
492 if (dotOutFile != NULL)
493 fprintf(dotOutFile, "\tn%s -- n%s;\n", first_daemon->shortname, second_daemon->shortname);
498 failed_connections++;
499 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to connect peer %s to peer %s with error :\n%s\n",
500 first_daemon->shortname,
501 second_daemon->shortname, emsg);
505 if (total_connections == expected_connections)
508 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
509 "Created %d total connections, which is our target number! Calling send messages.\n",
513 GNUNET_SCHEDULER_cancel (sched, die_task);
514 die_task = GNUNET_SCHEDULER_NO_TASK;
515 GNUNET_SCHEDULER_add_now (sched, &send_test_messages, test_messages);
516 //GNUNET_SCHEDULER_add_delayed (sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 1), &send_test_messages, test_messages);
518 else if (total_connections + failed_connections == expected_connections)
520 if (failed_connections < (unsigned int)(fail_percentage * total_connections))
522 GNUNET_SCHEDULER_cancel (sched, die_task);
523 die_task = GNUNET_SCHEDULER_NO_TASK;
524 GNUNET_SCHEDULER_add_now (sched, &send_test_messages, test_messages);
525 //GNUNET_SCHEDULER_add_delayed (sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 1), &send_test_messages, test_messages);
529 GNUNET_SCHEDULER_cancel (sched, die_task);
530 die_task = GNUNET_SCHEDULER_add_now (sched,
531 &end_badly, "from topology_callback (too many failed connections)");
537 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
538 "Have %d total connections, %d failed connections, Want %d (at least %d)\n",
539 total_connections, failed_connections, expected_connections, expected_connections - (unsigned int)(fail_percentage * expected_connections));
547 expected_connections = -1;
548 if ((pg != NULL) && (peers_left == 0))
550 expected_connections = GNUNET_TESTING_connect_topology (pg, connection_topology, connect_topology_option, connect_topology_option_modifier);
552 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
553 "Have %d expected connections\n", expected_connections);
557 GNUNET_SCHEDULER_cancel (sched, die_task);
558 if (expected_connections == GNUNET_SYSERR)
560 die_task = GNUNET_SCHEDULER_add_now (sched,
561 &end_badly, "from connect topology (bad return)");
564 die_task = GNUNET_SCHEDULER_add_delayed (sched,
566 &end_badly, "from connect topology (timeout)");
572 peers_left = num_peers; /* Reset counter */
573 if (GNUNET_TESTING_create_topology (pg, topology, blacklist_topology, blacklist_transports) != GNUNET_SYSERR)
576 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
577 "Topology set up, now starting peers!\n");
579 GNUNET_TESTING_daemons_continue_startup(pg);
583 GNUNET_SCHEDULER_cancel (sched, die_task);
584 die_task = GNUNET_SCHEDULER_add_now (sched,
585 &end_badly, "from create topology (bad return)");
587 GNUNET_SCHEDULER_cancel (sched, die_task);
588 die_task = GNUNET_SCHEDULER_add_delayed (sched,
590 &end_badly, "from continue startup (timeout)");
595 peers_started_callback (void *cls,
596 const struct GNUNET_PeerIdentity *id,
597 const struct GNUNET_CONFIGURATION_Handle *cfg,
598 struct GNUNET_TESTING_Daemon *d, const char *emsg)
602 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to start daemon with error: `%s'\n",
606 GNUNET_assert (id != NULL);
608 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Started daemon %llu out of %llu\n",
609 (num_peers - peers_left) + 1, num_peers);
615 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
616 "All %d daemons started, now creating topology!\n",
619 GNUNET_SCHEDULER_cancel (sched, die_task);
620 /* Set up task in case topology creation doesn't finish
621 * within a reasonable amount of time */
622 die_task = GNUNET_SCHEDULER_add_delayed (sched,
623 GNUNET_TIME_relative_multiply
624 (GNUNET_TIME_UNIT_MINUTES, 5),
625 &end_badly, "from peers_started_callback");
633 * Callback indicating that the hostkey was created for a peer.
636 * @param id the peer identity
637 * @param d the daemon handle (pretty useless at this point, remove?)
638 * @param emsg non-null on failure
640 void hostkey_callback (void *cls,
641 const struct GNUNET_PeerIdentity *id,
642 struct GNUNET_TESTING_Daemon *d,
647 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Hostkey callback received error: %s\n", emsg);
651 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
652 "Hostkey created for peer `%s'\n",
659 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
660 "All %d hostkeys created, now creating topology!\n",
663 GNUNET_SCHEDULER_cancel (sched, die_task);
664 /* Set up task in case topology creation doesn't finish
665 * within a reasonable amount of time */
666 die_task = GNUNET_SCHEDULER_add_delayed (sched,
667 GNUNET_TIME_relative_multiply
668 (GNUNET_TIME_UNIT_MINUTES, 5),
669 &end_badly, "from hostkey_callback");
670 GNUNET_SCHEDULER_add_now(sched, &create_topology, NULL);
677 struct GNUNET_SCHEDULER_Handle *s,
679 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
682 char * connect_topology_str;
683 char * blacklist_topology_str;
684 char * connect_topology_option_str;
685 char * connect_topology_option_modifier_string;
689 dotOutFile = fopen (dotOutFileName, "w");
690 if (dotOutFile != NULL)
692 fprintf (dotOutFile, "strict graph G {\n");
696 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
697 "Starting daemons based on config file %s\n", cfgfile);
700 if (GNUNET_YES != GNUNET_CONFIGURATION_get_value_string(cfg, "paths", "servicehome", &test_directory))
707 GNUNET_CONFIGURATION_get_value_string(cfg, "testing", "topology",
708 &topology_str)) && (GNUNET_NO == GNUNET_TESTING_topology_get(&topology, topology_str)))
710 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
711 "Invalid topology `%s' given for section %s option %s\n", topology_str, "TESTING", "TOPOLOGY");
712 topology = GNUNET_TESTING_TOPOLOGY_CLIQUE; /* Defaults to NONE, so set better default here */
716 GNUNET_CONFIGURATION_get_value_string(cfg, "testing", "connect_topology",
717 &connect_topology_str)) && (GNUNET_NO == GNUNET_TESTING_topology_get(&connection_topology, connect_topology_str)))
719 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
720 "Invalid connect topology `%s' given for section %s option %s\n", connect_topology_str, "TESTING", "CONNECT_TOPOLOGY");
722 GNUNET_free_non_null(connect_topology_str);
724 GNUNET_CONFIGURATION_get_value_string(cfg, "testing", "connect_topology_option",
725 &connect_topology_option_str)) && (GNUNET_NO == GNUNET_TESTING_topology_option_get(&connect_topology_option, connect_topology_option_str)))
727 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
728 "Invalid connect topology option `%s' given for section %s option %s\n", connect_topology_option_str, "TESTING", "CONNECT_TOPOLOGY_OPTION");
729 connect_topology_option = GNUNET_TESTING_TOPOLOGY_OPTION_ALL; /* Defaults to NONE, set to ALL */
731 GNUNET_free_non_null(connect_topology_option_str);
733 GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "connect_topology_option_modifier",
734 &connect_topology_option_modifier_string))
736 if (sscanf(connect_topology_option_modifier_string, "%lf", &connect_topology_option_modifier) != 1)
738 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
739 _("Invalid value `%s' for option `%s' in section `%s': expected float\n"),
740 connect_topology_option_modifier_string,
741 "connect_topology_option_modifier",
744 GNUNET_free (connect_topology_option_modifier_string);
747 if (GNUNET_YES != GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "blacklist_transports",
748 &blacklist_transports))
749 blacklist_transports = NULL;
752 GNUNET_CONFIGURATION_get_value_string(cfg, "testing", "blacklist_topology",
753 &blacklist_topology_str)) && (GNUNET_NO == GNUNET_TESTING_topology_get(&blacklist_topology, blacklist_topology_str)))
755 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
756 "Invalid topology `%s' given for section %s option %s\n", topology_str, "TESTING", "BLACKLIST_TOPOLOGY");
758 GNUNET_free_non_null(topology_str);
759 GNUNET_free_non_null(blacklist_topology_str);
762 GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "num_peers",
764 num_peers = DEFAULT_NUM_PEERS;
768 peers_left = num_peers;
770 /* Set up a task to end testing if peer start fails */
771 die_task = GNUNET_SCHEDULER_add_delayed (sched,
772 GNUNET_TIME_relative_multiply
773 (GNUNET_TIME_UNIT_MINUTES, 5),
774 &end_badly, "didn't start all daemons in reasonable amount of time!!!");
776 pg = GNUNET_TESTING_daemons_start (sched, cfg,
777 peers_left, TIMEOUT, &hostkey_callback, NULL, &peers_started_callback, NULL,
778 &topology_callback, NULL, NULL);
786 char *config_file_name;
787 GNUNET_asprintf(&binary_name, "test-testing-topology-%s", topology_string);
788 GNUNET_asprintf(&config_file_name, "test_testing_data_topology_%s.conf", topology_string);
790 char *const argv[] = {binary_name,
798 struct GNUNET_GETOPT_CommandLineOption options[] = {
799 GNUNET_GETOPT_OPTION_END
801 ret = GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
802 argv, binary_name, "nohelp",
804 if (ret != GNUNET_OK)
806 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "`test-testing-topology-%s': Failed with error code %d\n", topology_string, ret);
808 GNUNET_free(binary_name);
809 GNUNET_free(config_file_name);
814 main (int argc, char *argv[])
817 char *binary_start_pos;
818 char *our_binary_name;
820 binary_start_pos = rindex(argv[0], '/');
821 topology_string = strstr (binary_start_pos,
823 GNUNET_assert (topology_string != NULL);
825 topology_string = strstr (topology_string, "_");
826 GNUNET_assert (topology_string != NULL);
829 GNUNET_asprintf(&our_binary_name, "test-testing-topology_%s", topology_string);
830 GNUNET_asprintf(&dotOutFileName, "topology_%s.dot", topology_string);
832 GNUNET_log_setup (our_binary_name,
842 * Need to remove base directory, subdirectories taken care
843 * of by the testing framework.
845 if (GNUNET_DISK_directory_remove (test_directory) != GNUNET_OK)
847 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Failed to remove testing directory %s\n", test_directory);
849 GNUNET_free(our_binary_name);
853 /* end of test_testing_topology.c */