diff options
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/test_testing_group_remote.c | 11 | ||||
-rw-r--r-- | src/testing/test_testing_topology.c | 5 | ||||
-rw-r--r-- | src/testing/test_testing_topology_blacklist.c | 1 | ||||
-rw-r--r-- | src/testing/test_testing_topology_churn.c | 1 | ||||
-rw-r--r-- | src/testing/testing.c | 8 | ||||
-rw-r--r-- | src/testing/testing_group.c | 20 |
6 files changed, 38 insertions, 8 deletions
diff --git a/src/testing/test_testing_group_remote.c b/src/testing/test_testing_group_remote.c index b4d04fdd8..a58a1234e 100644 --- a/src/testing/test_testing_group_remote.c +++ b/src/testing/test_testing_group_remote.c | |||
@@ -106,6 +106,7 @@ run (void *cls, | |||
106 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) | 106 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
107 | { | 107 | { |
108 | struct GNUNET_TESTING_Host *hosts; | 108 | struct GNUNET_TESTING_Host *hosts; |
109 | struct GNUNET_TESTING_Host *hostpos; | ||
109 | struct GNUNET_TESTING_Host *temphost; | 110 | struct GNUNET_TESTING_Host *temphost; |
110 | char *hostfile; | 111 | char *hostfile; |
111 | struct stat frstat; | 112 | struct stat frstat; |
@@ -123,12 +124,14 @@ run (void *cls, | |||
123 | &num_peers)) | 124 | &num_peers)) |
124 | num_peers = DEFAULT_NUM_PEERS; | 125 | num_peers = DEFAULT_NUM_PEERS; |
125 | 126 | ||
127 | GNUNET_assert(num_peers > 0 && num_peers < (unsigned long long)-1); | ||
126 | if (GNUNET_OK != | 128 | if (GNUNET_OK != |
127 | GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "hostfile", | 129 | GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "hostfile", |
128 | &hostfile)) | 130 | &hostfile)) |
129 | hostfile = NULL; | 131 | hostfile = NULL; |
130 | 132 | ||
131 | hosts = NULL; | 133 | hosts = NULL; |
134 | data = NULL; | ||
132 | if (hostfile != NULL) | 135 | if (hostfile != NULL) |
133 | { | 136 | { |
134 | if (GNUNET_OK != GNUNET_DISK_file_test (hostfile)) | 137 | if (GNUNET_OK != GNUNET_DISK_file_test (hostfile)) |
@@ -188,6 +191,14 @@ run (void *cls, | |||
188 | NULL, | 191 | NULL, |
189 | NULL, | 192 | NULL, |
190 | hosts); | 193 | hosts); |
194 | hostpos = hosts; | ||
195 | while (hostpos != NULL) | ||
196 | { | ||
197 | temphost = hostpos->next; | ||
198 | GNUNET_free(hostpos); | ||
199 | hostpos = temphost; | ||
200 | } | ||
201 | GNUNET_free_non_null(data); | ||
191 | GNUNET_assert (pg != NULL); | 202 | GNUNET_assert (pg != NULL); |
192 | } | 203 | } |
193 | 204 | ||
diff --git a/src/testing/test_testing_topology.c b/src/testing/test_testing_topology.c index 3d03d7611..af4a6a39f 100644 --- a/src/testing/test_testing_topology.c +++ b/src/testing/test_testing_topology.c | |||
@@ -200,8 +200,6 @@ finish_testing () | |||
200 | "Called finish testing, stopping daemons.\n"); | 200 | "Called finish testing, stopping daemons.\n"); |
201 | #endif | 201 | #endif |
202 | 202 | ||
203 | int count; | ||
204 | count = 0; | ||
205 | pos = test_messages; | 203 | pos = test_messages; |
206 | while (pos != NULL) | 204 | while (pos != NULL) |
207 | { | 205 | { |
@@ -377,6 +375,7 @@ process_mtype (void *cls, | |||
377 | GNUNET_SCHEDULER_cancel (sched, die_task); | 375 | GNUNET_SCHEDULER_cancel (sched, die_task); |
378 | GNUNET_asprintf(&dotOutFileNameFinished, "%s.dot", "final_topology"); | 376 | GNUNET_asprintf(&dotOutFileNameFinished, "%s.dot", "final_topology"); |
379 | dotOutFileFinished = fopen (dotOutFileNameFinished, "w"); | 377 | dotOutFileFinished = fopen (dotOutFileNameFinished, "w"); |
378 | GNUNET_free(dotOutFileNameFinished); | ||
380 | if (dotOutFileFinished != NULL) | 379 | if (dotOutFileFinished != NULL) |
381 | { | 380 | { |
382 | fprintf(dotOutFileFinished, "strict graph G {\n"); | 381 | fprintf(dotOutFileFinished, "strict graph G {\n"); |
@@ -1001,6 +1000,7 @@ run (void *cls, | |||
1001 | GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, SECONDS_PER_PEER_START * num_peers), | 1000 | GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, SECONDS_PER_PEER_START * num_peers), |
1002 | &end_badly, "didn't generate all hostkeys within a reasonable amount of time!!!"); | 1001 | &end_badly, "didn't generate all hostkeys within a reasonable amount of time!!!"); |
1003 | 1002 | ||
1003 | GNUNET_assert(num_peers > 0 && num_peers < (unsigned int)-1); | ||
1004 | pg = GNUNET_TESTING_daemons_start (sched, cfg, | 1004 | pg = GNUNET_TESTING_daemons_start (sched, cfg, |
1005 | peers_left, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, SECONDS_PER_PEER_START * num_peers), &hostkey_callback, NULL, &peers_started_callback, NULL, | 1005 | peers_left, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, SECONDS_PER_PEER_START * num_peers), &hostkey_callback, NULL, &peers_started_callback, NULL, |
1006 | &topology_callback, NULL, NULL); | 1006 | &topology_callback, NULL, NULL); |
@@ -1046,6 +1046,7 @@ main (int argc, char *argv[]) | |||
1046 | char *our_binary_name; | 1046 | char *our_binary_name; |
1047 | 1047 | ||
1048 | binary_start_pos = rindex(argv[0], '/'); | 1048 | binary_start_pos = rindex(argv[0], '/'); |
1049 | GNUNET_assert(binary_start_pos != NULL); | ||
1049 | topology_string = strstr (binary_start_pos, | 1050 | topology_string = strstr (binary_start_pos, |
1050 | "_topology"); | 1051 | "_topology"); |
1051 | GNUNET_assert (topology_string != NULL); | 1052 | GNUNET_assert (topology_string != NULL); |
diff --git a/src/testing/test_testing_topology_blacklist.c b/src/testing/test_testing_topology_blacklist.c index dab06de90..5e3520510 100644 --- a/src/testing/test_testing_topology_blacklist.c +++ b/src/testing/test_testing_topology_blacklist.c | |||
@@ -470,6 +470,7 @@ run (void *cls, | |||
470 | 470 | ||
471 | main_cfg = cfg; | 471 | main_cfg = cfg; |
472 | 472 | ||
473 | GNUNET_assert(num_peers > 0 && num_peers < (unsigned int)-1); | ||
473 | peers_left = num_peers; | 474 | peers_left = num_peers; |
474 | 475 | ||
475 | /* For this specific test we only really want a CLIQUE topology as the | 476 | /* For this specific test we only really want a CLIQUE topology as the |
diff --git a/src/testing/test_testing_topology_churn.c b/src/testing/test_testing_topology_churn.c index 880b0fefc..a4b80e4a4 100644 --- a/src/testing/test_testing_topology_churn.c +++ b/src/testing/test_testing_topology_churn.c | |||
@@ -266,6 +266,7 @@ run (void *cls, | |||
266 | main_cfg = cfg; | 266 | main_cfg = cfg; |
267 | 267 | ||
268 | peers_left = num_peers; | 268 | peers_left = num_peers; |
269 | GNUNET_assert(num_peers > 0 && num_peers < (unsigned int)-1); | ||
269 | 270 | ||
270 | /* For this specific test we only really want a CLIQUE topology as the | 271 | /* For this specific test we only really want a CLIQUE topology as the |
271 | * overlay allowed topology, and a RING topology as the underlying connection | 272 | * overlay allowed topology, and a RING topology as the underlying connection |
diff --git a/src/testing/testing.c b/src/testing/testing.c index 3ad3f955c..2e4a44b2d 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c | |||
@@ -1338,13 +1338,15 @@ static void | |||
1338 | send_hello(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 1338 | send_hello(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
1339 | { | 1339 | { |
1340 | struct ConnectContext *ctx = cls; | 1340 | struct ConnectContext *ctx = cls; |
1341 | 1341 | struct GNUNET_MessageHeader *hello; | |
1342 | ctx->hello_send_task = GNUNET_SCHEDULER_NO_TASK; | 1342 | ctx->hello_send_task = GNUNET_SCHEDULER_NO_TASK; |
1343 | if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN) | 1343 | if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN) |
1344 | return; | 1344 | return; |
1345 | if (ctx->d1->hello != NULL) | 1345 | if ((ctx->d1->hello != NULL) && (NULL != GNUNET_HELLO_get_header(ctx->d1->hello))) |
1346 | { | 1346 | { |
1347 | GNUNET_TRANSPORT_offer_hello (ctx->d2th, GNUNET_HELLO_get_header(ctx->d1->hello)); | 1347 | hello = GNUNET_HELLO_get_header(ctx->d1->hello); |
1348 | GNUNET_assert(hello != NULL); | ||
1349 | GNUNET_TRANSPORT_offer_hello (ctx->d2th, hello); | ||
1348 | ctx->timeout_hello = GNUNET_TIME_relative_add(ctx->timeout_hello, | 1350 | ctx->timeout_hello = GNUNET_TIME_relative_add(ctx->timeout_hello, |
1349 | GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, | 1351 | GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, |
1350 | 500)); | 1352 | 500)); |
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index 2d17ecb62..30efc4985 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c | |||
@@ -1306,6 +1306,7 @@ create_small_world (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_Connecti | |||
1306 | unsigned int distance; | 1306 | unsigned int distance; |
1307 | double probability, random, percentage; | 1307 | double probability, random, percentage; |
1308 | unsigned int smallWorldConnections; | 1308 | unsigned int smallWorldConnections; |
1309 | unsigned int small_world_it; | ||
1309 | char *p_string; | 1310 | char *p_string; |
1310 | int connect_attempts; | 1311 | int connect_attempts; |
1311 | square = floor (sqrt (pg->total)); | 1312 | square = floor (sqrt (pg->total)); |
@@ -1326,6 +1327,13 @@ create_small_world (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_Connecti | |||
1326 | "TESTING"); | 1327 | "TESTING"); |
1327 | GNUNET_free (p_string); | 1328 | GNUNET_free (p_string); |
1328 | } | 1329 | } |
1330 | if (percentage < 0.0) | ||
1331 | { | ||
1332 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
1333 | _("Invalid value `%s' for option `%s' in section `%s': got %f, needed value greater than 0\n"), | ||
1334 | "PERCENTAGE", "TESTING", percentage); | ||
1335 | percentage = 0.5; | ||
1336 | } | ||
1329 | probability = 0.5; /* FIXME: default percentage? */ | 1337 | probability = 0.5; /* FIXME: default percentage? */ |
1330 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string(pg->cfg, | 1338 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string(pg->cfg, |
1331 | "TESTING", | 1339 | "TESTING", |
@@ -1392,7 +1400,9 @@ create_small_world (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_Connecti | |||
1392 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Total connections added thus far: %u!\n"), connect_attempts); | 1400 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Total connections added thus far: %u!\n"), connect_attempts); |
1393 | #endif | 1401 | #endif |
1394 | smallWorldConnections = 0; | 1402 | smallWorldConnections = 0; |
1395 | for (i = 0; i < (int) (natLog * percentage); i++) | 1403 | small_world_it = (unsigned int)(natLog * percentage); |
1404 | GNUNET_assert(small_world_it > 0 && small_world_it < (unsigned int)-1); | ||
1405 | for (i = 0; i < small_world_it; i++) | ||
1396 | { | 1406 | { |
1397 | for (j = 0; j < pg->total; j++) | 1407 | for (j = 0; j < pg->total; j++) |
1398 | { | 1408 | { |
@@ -2247,7 +2257,6 @@ GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup *pg, | |||
2247 | int unblacklisted_connections; | 2257 | int unblacklisted_connections; |
2248 | 2258 | ||
2249 | GNUNET_assert (pg->notify_connection != NULL); | 2259 | GNUNET_assert (pg->notify_connection != NULL); |
2250 | ret = GNUNET_OK; | ||
2251 | 2260 | ||
2252 | switch (topology) | 2261 | switch (topology) |
2253 | { | 2262 | { |
@@ -3797,22 +3806,26 @@ GNUNET_TESTING_daemons_churn (struct GNUNET_TESTING_PeerGroup *pg, | |||
3797 | } | 3806 | } |
3798 | } | 3807 | } |
3799 | 3808 | ||
3809 | GNUNET_assert(running >= voff); | ||
3800 | for (i = 0; i < voff; i++) | 3810 | for (i = 0; i < voff; i++) |
3801 | { | 3811 | { |
3802 | #if DEBUG_CHURN | 3812 | #if DEBUG_CHURN |
3803 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Stopping peer %d!\n", running_permute[i]); | 3813 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Stopping peer %d!\n", running_permute[i]); |
3804 | #endif | 3814 | #endif |
3815 | GNUNET_assert(running_arr != NULL); | ||
3805 | GNUNET_TESTING_daemon_stop (pg->peers[running_arr[running_permute[i]]].daemon, | 3816 | GNUNET_TESTING_daemon_stop (pg->peers[running_arr[running_permute[i]]].daemon, |
3806 | timeout, | 3817 | timeout, |
3807 | &churn_stop_callback, churn_ctx, | 3818 | &churn_stop_callback, churn_ctx, |
3808 | GNUNET_NO, GNUNET_YES); | 3819 | GNUNET_NO, GNUNET_YES); |
3809 | } | 3820 | } |
3810 | 3821 | ||
3822 | GNUNET_assert(stopped >= von); | ||
3811 | for (i = 0; i < von; i++) | 3823 | for (i = 0; i < von; i++) |
3812 | { | 3824 | { |
3813 | #if DEBUG_CHURN | 3825 | #if DEBUG_CHURN |
3814 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Starting up peer %d!\n", stopped_permute[i]); | 3826 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Starting up peer %d!\n", stopped_permute[i]); |
3815 | #endif | 3827 | #endif |
3828 | GNUNET_assert(stopped_arr != NULL); | ||
3816 | GNUNET_TESTING_daemon_start_stopped(pg->peers[stopped_arr[stopped_permute[i]]].daemon, | 3829 | GNUNET_TESTING_daemon_start_stopped(pg->peers[stopped_arr[stopped_permute[i]]].daemon, |
3817 | timeout, &churn_start_callback, churn_ctx); | 3830 | timeout, &churn_start_callback, churn_ctx); |
3818 | } | 3831 | } |
@@ -3964,9 +3977,10 @@ static void | |||
3964 | schedule_shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | 3977 | schedule_shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) |
3965 | { | 3978 | { |
3966 | struct PeerShutdownContext *peer_shutdown_ctx = cls; | 3979 | struct PeerShutdownContext *peer_shutdown_ctx = cls; |
3967 | struct ShutdownContext *shutdown_ctx = peer_shutdown_ctx->shutdown_ctx; | 3980 | struct ShutdownContext *shutdown_ctx; |
3968 | 3981 | ||
3969 | GNUNET_assert(peer_shutdown_ctx != NULL); | 3982 | GNUNET_assert(peer_shutdown_ctx != NULL); |
3983 | shutdown_ctx = peer_shutdown_ctx->shutdown_ctx; | ||
3970 | GNUNET_assert(shutdown_ctx != NULL); | 3984 | GNUNET_assert(shutdown_ctx != NULL); |
3971 | 3985 | ||
3972 | if (shutdown_ctx->outstanding > MAX_CONCURRENT_SHUTDOWN) | 3986 | if (shutdown_ctx->outstanding > MAX_CONCURRENT_SHUTDOWN) |