aboutsummaryrefslogtreecommitdiff
path: root/src/testing/test_testing_group.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/test_testing_group.c')
-rw-r--r--src/testing/test_testing_group.c73
1 files changed, 35 insertions, 38 deletions
diff --git a/src/testing/test_testing_group.c b/src/testing/test_testing_group.c
index 0056588bc..88893f45d 100644
--- a/src/testing/test_testing_group.c
+++ b/src/testing/test_testing_group.c
@@ -48,20 +48,19 @@ void
48shutdown_callback (void *cls, const char *emsg) 48shutdown_callback (void *cls, const char *emsg)
49{ 49{
50 if (emsg != NULL) 50 if (emsg != NULL)
51 { 51 {
52#if VERBOSE 52#if VERBOSE
53 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown of peers failed!\n"); 53 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown of peers failed!\n");
54#endif 54#endif
55 if (ok == 0) 55 if (ok == 0)
56 ok = 666; 56 ok = 666;
57 } 57 }
58 else 58 else
59 { 59 {
60#if VERBOSE 60#if VERBOSE
61 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 61 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All peers successfully shut down!\n");
62 "All peers successfully shut down!\n");
63#endif 62#endif
64 } 63 }
65} 64}
66 65
67 66
@@ -72,36 +71,36 @@ my_cb (void *cls,
72 struct GNUNET_TESTING_Daemon *d, const char *emsg) 71 struct GNUNET_TESTING_Daemon *d, const char *emsg)
73{ 72{
74 if (id == NULL) 73 if (id == NULL)
74 {
75 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
76 "Start callback called with error (too long starting peers), aborting test!\n");
77 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Error from testing: `%s'\n");
78 failed_peers++;
79 if (failed_peers == peers_left)
75 { 80 {
76 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 81 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
77 "Start callback called with error (too long starting peers), aborting test!\n"); 82 "Too many peers failed, ending test!\n");
78 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Error from testing: `%s'\n"); 83 ok = 1;
79 failed_peers++; 84 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
80 if (failed_peers == peers_left)
81 {
82 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
83 "Too many peers failed, ending test!\n");
84 ok = 1;
85 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
86 }
87 return;
88 } 85 }
86 return;
87 }
89 88
90 peers_left--; 89 peers_left--;
91 if (peers_left == 0) 90 if (peers_left == 0)
92 { 91 {
93 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 92 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
94 "All peers started successfully, ending test!\n"); 93 "All peers started successfully, ending test!\n");
95 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); 94 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
96 ok = 0; 95 ok = 0;
97 } 96 }
98 else if (failed_peers == peers_left) 97 else if (failed_peers == peers_left)
99 { 98 {
100 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 99 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
101 "Too many peers failed, ending test!\n"); 100 "Too many peers failed, ending test!\n");
102 ok = 1; 101 ok = 1;
103 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); 102 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
104 } 103 }
105} 104}
106 105
107 106
@@ -115,10 +114,9 @@ run (void *cls,
115 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting daemons.\n"); 114 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting daemons.\n");
116#endif 115#endif
117 peers_left = NUM_PEERS; 116 peers_left = NUM_PEERS;
118 pg = GNUNET_TESTING_daemons_start (cfg, 117 pg = GNUNET_TESTING_daemons_start (cfg, peers_left, /* Total number of peers */
119 peers_left, /* Total number of peers */ 118 peers_left, /* Number of outstanding connections */
120 peers_left, /* Number of outstanding connections */ 119 peers_left, /* Number of parallel ssh connections, or peers being started at once */
121 peers_left, /* Number of parallel ssh connections, or peers being started at once */
122 TIMEOUT, 120 TIMEOUT,
123 NULL, NULL, 121 NULL, NULL,
124 &my_cb, NULL, NULL, NULL, NULL); 122 &my_cb, NULL, NULL, NULL, NULL);
@@ -140,8 +138,7 @@ check ()
140 GNUNET_GETOPT_OPTION_END 138 GNUNET_GETOPT_OPTION_END
141 }; 139 };
142 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, 140 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
143 argv, "test-testing-group", "nohelp", 141 argv, "test-testing-group", "nohelp", options, &run, &ok);
144 options, &run, &ok);
145 return ok; 142 return ok;
146} 143}
147 144