aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_quota_compliance.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/test_quota_compliance.c')
-rw-r--r--src/transport/test_quota_compliance.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c
index 3422ef2fd..2eacbd765 100644
--- a/src/transport/test_quota_compliance.c
+++ b/src/transport/test_quota_compliance.c
@@ -36,7 +36,7 @@
36#include "transport.h" 36#include "transport.h"
37#include "transport-testing.h" 37#include "transport-testing.h"
38 38
39#define VERBOSE GNUNET_EXTRA_LOGGING 39#define VERBOSE GNUNET_YES
40 40
41#define VERBOSE_ARM GNUNET_EXTRA_LOGGING 41#define VERBOSE_ARM GNUNET_EXTRA_LOGGING
42 42
@@ -150,24 +150,21 @@ end ()
150 if (datarate > quota_in_p2) 150 if (datarate > quota_in_p2)
151 { 151 {
152 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 152 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
153 "Datarate of %llu higher than allowed inbound quota of %llu\n", datarate, quota_in_p2); 153 "Datarate of %llu b/s higher than allowed inbound quota of %llu b/s\n", datarate, quota_in_p2);
154 test_failed = GNUNET_YES; 154 test_failed = GNUNET_YES;
155 } 155 }
156 if (datarate > quota_out_p1) 156 if (datarate > quota_out_p1)
157 { 157 {
158 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 158 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
159 "Datarate of %llu higher than allowed outbound quota of %llu\n", datarate, quota_out_p1); 159 "Datarate of %llu b/s higher than allowed outbound quota of %llu b/s\n", datarate, quota_out_p1);
160 test_failed = GNUNET_YES; 160 test_failed = GNUNET_YES;
161 } 161 }
162 if (test_failed == GNUNET_NO) 162 if (test_failed == GNUNET_NO)
163 { 163 {
164 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 164 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
165 "Datarate of %llu complied to allowed outbound quota of %llu and inbound quota of %llu\n", datarate, quota_out_p1, quota_in_p2); 165 "Datarate of %llu b/s complied to allowed outbound quota of %llu b/s and inbound quota of %llu b/s\n", datarate, quota_out_p1, quota_in_p2);
166 } 166 }
167 167
168
169
170
171 if (die_task != GNUNET_SCHEDULER_NO_TASK) 168 if (die_task != GNUNET_SCHEDULER_NO_TASK)
172 GNUNET_SCHEDULER_cancel (die_task); 169 GNUNET_SCHEDULER_cancel (die_task);
173 170
@@ -189,6 +186,9 @@ end_badly ()
189 die_task = GNUNET_SCHEDULER_NO_TASK; 186 die_task = GNUNET_SCHEDULER_NO_TASK;
190 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); 187 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n");
191 188
189 if (measure_task != GNUNET_SCHEDULER_NO_TASK)
190 GNUNET_SCHEDULER_cancel (measure_task);
191
192 if (test_connected == GNUNET_YES) 192 if (test_connected == GNUNET_YES)
193 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peers got connected\n"); 193 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peers got connected\n");
194 else 194 else
@@ -462,20 +462,19 @@ void start_cb (struct PeerContext * p,
462} 462}
463 463
464static char * 464static char *
465generate_config (char * cfg_file_p1, unsigned long long quota_in, unsigned long long quota_out) 465generate_config (char * cfg_file, unsigned long long quota_in, unsigned long long quota_out)
466{ 466{
467 char * fname = NULL; 467 char * fname = NULL;
468 struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create(); 468 struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create();
469 GNUNET_CONFIGURATION_load (cfg, cfg_file_p1); 469 GNUNET_CONFIGURATION_load (cfg, cfg_file);
470 470 GNUNET_asprintf (&fname, "q_in_%u_q_out_%u_%s", quota_in, quota_out, cfg_file);
471 GNUNET_CONFIGURATION_set_value_number(cfg, "core", "TOTAL_QUOTA_IN", quota_in); 471 GNUNET_CONFIGURATION_set_value_string(cfg, "PATHS", "DEFAULTCONFIG", fname);
472 GNUNET_CONFIGURATION_set_value_number(cfg, "core", "TOTAL_QUOTA_OUT", quota_out); 472 GNUNET_CONFIGURATION_set_value_number(cfg, "core", "TOTAL_QUOTA_OUT", quota_out);
473 473 GNUNET_CONFIGURATION_set_value_number(cfg, "core", "TOTAL_QUOTA_IN", quota_in);
474 GNUNET_asprintf (&fname, "q_in_%ull_q_out_%ull_%s", quota_in, quota_out, cfg_file_p1); 474 GNUNET_CONFIGURATION_set_value_number(cfg, "ats", "TOTAL_QUOTA_IN", quota_in);
475 475 GNUNET_CONFIGURATION_set_value_number(cfg, "ats", "TOTAL_QUOTA_OUT", quota_out);
476 GNUNET_CONFIGURATION_write(cfg, fname); 476 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_write(cfg, fname));
477 GNUNET_CONFIGURATION_destroy(cfg); 477 GNUNET_CONFIGURATION_destroy(cfg);
478
479 return fname; 478 return fname;
480} 479}
481 480
@@ -551,7 +550,7 @@ check ()
551{ 550{
552 static char *argv[] = { "test_transport-quota-compliance", 551 static char *argv[] = { "test_transport-quota-compliance",
553 "-c", 552 "-c",
554 "test_transport_api_data.conf", 553 "",
555#if VERBOSE 554#if VERBOSE
556 "-L", "DEBUG", 555 "-L", "DEBUG",
557#endif 556#endif