aboutsummaryrefslogtreecommitdiff
path: root/src/testing/test_testing_topology.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-12-30 22:42:04 +0000
committerChristian Grothoff <christian@grothoff.org>2011-12-30 22:42:04 +0000
commit416c2f5a713b93ba689a8cd1e038682a53e6bc17 (patch)
tree987f51d9edfddc02afe1524df5e1156b920c71d4 /src/testing/test_testing_topology.c
parentfceec98e767bce7ad2c24dde73cdcf8837e04013 (diff)
downloadgnunet-416c2f5a713b93ba689a8cd1e038682a53e6bc17.tar.gz
gnunet-416c2f5a713b93ba689a8cd1e038682a53e6bc17.zip
-LRN: use FPRINTF -- #2051
Diffstat (limited to 'src/testing/test_testing_topology.c')
-rw-r--r--src/testing/test_testing_topology.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/testing/test_testing_topology.c b/src/testing/test_testing_topology.c
index 7d0c0da5f..17f3be89a 100644
--- a/src/testing/test_testing_topology.c
+++ b/src/testing/test_testing_topology.c
@@ -253,8 +253,8 @@ finish_testing ()
253 253
254 if (dotOutFile != NULL) 254 if (dotOutFile != NULL)
255 { 255 {
256 fprintf (dotOutFile, "}"); 256 FPRINTF (dotOutFile, "%s", "}");
257 fclose (dotOutFile); 257 FCLOSE (dotOutFile);
258 } 258 }
259 259
260 ok = 0; 260 ok = 0;
@@ -326,19 +326,19 @@ topology_cb (void *cls, const struct GNUNET_PeerIdentity *first,
326 { 326 {
327 if (outfile != NULL) 327 if (outfile != NULL)
328 { 328 {
329 fprintf (outfile, "\t\"%s\" -- ", GNUNET_i2s (first)); 329 FPRINTF (outfile, "\t\"%s\" -- ", GNUNET_i2s (first));
330 fprintf (outfile, "\"%s\";\n", GNUNET_i2s (second)); 330 FPRINTF (outfile, "\"%s\";\n", GNUNET_i2s (second));
331 } 331 }
332 topology_connections++; 332 topology_connections++;
333 } 333 }
334 else 334 else
335 { 335 {
336 fprintf (stderr, 336 FPRINTF (stderr,
337 "Finished iterating over topology, %d total connections!\n", 337 "Finished iterating over topology, %d total connections!\n",
338 topology_connections); 338 topology_connections);
339 if (outfile != NULL) 339 if (outfile != NULL)
340 { 340 {
341 fprintf (outfile, "}\n"); 341 FPRINTF (outfile, "%s", "}\n");
342 fclose (outfile); 342 fclose (outfile);
343#if DO_STATS 343#if DO_STATS
344 GNUNET_TESTING_get_statistics (pg, &stats_finished, &stats_print, NULL); 344 GNUNET_TESTING_get_statistics (pg, &stats_finished, &stats_print, NULL);
@@ -366,16 +366,16 @@ process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
366 if ((total_messages_received) % modnum == 0) 366 if ((total_messages_received) % modnum == 0)
367 { 367 {
368 if (total_messages_received == 0) 368 if (total_messages_received == 0)
369 fprintf (stdout, "0%%"); 369 FPRINTF (stdout, "%s", "0%%");
370 else 370 else
371 fprintf (stdout, "%d%%", 371 FPRINTF (stdout, "%d%%",
372 (int) (((float) total_messages_received / expected_messages) * 372 (int) (((float) total_messages_received / expected_messages) *
373 100)); 373 100));
374 374
375 } 375 }
376 else if (total_messages_received % dotnum == 0) 376 else if (total_messages_received % dotnum == 0)
377 { 377 {
378 fprintf (stdout, "."); 378 FPRINTF (stdout, "%s", ".");
379 } 379 }
380 fflush (stdout); 380 fflush (stdout);
381#endif 381#endif
@@ -394,7 +394,7 @@ process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
394 if (total_messages_received == expected_messages) 394 if (total_messages_received == expected_messages)
395 { 395 {
396#if PROGRESS_BARS 396#if PROGRESS_BARS
397 fprintf (stdout, "100%%]\n"); 397 FPRINTF (stdout, "%s", "100%%]\n");
398#endif 398#endif
399 GNUNET_SCHEDULER_cancel (die_task); 399 GNUNET_SCHEDULER_cancel (die_task);
400 GNUNET_asprintf (&dotOutFileNameFinished, "%s.dot", "final_topology"); 400 GNUNET_asprintf (&dotOutFileNameFinished, "%s.dot", "final_topology");
@@ -402,7 +402,7 @@ process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
402 GNUNET_free (dotOutFileNameFinished); 402 GNUNET_free (dotOutFileNameFinished);
403 if (dotOutFileFinished != NULL) 403 if (dotOutFileFinished != NULL)
404 { 404 {
405 fprintf (dotOutFileFinished, "strict graph G {\n"); 405 FPRINTF (dotOutFileFinished, "%s", "strict graph G {\n");
406 } 406 }
407 topology_connections = 0; 407 topology_connections = 0;
408 GNUNET_TESTING_get_topology (pg, &topology_cb, dotOutFileFinished); 408 GNUNET_TESTING_get_topology (pg, &topology_cb, dotOutFileFinished);
@@ -464,7 +464,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
464 464
465 if (dotOutFile != NULL) 465 if (dotOutFile != NULL)
466 { 466 {
467 fprintf (dotOutFile, "}"); 467 FPRINTF (dotOutFile, "%s", "}");
468 fclose (dotOutFile); 468 fclose (dotOutFile);
469 } 469 }
470} 470}
@@ -680,16 +680,16 @@ topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
680 if ((total_connections) % modnum == 0) 680 if ((total_connections) % modnum == 0)
681 { 681 {
682 if (total_connections == 0) 682 if (total_connections == 0)
683 fprintf (stdout, "0%%"); 683 FPRINTF (stdout, "%s", "0%%");
684 else 684 else
685 fprintf (stdout, "%d%%", 685 FPRINTF (stdout, "%d%%",
686 (int) (((float) total_connections / expected_connections) * 686 (int) (((float) total_connections / expected_connections) *
687 100)); 687 100));
688 688
689 } 689 }
690 else if (total_connections % dotnum == 0) 690 else if (total_connections % dotnum == 0)
691 { 691 {
692 fprintf (stdout, "."); 692 FPRINTF (stdout, "%s", ".");
693 } 693 }
694 fflush (stdout); 694 fflush (stdout);
695#endif 695#endif
@@ -708,7 +708,7 @@ topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
708 708
709 expected_messages++; 709 expected_messages++;
710 if (dotOutFile != NULL) 710 if (dotOutFile != NULL)
711 fprintf (dotOutFile, "\tn%s -- n%s;\n", first_daemon->shortname, 711 FPRINTF (dotOutFile, "\tn%s -- n%s;\n", first_daemon->shortname,
712 second_daemon->shortname); 712 second_daemon->shortname);
713 } 713 }
714#if VERBOSE 714#if VERBOSE
@@ -724,7 +724,7 @@ topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
724 if (total_connections == expected_connections) 724 if (total_connections == expected_connections)
725 { 725 {
726#if PROGRESS_BARS 726#if PROGRESS_BARS
727 fprintf (stdout, "100%%]\n"); 727 FPRINTF (stdout, "%s", "100%%]\n");
728#endif 728#endif
729#if VERBOSE 729#if VERBOSE
730 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 730 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -740,7 +740,7 @@ topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
740 GNUNET_SCHEDULER_cancel (die_task); 740 GNUNET_SCHEDULER_cancel (die_task);
741 die_task = GNUNET_SCHEDULER_NO_TASK; 741 die_task = GNUNET_SCHEDULER_NO_TASK;
742#if DELAY_FOR_LOGGING 742#if DELAY_FOR_LOGGING
743 fprintf (stdout, "Sending test messages in 10 seconds.\n"); 743 FPRINTF (stdout, "%s", "Sending test messages in 10 seconds.\n");
744 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 744 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
745 (GNUNET_TIME_UNIT_SECONDS, 10), 745 (GNUNET_TIME_UNIT_SECONDS, 10),
746 &send_test_messages, test_messages); 746 &send_test_messages, test_messages);
@@ -754,7 +754,7 @@ topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
754 test_messages); 754 test_messages);
755#endif 755#endif
756#if PROGRESS_BARS 756#if PROGRESS_BARS
757 fprintf (stdout, "Test message progress: ["); 757 FPRINTF (stdout, "%s", "Test message progress: [");
758#endif 758#endif
759 759
760 } 760 }
@@ -837,7 +837,7 @@ connect_topology ()
837 if (dotnum == 0) 837 if (dotnum == 0)
838 dotnum = 1; 838 dotnum = 1;
839#if PROGRESS_BARS 839#if PROGRESS_BARS
840 fprintf (stdout, "Peer connection progress: ["); 840 FPRINTF (stdout, "%s", "Peer connection progress: [");
841#endif 841#endif
842} 842}
843 843
@@ -851,7 +851,7 @@ create_topology ()
851#if PROGRESS_BARS 851#if PROGRESS_BARS
852 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 852 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
853 "Topology set up, now starting peers!\n"); 853 "Topology set up, now starting peers!\n");
854 fprintf (stdout, "Daemon start progress ["); 854 FPRINTF (stdout, "%s", "Daemon start progress [");
855#endif 855#endif
856 GNUNET_TESTING_daemons_continue_startup (pg); 856 GNUNET_TESTING_daemons_continue_startup (pg);
857 } 857 }
@@ -892,15 +892,15 @@ peers_started_callback (void *cls, const struct GNUNET_PeerIdentity *id,
892 if ((num_peers - peers_left) % modnum == 0) 892 if ((num_peers - peers_left) % modnum == 0)
893 { 893 {
894 if (num_peers - peers_left == 0) 894 if (num_peers - peers_left == 0)
895 fprintf (stdout, "0%%"); 895 FPRINTF (stdout, "%s", "0%%");
896 else 896 else
897 fprintf (stdout, "%d%%", 897 FPRINTF (stdout, "%d%%",
898 (int) (((float) (num_peers - peers_left) / num_peers) * 100)); 898 (int) (((float) (num_peers - peers_left) / num_peers) * 100));
899 899
900 } 900 }
901 else if ((num_peers - peers_left) % dotnum == 0) 901 else if ((num_peers - peers_left) % dotnum == 0)
902 { 902 {
903 fprintf (stdout, "."); 903 FPRINTF (stdout, "%s", ".");
904 } 904 }
905 fflush (stdout); 905 fflush (stdout);
906#endif 906#endif
@@ -908,7 +908,7 @@ peers_started_callback (void *cls, const struct GNUNET_PeerIdentity *id,
908 if (peers_left == 0) 908 if (peers_left == 0)
909 { 909 {
910#if PROGRESS_BARS 910#if PROGRESS_BARS
911 fprintf (stdout, "100%%]\n"); 911 FPRINTF (stdout, "%s", "100%%]\n");
912#endif 912#endif
913#if VERBOSE 913#if VERBOSE
914 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 914 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -922,7 +922,7 @@ peers_started_callback (void *cls, const struct GNUNET_PeerIdentity *id,
922 (GNUNET_TIME_UNIT_MINUTES, 8), &end_badly, 922 (GNUNET_TIME_UNIT_MINUTES, 8), &end_badly,
923 "from peers_started_callback"); 923 "from peers_started_callback");
924#if DELAY_FOR_LOGGING 924#if DELAY_FOR_LOGGING
925 fprintf (stdout, "Connecting topology in 10 seconds\n"); 925 FPRINTF (stdout, "%s", "Connecting topology in 10 seconds\n");
926 gather_log_data (); 926 gather_log_data ();
927 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 927 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
928 (GNUNET_TIME_UNIT_SECONDS, 10), 928 (GNUNET_TIME_UNIT_SECONDS, 10),
@@ -962,15 +962,15 @@ hostkey_callback (void *cls, const struct GNUNET_PeerIdentity *id,
962 if ((num_peers - peers_left) % modnum == 0) 962 if ((num_peers - peers_left) % modnum == 0)
963 { 963 {
964 if (num_peers - peers_left == 0) 964 if (num_peers - peers_left == 0)
965 fprintf (stdout, "0%%"); 965 FPRINTF (stdout, "%s", "0%%");
966 else 966 else
967 fprintf (stdout, "%d%%", 967 FPRINTF (stdout, "%d%%",
968 (int) (((float) (num_peers - peers_left) / num_peers) * 100)); 968 (int) (((float) (num_peers - peers_left) / num_peers) * 100));
969 969
970 } 970 }
971 else if ((num_peers - peers_left) % dotnum == 0) 971 else if ((num_peers - peers_left) % dotnum == 0)
972 { 972 {
973 fprintf (stdout, "."); 973 FPRINTF (stdout, "%s", ".");
974 } 974 }
975 fflush (stdout); 975 fflush (stdout);
976#endif 976#endif
@@ -978,7 +978,7 @@ hostkey_callback (void *cls, const struct GNUNET_PeerIdentity *id,
978 if (peers_left == 0) 978 if (peers_left == 0)
979 { 979 {
980#if PROGRESS_BARS 980#if PROGRESS_BARS
981 fprintf (stdout, "100%%]\n"); 981 FPRINTF (stdout, "%s", "100%%]\n");
982 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 982 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
983 "All %d hostkeys created, now creating topology!\n", num_peers); 983 "All %d hostkeys created, now creating topology!\n", num_peers);
984#endif 984#endif
@@ -1009,7 +1009,7 @@ run (void *cls, char *const *args, const char *cfgfile,
1009 dotOutFile = fopen (dotOutFileName, "w"); 1009 dotOutFile = fopen (dotOutFileName, "w");
1010 if (dotOutFile != NULL) 1010 if (dotOutFile != NULL)
1011 { 1011 {
1012 fprintf (dotOutFile, "strict graph G {\n"); 1012 FPRINTF (dotOutFile, "%s", "strict graph G {\n");
1013 } 1013 }
1014 1014
1015#if VERBOSE 1015#if VERBOSE
@@ -1156,7 +1156,7 @@ run (void *cls, char *const *args, const char *cfgfile,
1156 if (dotnum == 0) 1156 if (dotnum == 0)
1157 dotnum = 1; 1157 dotnum = 1;
1158#if PROGRESS_BARS 1158#if PROGRESS_BARS
1159 fprintf (stdout, "Hostkey generation progress: ["); 1159 FPRINTF (stdout, "%s", "Hostkey generation progress: [");
1160#endif 1160#endif
1161 /* Set up a task to end testing if peer start fails */ 1161 /* Set up a task to end testing if peer start fails */
1162 die_task = 1162 die_task =