diff options
author | Nathan S. Evans <evans@in.tum.de> | 2011-04-07 10:09:49 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2011-04-07 10:09:49 +0000 |
commit | 1c2737f65dfbd07b7d69015040041d12e6b0e8bb (patch) | |
tree | e00b27b660bc9677f4e800e483932d6e4a8ef0b5 /src/testing | |
parent | faba117b5dabfa96d40646d6bd5be1adba7ee993 (diff) | |
download | gnunet-1c2737f65dfbd07b7d69015040041d12e6b0e8bb.tar.gz gnunet-1c2737f65dfbd07b7d69015040041d12e6b0e8bb.zip |
change verbose to use_progressbars, move option to config file
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/test_testing_peergroup_data.conf | 1 | ||||
-rw-r--r-- | src/testing/testing_peergroup.c | 40 |
2 files changed, 25 insertions, 16 deletions
diff --git a/src/testing/test_testing_peergroup_data.conf b/src/testing/test_testing_peergroup_data.conf index d03d391f9..8ebb7f1c8 100644 --- a/src/testing/test_testing_peergroup_data.conf +++ b/src/testing/test_testing_peergroup_data.conf | |||
@@ -43,6 +43,7 @@ CONNECT_TOPOLOGY_OPTION = CONNECT_NONE | |||
43 | CONNECT_TOPOLOGY_OPTION_MODIFIER = 0.0 | 43 | CONNECT_TOPOLOGY_OPTION_MODIFIER = 0.0 |
44 | BLACKLIST_TOPOLOGY = NONE | 44 | BLACKLIST_TOPOLOGY = NONE |
45 | BLACKLIST_TRANSPORTS = tcp udp | 45 | BLACKLIST_TRANSPORTS = tcp udp |
46 | USE_PROGRESSBARS = NO | ||
46 | 47 | ||
47 | 48 | ||
48 | [fs] | 49 | [fs] |
diff --git a/src/testing/testing_peergroup.c b/src/testing/testing_peergroup.c index b9b6cd313..709cd8b4f 100644 --- a/src/testing/testing_peergroup.c +++ b/src/testing/testing_peergroup.c | |||
@@ -49,9 +49,13 @@ struct PeerGroupStartupContext | |||
49 | unsigned long long max_concurrent_ssh; | 49 | unsigned long long max_concurrent_ssh; |
50 | struct GNUNET_TIME_Absolute timeout; | 50 | struct GNUNET_TIME_Absolute timeout; |
51 | GNUNET_TESTING_NotifyConnection connect_cb; | 51 | GNUNET_TESTING_NotifyConnection connect_cb; |
52 | void *connect_cb_cls; | ||
53 | GNUNET_TESTING_NotifyCompletion peergroup_cb; | 52 | GNUNET_TESTING_NotifyCompletion peergroup_cb; |
54 | void *peergroup_cb_cls; | 53 | |
54 | /** | ||
55 | * Closure for all peergroup callbacks. | ||
56 | */ | ||
57 | void *cls; | ||
58 | |||
55 | const struct GNUNET_TESTING_Host *hostnames; | 59 | const struct GNUNET_TESTING_Host *hostnames; |
56 | enum GNUNET_TESTING_Topology topology; | 60 | enum GNUNET_TESTING_Topology topology; |
57 | 61 | ||
@@ -243,9 +247,9 @@ internal_shutdown_callback(void *cls, const char *emsg) | |||
243 | { | 247 | { |
244 | struct PeerGroupStartupContext *pg_start_ctx = cls; | 248 | struct PeerGroupStartupContext *pg_start_ctx = cls; |
245 | if (emsg != NULL) | 249 | if (emsg != NULL) |
246 | pg_start_ctx->peergroup_cb(pg_start_ctx->peergroup_cb_cls, emsg); | 250 | pg_start_ctx->peergroup_cb(pg_start_ctx->cls, emsg); |
247 | else | 251 | else |
248 | pg_start_ctx->peergroup_cb(pg_start_ctx->peergroup_cb_cls, pg_start_ctx->fail_reason); | 252 | pg_start_ctx->peergroup_cb(pg_start_ctx->cls, pg_start_ctx->fail_reason); |
249 | } | 253 | } |
250 | 254 | ||
251 | /** | 255 | /** |
@@ -371,7 +375,7 @@ internal_topology_callback( | |||
371 | 375 | ||
372 | GNUNET_assert(pg_start_ctx->connect_meter != NULL); | 376 | GNUNET_assert(pg_start_ctx->connect_meter != NULL); |
373 | if (pg_start_ctx->connect_cb != NULL) | 377 | if (pg_start_ctx->connect_cb != NULL) |
374 | pg_start_ctx->connect_cb(pg_start_ctx->connect_cb_cls, first, | 378 | pg_start_ctx->connect_cb(pg_start_ctx->cls, first, |
375 | second, | 379 | second, |
376 | distance, | 380 | distance, |
377 | first_cfg, | 381 | first_cfg, |
@@ -408,7 +412,7 @@ internal_topology_callback( | |||
408 | 412 | ||
409 | /* Call final callback, signifying that the peer group has been started and connected */ | 413 | /* Call final callback, signifying that the peer group has been started and connected */ |
410 | if (pg_start_ctx->peergroup_cb != NULL) | 414 | if (pg_start_ctx->peergroup_cb != NULL) |
411 | pg_start_ctx->peergroup_cb(pg_start_ctx->peergroup_cb_cls, NULL); | 415 | pg_start_ctx->peergroup_cb(pg_start_ctx->cls, NULL); |
412 | } | 416 | } |
413 | } | 417 | } |
414 | 418 | ||
@@ -556,12 +560,10 @@ internal_hostkey_callback(void *cls, const struct GNUNET_PeerIdentity *id, | |||
556 | * @param total number of daemons to start | 560 | * @param total number of daemons to start |
557 | * @param timeout total time allowed for peers to start | 561 | * @param timeout total time allowed for peers to start |
558 | * @param connect_cb function to call each time two daemons are connected | 562 | * @param connect_cb function to call each time two daemons are connected |
559 | * @param connect_cb_cls closure for connect_callback | ||
560 | * @param peergroup_cb function to call once all peers are up and connected | 563 | * @param peergroup_cb function to call once all peers are up and connected |
561 | * @param peergroup_cb_cls closure for peergroup_cb | 564 | * @param peergroup_cls closure for peergroup callbacks |
562 | * @param hostnames linked list of host structs to use to start peers on | 565 | * @param hostnames linked list of host structs to use to start peers on |
563 | * (NULL to run on localhost only) | 566 | * (NULL to run on localhost only) |
564 | * @param verbose GNUNET_YES to print progress bars, GNUNET_NO otherwise | ||
565 | * | 567 | * |
566 | * @return NULL on error, otherwise handle to control peer group | 568 | * @return NULL on error, otherwise handle to control peer group |
567 | */ | 569 | */ |
@@ -571,11 +573,9 @@ GNUNET_TESTING_peergroup_start( | |||
571 | unsigned int total, | 573 | unsigned int total, |
572 | struct GNUNET_TIME_Relative timeout, | 574 | struct GNUNET_TIME_Relative timeout, |
573 | GNUNET_TESTING_NotifyConnection connect_cb, | 575 | GNUNET_TESTING_NotifyConnection connect_cb, |
574 | void *connect_cb_cls, | ||
575 | GNUNET_TESTING_NotifyCompletion peergroup_cb, | 576 | GNUNET_TESTING_NotifyCompletion peergroup_cb, |
576 | void *peergroup_cb_cls, | 577 | void *peergroup_cls, |
577 | const struct GNUNET_TESTING_Host *hostnames, | 578 | const struct GNUNET_TESTING_Host *hostnames) |
578 | int verbose) | ||
579 | { | 579 | { |
580 | struct PeerGroupStartupContext *pg_start_ctx; | 580 | struct PeerGroupStartupContext *pg_start_ctx; |
581 | unsigned long long temp_config_number; | 581 | unsigned long long temp_config_number; |
@@ -616,6 +616,15 @@ GNUNET_TESTING_peergroup_start( | |||
616 | return NULL; | 616 | return NULL; |
617 | } | 617 | } |
618 | 618 | ||
619 | if (GNUNET_SYSERR == (pg_start_ctx->verbose = GNUNET_CONFIGURATION_get_value_yesno (cfg, "testing", | ||
620 | "use_progressbars"))) | ||
621 | { | ||
622 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n", | ||
623 | "testing", "use_progressbars"); | ||
624 | GNUNET_free(pg_start_ctx); | ||
625 | return NULL; | ||
626 | } | ||
627 | |||
619 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (cfg, "testing", | 628 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (cfg, "testing", |
620 | "peergroup_timeout", | 629 | "peergroup_timeout", |
621 | &temp_config_number)) | 630 | &temp_config_number)) |
@@ -739,11 +748,10 @@ GNUNET_TESTING_peergroup_start( | |||
739 | pg_start_ctx->cfg = cfg; | 748 | pg_start_ctx->cfg = cfg; |
740 | pg_start_ctx->total = total; | 749 | pg_start_ctx->total = total; |
741 | pg_start_ctx->peers_left = total; | 750 | pg_start_ctx->peers_left = total; |
742 | pg_start_ctx->connect_cb = connect_cb_cls; | 751 | pg_start_ctx->connect_cb = connect_cb; |
743 | pg_start_ctx->peergroup_cb = peergroup_cb; | 752 | pg_start_ctx->peergroup_cb = peergroup_cb; |
744 | pg_start_ctx->peergroup_cb_cls = peergroup_cb_cls; | 753 | pg_start_ctx->cls = peergroup_cls; |
745 | pg_start_ctx->hostnames = hostnames; | 754 | pg_start_ctx->hostnames = hostnames; |
746 | pg_start_ctx->verbose = verbose; | ||
747 | pg_start_ctx->hostkey_meter = create_meter (pg_start_ctx->peers_left, "Hostkeys created ", pg_start_ctx->verbose); | 755 | pg_start_ctx->hostkey_meter = create_meter (pg_start_ctx->peers_left, "Hostkeys created ", pg_start_ctx->verbose); |
748 | pg_start_ctx->peer_start_meter = create_meter (pg_start_ctx->peers_left, "Peers started ", pg_start_ctx->verbose); | 756 | pg_start_ctx->peer_start_meter = create_meter (pg_start_ctx->peers_left, "Peers started ", pg_start_ctx->verbose); |
749 | /* Make compilers happy */ | 757 | /* Make compilers happy */ |