2 This file is part of GNUnet.
3 (C) 2009, 2010 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
21 * @file core/test_core_quota_compliance.c
22 * @brief testcase for core_api.c focusing quota compliance on core level
25 #include "gnunet_arm_service.h"
26 #include "gnunet_core_service.h"
27 #include "gnunet_getopt_lib.h"
28 #include "gnunet_os_lib.h"
29 #include "gnunet_program_lib.h"
30 #include "gnunet_scheduler_lib.h"
31 #include "gnunet_transport_service.h"
32 #include "gnunet_statistics_service.h"
36 #define ASYMMETRIC_SEND_LIMITED 1
37 #define ASYMMETRIC_RECV_LIMITED 2
40 * Note that this value must not significantly exceed
41 * 'MAX_PENDING' in 'gnunet-service-transport.c', otherwise
42 * messages may be dropped even for a reliable transport.
44 #define TOTAL_MSGS (60000 * 10)
47 * How long until we give up on transmitting the message?
49 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 300)
52 * What delay do we request from the core service for transmission?
54 #define FAST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 150)
57 #define MESSAGESIZE 1024
58 #define MEASUREMENT_LENGTH GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
60 static unsigned long long total_bytes_sent;
61 static unsigned long long total_bytes_recv;
63 static struct GNUNET_TIME_Absolute start_time;
65 static GNUNET_SCHEDULER_TaskIdentifier err_task;
67 static GNUNET_SCHEDULER_TaskIdentifier measure_task;
69 static GNUNET_SCHEDULER_TaskIdentifier connect_task;
74 struct GNUNET_CONFIGURATION_Handle *cfg;
75 struct GNUNET_CORE_Handle *ch;
76 struct GNUNET_CORE_TransmitHandle *nth;
77 struct GNUNET_PeerIdentity id;
78 struct GNUNET_TRANSPORT_Handle *th;
79 struct GNUNET_MessageHeader *hello;
80 struct GNUNET_STATISTICS_Handle *stats;
81 struct GNUNET_TRANSPORT_GetHelloHandle *ghh;
83 struct GNUNET_OS_Process *arm_proc;
86 static struct PeerContext p1;
87 static struct PeerContext p2;
89 static unsigned long long current_quota_p1_in;
90 static unsigned long long current_quota_p1_out;
91 static unsigned long long current_quota_p2_in;
92 static unsigned long long current_quota_p2_out;
102 #define OKPP do { ok++; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
104 #define OKPP do { ok++; } while (0)
109 struct GNUNET_MessageHeader header;
114 process_hello (void *cls, const struct GNUNET_MessageHeader *message);
117 terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
119 struct GNUNET_CORE_Handle *ch;
121 err_task = GNUNET_SCHEDULER_NO_TASK;
122 GNUNET_STATISTICS_destroy (p1.stats, GNUNET_NO);
123 GNUNET_STATISTICS_destroy (p2.stats, GNUNET_NO);
124 GNUNET_TRANSPORT_get_hello_cancel (p2.ghh);
125 GNUNET_TRANSPORT_get_hello_cancel (p1.ghh);
128 GNUNET_CORE_notify_transmit_ready_cancel (p1.nth);
131 if (connect_task != GNUNET_SCHEDULER_NO_TASK)
133 GNUNET_SCHEDULER_cancel (connect_task);
134 connect_task = GNUNET_SCHEDULER_NO_TASK;
138 GNUNET_CORE_disconnect (ch);
141 GNUNET_CORE_disconnect (ch);
142 GNUNET_TRANSPORT_disconnect (p1.th);
144 GNUNET_TRANSPORT_disconnect (p2.th);
146 GNUNET_free_non_null (p1.hello);
147 GNUNET_free_non_null (p2.hello);
152 terminate_task_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
154 err_task = GNUNET_SCHEDULER_NO_TASK;
156 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
157 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Testcase failed!\n");
161 GNUNET_CORE_notify_transmit_ready_cancel (p1.nth);
164 if (measure_task != GNUNET_SCHEDULER_NO_TASK)
165 GNUNET_SCHEDULER_cancel (measure_task);
166 if (connect_task != GNUNET_SCHEDULER_NO_TASK)
168 GNUNET_SCHEDULER_cancel (connect_task);
169 connect_task = GNUNET_SCHEDULER_NO_TASK;
172 GNUNET_TRANSPORT_get_hello_cancel (p1.ghh);
173 GNUNET_TRANSPORT_get_hello_cancel (p2.ghh);
175 GNUNET_CORE_disconnect (p1.ch);
178 GNUNET_CORE_disconnect (p2.ch);
181 GNUNET_TRANSPORT_disconnect (p1.th);
184 GNUNET_TRANSPORT_disconnect (p2.th);
191 try_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
194 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &try_connect,
196 GNUNET_TRANSPORT_try_connect (p1.th, &p2.id, NULL, NULL); /*FIXME TRY_CONNECT change */
197 GNUNET_TRANSPORT_try_connect (p2.th, &p1.id, NULL, NULL); /*FIXME TRY_CONNECT change */
201 * Callback function to process statistic values.
204 * @param subsystem name of subsystem that created the statistic
205 * @param name the name of the datum
206 * @param value the current value
207 * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not
208 * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
211 print_stat (void *cls, const char *subsystem, const char *name, uint64_t value,
215 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer1 %50s = %12llu\n", name,
216 (unsigned long long) value);
218 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer2 %50s = %12llu\n", name,
219 (unsigned long long) value);
224 measurement_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
226 unsigned long long delta;
227 unsigned long long throughput_out;
228 unsigned long long throughput_in;
229 unsigned long long max_quota_in;
230 unsigned long long max_quota_out;
231 unsigned long long quota_delta;
232 enum GNUNET_ErrorType kind = GNUNET_ERROR_TYPE_DEBUG;
234 measure_task = GNUNET_SCHEDULER_NO_TASK;
235 FPRINTF (stdout, "%s", "\n");
238 delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us;
240 throughput_out = total_bytes_sent * 1000000LL / delta; /* convert to bytes/s */
241 throughput_in = total_bytes_recv * 1000000LL / delta; /* convert to bytes/s */
243 max_quota_in = GNUNET_MIN (current_quota_p1_in, current_quota_p2_in);
244 max_quota_out = GNUNET_MIN (current_quota_p1_out, current_quota_p2_out);
245 if (max_quota_out < max_quota_in)
246 quota_delta = max_quota_in / 3;
248 quota_delta = max_quota_out / 3;
250 if ((throughput_out > (max_quota_out + quota_delta)) ||
251 (throughput_in > (max_quota_in + quota_delta)))
255 GNUNET_STATISTICS_get (p1.stats, "core", "# discarded CORE_SEND requests",
256 GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, &p1);
258 GNUNET_STATISTICS_get (p1.stats, "core",
259 "# discarded CORE_SEND request bytes",
260 GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, &p1);
261 GNUNET_STATISTICS_get (p1.stats, "core",
262 "# discarded lower priority CORE_SEND requests",
263 GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, NULL);
264 GNUNET_STATISTICS_get (p1.stats, "core",
265 "# discarded lower priority CORE_SEND request bytes",
266 GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, &p1);
267 GNUNET_STATISTICS_get (p2.stats, "core", "# discarded CORE_SEND requests",
268 GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, &p2);
270 GNUNET_STATISTICS_get (p2.stats, "core",
271 "# discarded CORE_SEND request bytes",
272 GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, &p2);
273 GNUNET_STATISTICS_get (p2.stats, "core",
274 "# discarded lower priority CORE_SEND requests",
275 GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, &p2);
276 GNUNET_STATISTICS_get (p2.stats, "core",
277 "# discarded lower priority CORE_SEND request bytes",
278 GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, &p2);
281 kind = GNUNET_ERROR_TYPE_ERROR;
285 GNUNET_log (kind, "Core quota compliance test with symmetric quotas: %s\n",
286 (0 == ok) ? "PASSED" : "FAILED");
288 case ASYMMETRIC_SEND_LIMITED:
290 "Core quota compliance test with limited sender quota: %s\n",
291 (0 == ok) ? "PASSED" : "FAILED");
293 case ASYMMETRIC_RECV_LIMITED:
295 "Core quota compliance test with limited receiver quota: %s\n",
296 (0 == ok) ? "PASSED" : "FAILED");
299 GNUNET_log (kind, "Peer 1 send rate: %llu b/s (%llu bytes in %llu ms)\n",
300 throughput_out, total_bytes_sent, delta);
301 GNUNET_log (kind, "Peer 1 send quota: %llu b/s\n", current_quota_p1_out);
302 GNUNET_log (kind, "Peer 2 receive rate: %llu b/s (%llu bytes in %llu ms)\n",
303 throughput_in, total_bytes_recv, delta);
304 GNUNET_log (kind, "Peer 2 receive quota: %llu b/s\n", current_quota_p2_in);
306 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Max. inbound quota allowed: %llu b/s\n",max_quota_in );
307 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Max. outbound quota allowed: %llu b/s\n",max_quota_out);
309 GNUNET_SCHEDULER_cancel (err_task);
310 err_task = GNUNET_SCHEDULER_add_now (&terminate_task, NULL);
315 transmit_ready (void *cls, size_t size, void *buf)
318 struct TestMessage hdr;
322 GNUNET_assert (size <= GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE);
325 if ((p1.ch != NULL) && (p1.connect_status == 1))
326 GNUNET_break (NULL !=
328 GNUNET_CORE_notify_transmit_ready (p1.ch, GNUNET_NO,
329 GNUNET_CORE_PRIO_BEST_EFFORT,
330 FAST_TIMEOUT, &p2.id,
332 &transmit_ready, &p1)));
335 GNUNET_assert (tr_n < TOTAL_MSGS);
337 GNUNET_assert (size >= MESSAGESIZE);
338 GNUNET_assert (buf != NULL);
342 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
343 "Sending message %u of size %u at offset %u\n", tr_n,
345 hdr.header.size = htons (MESSAGESIZE);
346 hdr.header.type = htons (MTYPE);
347 hdr.num = htonl (tr_n);
348 memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage));
349 ret += sizeof (struct TestMessage);
350 memset (&cbuf[ret], tr_n, MESSAGESIZE - sizeof (struct TestMessage));
351 ret += MESSAGESIZE - sizeof (struct TestMessage);
353 if (0 == GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 16))
354 break; /* sometimes pack buffer full, sometimes not */
356 while (size - ret >= MESSAGESIZE);
357 GNUNET_SCHEDULER_cancel (err_task);
359 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &terminate_task_error, NULL);
361 total_bytes_sent += ret;
368 connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer)
370 struct PeerContext *pc = cls;
372 if (0 == memcmp (&pc->id, peer, sizeof (struct GNUNET_PeerIdentity)))
373 return; /* loopback */
374 GNUNET_assert (pc->connect_status == 0);
375 pc->connect_status = 1;
378 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
379 "Encrypted connection established to peer `%4s'\n",
381 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
382 "Asking core (1) for transmission to peer `%4s'\n",
383 GNUNET_i2s (&p2.id));
384 if (err_task != GNUNET_SCHEDULER_NO_TASK)
385 GNUNET_SCHEDULER_cancel (err_task);
387 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &terminate_task_error, NULL);
388 start_time = GNUNET_TIME_absolute_get ();
389 running = GNUNET_YES;
391 GNUNET_SCHEDULER_add_delayed (MEASUREMENT_LENGTH, &measurement_stop,
394 GNUNET_break (NULL !=
396 GNUNET_CORE_notify_transmit_ready (p1.ch, GNUNET_NO,
397 GNUNET_CORE_PRIO_BEST_EFFORT,
400 &transmit_ready, &p1)));
406 disconnect_notify (void *cls, const struct GNUNET_PeerIdentity *peer)
408 struct PeerContext *pc = cls;
410 if (0 == memcmp (&pc->id, peer, sizeof (struct GNUNET_PeerIdentity)))
411 return; /* loopback */
412 pc->connect_status = 0;
413 if (GNUNET_SCHEDULER_NO_TASK != measure_task)
415 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
416 "Measurement aborted due to disconnect!\n");
417 GNUNET_SCHEDULER_cancel (measure_task);
418 measure_task = GNUNET_SCHEDULER_NO_TASK;
422 GNUNET_CORE_notify_transmit_ready_cancel (pc->nth);
425 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypted connection to `%4s' cut\n",
431 inbound_notify (void *cls, const struct GNUNET_PeerIdentity *other,
432 const struct GNUNET_MessageHeader *message)
434 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
435 "Core provides inbound data from `%4s' %llu.\n",
436 GNUNET_i2s (other), ntohs (message->size));
437 total_bytes_recv += ntohs (message->size);
443 outbound_notify (void *cls, const struct GNUNET_PeerIdentity *other,
444 const struct GNUNET_MessageHeader *message)
446 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
447 "Core notifies about outbound data for `%4s'.\n",
454 transmit_ready (void *cls, size_t size, void *buf);
457 process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
458 const struct GNUNET_MessageHeader *message)
461 const struct TestMessage *hdr;
463 hdr = (const struct TestMessage *) message;
464 if (MTYPE != ntohs (message->type))
465 return GNUNET_SYSERR;
466 if (ntohs (message->size) != MESSAGESIZE)
468 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
469 "Expected message %u of size %u, got %u bytes of message %u\n",
470 n, MESSAGESIZE, ntohs (message->size), ntohl (hdr->num));
471 GNUNET_SCHEDULER_cancel (err_task);
472 err_task = GNUNET_SCHEDULER_add_now (&terminate_task_error, NULL);
473 return GNUNET_SYSERR;
475 if (ntohl (hdr->num) != n)
477 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
478 "Expected message %u of size %u, got %u bytes of message %u\n",
479 n, MESSAGESIZE, ntohs (message->size), ntohl (hdr->num));
480 GNUNET_SCHEDULER_cancel (err_task);
481 err_task = GNUNET_SCHEDULER_add_now (&terminate_task_error, NULL);
482 return GNUNET_SYSERR;
484 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got message %u of size %u\n",
485 ntohl (hdr->num), ntohs (message->size));
488 FPRINTF (stderr, "%s", ".");
491 if (running == GNUNET_YES)
492 GNUNET_break (NULL !=
493 GNUNET_CORE_notify_transmit_ready (p1.ch, GNUNET_NO,
494 GNUNET_CORE_PRIO_BEST_EFFORT,
495 FAST_TIMEOUT, &p2.id,
497 &transmit_ready, &p1));
502 static struct GNUNET_CORE_MessageHandler handlers[] = {
503 {&process_mtype, MTYPE, 0},
510 init_notify (void *cls,
511 const struct GNUNET_PeerIdentity *my_identity)
513 struct PeerContext *p = cls;
515 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
516 "Connection to CORE service of `%4s' established\n",
517 GNUNET_i2s (my_identity));
518 GNUNET_assert (NULL != my_identity);
519 p->id = *my_identity;
522 GNUNET_assert (ok == 2);
526 GNUNET_CORE_connect (p2.cfg, &p2, &init_notify, &connect_notify,
527 &disconnect_notify, &inbound_notify, GNUNET_YES,
528 &outbound_notify, GNUNET_YES, handlers);
532 GNUNET_assert (ok == 3);
534 GNUNET_assert (cls == &p2);
535 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
536 "Asking core (1) to connect to peer `%4s'\n",
537 GNUNET_i2s (&p2.id));
538 connect_task = GNUNET_SCHEDULER_add_now (&try_connect, NULL);
544 process_hello (void *cls, const struct GNUNET_MessageHeader *message)
546 struct PeerContext *p = cls;
548 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
549 "Received (my) `%s' from transport service\n", "HELLO");
550 GNUNET_assert (message != NULL);
551 p->hello = GNUNET_malloc (ntohs (message->size));
552 memcpy (p->hello, message, ntohs (message->size));
553 if ((p == &p1) && (p2.th != NULL))
554 GNUNET_TRANSPORT_offer_hello (p2.th, message, NULL, NULL);
555 if ((p == &p2) && (p1.th != NULL))
556 GNUNET_TRANSPORT_offer_hello (p1.th, message, NULL, NULL);
558 if ((p == &p1) && (p2.hello != NULL))
559 GNUNET_TRANSPORT_offer_hello (p1.th, p2.hello, NULL, NULL);
560 if ((p == &p2) && (p1.hello != NULL))
561 GNUNET_TRANSPORT_offer_hello (p2.th, p1.hello, NULL, NULL);
567 setup_peer (struct PeerContext *p, const char *cfgname)
571 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
572 p->cfg = GNUNET_CONFIGURATION_create ();
574 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
577 "gnunet-service-arm",
578 "-c", cfgname, NULL);
579 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
580 p->stats = GNUNET_STATISTICS_create ("core", p->cfg);
581 GNUNET_assert (p->stats != NULL);
582 p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, NULL, NULL);
583 GNUNET_assert (p->th != NULL);
584 p->ghh = GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p);
585 GNUNET_free (binary);
590 run (void *cls, char *const *args, const char *cfgfile,
591 const struct GNUNET_CONFIGURATION_Handle *cfg)
593 GNUNET_assert (ok == 1);
596 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &terminate_task_error, NULL);
597 if (test == SYMMETRIC)
599 setup_peer (&p1, "test_core_quota_peer1.conf");
600 setup_peer (&p2, "test_core_quota_peer2.conf");
602 else if (test == ASYMMETRIC_SEND_LIMITED)
604 setup_peer (&p1, "test_core_quota_asymmetric_send_limit_peer1.conf");
605 setup_peer (&p2, "test_core_quota_asymmetric_send_limit_peer2.conf");
607 else if (test == ASYMMETRIC_RECV_LIMITED)
609 setup_peer (&p1, "test_core_quota_asymmetric_recv_limited_peer1.conf");
610 setup_peer (&p2, "test_core_quota_asymmetric_recv_limited_peer2.conf");
613 GNUNET_assert (test != -1);
614 GNUNET_assert (GNUNET_SYSERR !=
615 GNUNET_CONFIGURATION_get_value_size (p1.cfg, "ATS",
617 ¤t_quota_p1_in));
618 GNUNET_assert (GNUNET_SYSERR !=
619 GNUNET_CONFIGURATION_get_value_size (p2.cfg, "ATS",
621 ¤t_quota_p2_in));
622 GNUNET_assert (GNUNET_SYSERR !=
623 GNUNET_CONFIGURATION_get_value_size (p1.cfg, "ATS",
625 ¤t_quota_p1_out));
626 GNUNET_assert (GNUNET_SYSERR !=
627 GNUNET_CONFIGURATION_get_value_size (p2.cfg, "ATS",
629 ¤t_quota_p2_out));
632 GNUNET_CORE_connect (p1.cfg, &p1, &init_notify, &connect_notify,
633 &disconnect_notify, &inbound_notify, GNUNET_YES,
634 &outbound_notify, GNUNET_YES, handlers);
639 stop_arm (struct PeerContext *p)
641 if (0 != GNUNET_OS_process_kill (p->arm_proc, GNUNET_TERM_SIG))
642 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
643 if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK)
644 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
645 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ARM process %u stopped\n",
646 GNUNET_OS_process_get_pid (p->arm_proc));
647 GNUNET_OS_process_destroy (p->arm_proc);
649 GNUNET_CONFIGURATION_destroy (p->cfg);
656 char *const argv[] = { "test-core-quota-compliance",
658 "test_core_api_data.conf",
661 struct GNUNET_GETOPT_CommandLineOption options[] = {
662 GNUNET_GETOPT_OPTION_END
665 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
666 "test-core-quota-compliance", "nohelp", options, &run,
675 main (int argc, char *argv[])
680 if (strstr (argv[0], "_symmetric") != NULL)
684 else if (strstr (argv[0], "_asymmetric_send") != NULL)
686 test = ASYMMETRIC_SEND_LIMITED;
688 else if (strstr (argv[0], "_asymmetric_recv") != NULL)
690 test = ASYMMETRIC_RECV_LIMITED;
692 GNUNET_assert (test != -1);
693 if (test == SYMMETRIC)
695 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-1/");
696 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-2/");
698 else if (test == ASYMMETRIC_SEND_LIMITED)
700 GNUNET_DISK_directory_remove
701 ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-1/");
702 GNUNET_DISK_directory_remove
703 ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-2/");
705 else if (test == ASYMMETRIC_RECV_LIMITED)
707 GNUNET_DISK_directory_remove
708 ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-1/");
709 GNUNET_DISK_directory_remove
710 ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-2/");
713 GNUNET_log_setup ("test-core-quota-compliance",
717 if (test == SYMMETRIC)
719 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-1/");
720 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-2/");
722 else if (test == ASYMMETRIC_SEND_LIMITED)
724 GNUNET_DISK_directory_remove
725 ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-1/");
726 GNUNET_DISK_directory_remove
727 ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-2/");
729 else if (test == ASYMMETRIC_RECV_LIMITED)
731 GNUNET_DISK_directory_remove
732 ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-1/");
733 GNUNET_DISK_directory_remove
734 ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-2/");
739 /* end of test_core_quota_compliance.c */