diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-05-06 19:20:02 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-05-06 19:20:02 +0000 |
commit | 4e1efec9d3882e4c037f67a9dfbcce0a5827febd (patch) | |
tree | f6fe656100ce2baf90bc1936089469bb568804f7 /src/core | |
parent | 570c4ecd8e046edb8d886521f0a332f69b34beda (diff) | |
download | gnunet-4e1efec9d3882e4c037f67a9dfbcce0a5827febd.tar.gz gnunet-4e1efec9d3882e4c037f67a9dfbcce0a5827febd.zip |
-fixing error messages, making quotas a bit more lenient as we can clearly -- based on timing -- be off by 1/3, see #2308
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/test_core_quota_compliance.c | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c index 13a837ceb..636520e69 100644 --- a/src/core/test_core_quota_compliance.c +++ b/src/core/test_core_quota_compliance.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include "gnunet_transport_service.h" | 33 | #include "gnunet_transport_service.h" |
34 | #include "gnunet_statistics_service.h" | 34 | #include "gnunet_statistics_service.h" |
35 | 35 | ||
36 | #define VERBOSE GNUNET_NO | ||
37 | 36 | ||
38 | #define SYMMETRIC 0 | 37 | #define SYMMETRIC 0 |
39 | #define ASYMMETRIC_SEND_LIMITED 1 | 38 | #define ASYMMETRIC_SEND_LIMITED 1 |
@@ -239,15 +238,15 @@ measurement_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
239 | max_quota_in = GNUNET_MIN (current_quota_p1_in, current_quota_p2_in); | 238 | max_quota_in = GNUNET_MIN (current_quota_p1_in, current_quota_p2_in); |
240 | max_quota_out = GNUNET_MIN (current_quota_p1_out, current_quota_p2_out); | 239 | max_quota_out = GNUNET_MIN (current_quota_p1_out, current_quota_p2_out); |
241 | if (max_quota_out < max_quota_in) | 240 | if (max_quota_out < max_quota_in) |
242 | quota_delta = max_quota_in / 5; | 241 | quota_delta = max_quota_in / 3; |
243 | else | 242 | else |
244 | quota_delta = max_quota_out / 5; | 243 | quota_delta = max_quota_out / 3; |
245 | 244 | ||
246 | if ((throughput_out > (max_quota_out + quota_delta)) || | 245 | if ((throughput_out > (max_quota_out + quota_delta)) || |
247 | (throughput_in > (max_quota_in + quota_delta))) | 246 | (throughput_in > (max_quota_in + quota_delta))) |
248 | ok = 1; | 247 | ok = 1; /* fail */ |
249 | else | 248 | else |
250 | ok = 0; | 249 | ok = 0; /* pass */ |
251 | GNUNET_STATISTICS_get (p1.stats, "core", "# discarded CORE_SEND requests", | 250 | GNUNET_STATISTICS_get (p1.stats, "core", "# discarded CORE_SEND requests", |
252 | GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, &p1); | 251 | GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, &p1); |
253 | 252 | ||
@@ -279,17 +278,17 @@ measurement_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
279 | { | 278 | { |
280 | case SYMMETRIC: | 279 | case SYMMETRIC: |
281 | GNUNET_log (kind, "Core quota compliance test with symmetric quotas: %s\n", | 280 | GNUNET_log (kind, "Core quota compliance test with symmetric quotas: %s\n", |
282 | (ok != 0) ? "PASSED" : "FAILED"); | 281 | (0 == ok) ? "PASSED" : "FAILED"); |
283 | break; | 282 | break; |
284 | case ASYMMETRIC_SEND_LIMITED: | 283 | case ASYMMETRIC_SEND_LIMITED: |
285 | GNUNET_log (kind, | 284 | GNUNET_log (kind, |
286 | "Core quota compliance test with limited sender quota: %s\n", | 285 | "Core quota compliance test with limited sender quota: %s\n", |
287 | (ok != 0) ? "PASSED" : "FAILED"); | 286 | (0 == ok) ? "PASSED" : "FAILED"); |
288 | break; | 287 | break; |
289 | case ASYMMETRIC_RECV_LIMITED: | 288 | case ASYMMETRIC_RECV_LIMITED: |
290 | GNUNET_log (kind, | 289 | GNUNET_log (kind, |
291 | "Core quota compliance test with limited receiver quota: %s\n", | 290 | "Core quota compliance test with limited receiver quota: %s\n", |
292 | (ok != 0) ? "PASSED" : "FAILED"); | 291 | (0 == ok) ? "PASSED" : "FAILED"); |
293 | break; | 292 | break; |
294 | }; | 293 | }; |
295 | GNUNET_log (kind, "Peer 1 send rate: %llu b/s (%llu bytes in %llu ms)\n", | 294 | GNUNET_log (kind, "Peer 1 send rate: %llu b/s (%llu bytes in %llu ms)\n", |
@@ -573,9 +572,6 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
573 | p->arm_proc = | 572 | p->arm_proc = |
574 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", | 573 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
575 | "gnunet-service-arm", | 574 | "gnunet-service-arm", |
576 | #if VERBOSE | ||
577 | "-L", "DEBUG", | ||
578 | #endif | ||
579 | "-c", cfgname, NULL); | 575 | "-c", cfgname, NULL); |
580 | #endif | 576 | #endif |
581 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); | 577 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); |
@@ -652,17 +648,13 @@ stop_arm (struct PeerContext *p) | |||
652 | GNUNET_CONFIGURATION_destroy (p->cfg); | 648 | GNUNET_CONFIGURATION_destroy (p->cfg); |
653 | } | 649 | } |
654 | 650 | ||
651 | |||
655 | static int | 652 | static int |
656 | check () | 653 | check () |
657 | { | 654 | { |
658 | |||
659 | |||
660 | char *const argv[] = { "test-core-quota-compliance", | 655 | char *const argv[] = { "test-core-quota-compliance", |
661 | "-c", | 656 | "-c", |
662 | "test_core_api_data.conf", | 657 | "test_core_api_data.conf", |
663 | #if VERBOSE | ||
664 | "-L", "DEBUG", | ||
665 | #endif | ||
666 | NULL | 658 | NULL |
667 | }; | 659 | }; |
668 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 660 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
@@ -677,6 +669,7 @@ check () | |||
677 | return ok; | 669 | return ok; |
678 | } | 670 | } |
679 | 671 | ||
672 | |||
680 | int | 673 | int |
681 | main (int argc, char *argv[]) | 674 | main (int argc, char *argv[]) |
682 | { | 675 | { |
@@ -717,11 +710,7 @@ main (int argc, char *argv[]) | |||
717 | } | 710 | } |
718 | 711 | ||
719 | GNUNET_log_setup ("test-core-quota-compliance", | 712 | GNUNET_log_setup ("test-core-quota-compliance", |
720 | #if VERBOSE | ||
721 | "DEBUG", | ||
722 | #else | ||
723 | "WARNING", | 713 | "WARNING", |
724 | #endif | ||
725 | NULL); | 714 | NULL); |
726 | ret = check (); | 715 | ret = check (); |
727 | if (test == SYMMETRIC) | 716 | if (test == SYMMETRIC) |
@@ -743,10 +732,7 @@ main (int argc, char *argv[]) | |||
743 | GNUNET_DISK_directory_remove | 732 | GNUNET_DISK_directory_remove |
744 | ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-2/"); | 733 | ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-2/"); |
745 | } | 734 | } |
746 | |||
747 | |||
748 | |||
749 | return ret; | 735 | return ret; |
750 | } | 736 | } |
751 | 737 | ||
752 | /* end of test_core_api_reliability.c */ | 738 | /* end of test_core_quota_compliance.c */ |