added statistics to get information about discarded messages
[oweals/gnunet.git] / src / core / test_core_quota_compliance.c
1 /*
2      This file is part of GNUnet.
3      (C) 2009, 2010 Christian Grothoff (and other contributing authors)
4
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.
9
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.
14
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.
19 */
20 /**
21  * @file core/test_core_quota_compliance.c
22  * @brief testcase for core_api.c focusing quota compliance on core level
23  *
24  * FIXME:
25  * - make sure connect callback is invoked properly as well!
26  */
27 #include "platform.h"
28 #include "gnunet_common.h"
29 #include "gnunet_constants.h"
30 #include "gnunet_arm_service.h"
31 #include "gnunet_core_service.h"
32 #include "gnunet_getopt_lib.h"
33 #include "gnunet_os_lib.h"
34 #include "gnunet_program_lib.h"
35 #include "gnunet_scheduler_lib.h"
36 #include "gnunet_transport_service.h"
37 #include "gnunet_statistics_service.h"
38
39 #define VERBOSE GNUNET_YES
40
41 #define START_ARM GNUNET_YES
42 #define DEBUG_CONNECTIONS GNUNET_NO
43
44 /**
45  * Note that this value must not significantly exceed
46  * 'MAX_PENDING' in 'gnunet-service-transport.c', otherwise
47  * messages may be dropped even for a reliable transport.
48  */
49 #define TOTAL_MSGS (600 * 10)
50
51 #define MEASUREMENT_MSG_SIZE 10240
52 #define MEASUREMENT_MAX_QUOTA 1024 * 1024 * 1024
53 #define MEASUREMENT_MIN_QUOTA 1024
54 #define MEASUREMENT_INTERVALL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
55
56 /**
57  * How long until we give up on transmitting the message?
58  */
59 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 6000)
60
61 /**
62  * What delay do we request from the core service for transmission?
63  * Any value smaller than the CORK delay will disable CORKing, which
64  * is what we want here.
65  */
66 #define FAST_TIMEOUT GNUNET_TIME_relative_divide (GNUNET_CONSTANTS_MAX_CORK_DELAY, 2)
67
68 #define MTYPE 12345
69
70 static int is_asymmetric_send_constant;
71 static int is_asymmetric_recv_constant;
72 static unsigned long long current_quota_p1_in;
73 static unsigned long long current_quota_p1_out;
74 static unsigned long long current_quota_p2_in;
75 static unsigned long long current_quota_p2_out;
76
77 static unsigned long long total_bytes;
78 static unsigned long long total_bytes_sent;
79 static unsigned long long total_bytes_recv;
80
81 static struct GNUNET_TIME_Absolute start_time;
82
83 static GNUNET_SCHEDULER_TaskIdentifier err_task;
84
85 static GNUNET_SCHEDULER_TaskIdentifier send_task;
86
87 static GNUNET_SCHEDULER_TaskIdentifier measure_task;
88
89 struct PeerContext
90 {
91   struct GNUNET_CONFIGURATION_Handle *cfg;
92   struct GNUNET_STATISTICS_Handle *stats;
93   struct GNUNET_CORE_Handle *ch;
94   struct GNUNET_PeerIdentity id;   
95   struct GNUNET_TRANSPORT_Handle *th;
96   struct GNUNET_MessageHeader *hello;
97
98   int connect_status;
99 #if START_ARM
100   struct GNUNET_OS_Process *arm_proc;
101 #endif
102 };
103
104 static struct PeerContext p1;
105
106 static struct PeerContext p2;
107
108 static struct GNUNET_SCHEDULER_Handle *sched;
109
110 static int ok;
111 static int measurement_running;
112
113 struct GNUNET_CORE_TransmitHandle * ch;
114
115 #if VERBOSE
116 #define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
117 #else
118 #define OKPP do { ok++; } while (0)
119 #endif
120
121 struct TestMessage 
122 {
123   struct GNUNET_MessageHeader header;
124   uint32_t num;
125 };
126
127 static void
128 terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
129 {
130   unsigned long long delta;
131
132   GNUNET_CORE_disconnect (p1.ch);
133   p1.ch = NULL;
134   GNUNET_CORE_disconnect (p2.ch);
135   p2.ch = NULL;
136   GNUNET_TRANSPORT_disconnect (p1.th);
137   p1.th = NULL;
138   GNUNET_TRANSPORT_disconnect (p2.th);
139   p2.th = NULL;
140   delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value;
141   ok = 0;
142 }
143
144
145 static void
146 terminate_task_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
147 {
148   GNUNET_break (0);
149   if (send_task != GNUNET_SCHEDULER_NO_TASK)
150           GNUNET_SCHEDULER_cancel (sched,send_task);
151   GNUNET_CORE_disconnect (p1.ch);
152   p1.ch = NULL;
153   GNUNET_CORE_disconnect (p2.ch);
154   p2.ch = NULL;
155   GNUNET_TRANSPORT_disconnect (p1.th);
156   p1.th = NULL;
157   GNUNET_TRANSPORT_disconnect (p2.th);
158   p2.th = NULL;
159   ok = 42;
160 }
161
162 static void
163 connect_notify (void *cls,
164                 const struct GNUNET_PeerIdentity *peer,
165                 struct GNUNET_TIME_Relative latency,
166                 uint32_t distance)
167 {
168   struct PeerContext *pc = cls;
169   GNUNET_assert (pc->connect_status == 0);
170   pc->connect_status = 1;
171 #if DEBUG_CONNECTIONS
172   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
173               "Encrypted connection established to peer `%4s'\n",
174               GNUNET_i2s (peer));
175 #endif
176 }
177
178
179 static void
180 disconnect_notify (void *cls,
181                    const struct GNUNET_PeerIdentity *peer)
182 {
183   struct PeerContext *pc = cls;
184   pc->connect_status = 0;
185 #if DEBUG_CONNECTIONS
186   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
187               "Encrypted connection to `%4s' cut\n", GNUNET_i2s (peer));
188 #endif
189 }
190
191
192 static int
193 inbound_notify (void *cls,
194                 const struct GNUNET_PeerIdentity *other,
195                 const struct GNUNET_MessageHeader *message,
196                 struct GNUNET_TIME_Relative latency,
197                 uint32_t distance)
198 {
199   total_bytes_recv += ntohs (message->size);
200   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
201               "Core provides inbound data from `%4s' size %u.\n", GNUNET_i2s (other), ntohs (message->size));
202 #if DEBUG_CONNECTIONS
203   #endif
204   return GNUNET_OK;
205 }
206
207
208 static int
209 outbound_notify (void *cls,
210                  const struct GNUNET_PeerIdentity *other,
211                  const struct GNUNET_MessageHeader *message,
212                  struct GNUNET_TIME_Relative latency,
213                  uint32_t distance)
214 {
215 #if DEBUG_CONNECTIONS
216   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
217               "Core notifies about outbound data for `%4s'.\n",
218               GNUNET_i2s (other));
219 #endif
220   return GNUNET_OK;
221 }
222
223 static void
224 next_fin (void *cls, int success)
225 {
226
227 }
228
229
230 static int
231 check_2 (void *cls,
232          const char *subsystem,
233          const char *name, uint64_t value, int is_persistent)
234 {
235  fprintf(stderr, "%s %s %llu\n", subsystem, name, (long long unsigned int) value);
236  return GNUNET_OK;
237 }
238
239 static void
240 measurement_end (void *cls,
241            const struct GNUNET_SCHEDULER_TaskContext *tc)
242 {
243           struct GNUNET_TIME_Relative duration;
244
245           measure_task  = GNUNET_SCHEDULER_NO_TASK;
246           if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
247                 return;
248
249           if (err_task != GNUNET_SCHEDULER_NO_TASK)
250                   GNUNET_SCHEDULER_cancel (sched, err_task);
251           if (send_task != GNUNET_SCHEDULER_NO_TASK)
252                   GNUNET_SCHEDULER_cancel (sched,send_task);
253
254           GNUNET_STATISTICS_get(p1.stats,"core","# discarded CORE_SEND requests",GNUNET_TIME_UNIT_SECONDS, &next_fin, &check_2, &p1);
255           GNUNET_STATISTICS_get(p1.stats,"core","# discarded CORE_SEND requests",GNUNET_TIME_UNIT_SECONDS, &next_fin, &check_2, &p2);
256           GNUNET_STATISTICS_get(p1.stats,"core","# discarded lower priority CORE_SEND requests",GNUNET_TIME_UNIT_SECONDS, &next_fin, &check_2, &p1);
257           GNUNET_STATISTICS_get(p1.stats,"core","# discarded lower priority CORE_SEND requests",GNUNET_TIME_UNIT_SECONDS, &next_fin, &check_2, &p2);
258
259           GNUNET_STATISTICS_get(p1.stats,"core","# discarded CORE_SEND request bytes",GNUNET_TIME_UNIT_SECONDS, &next_fin, &check_2, &p1);
260           GNUNET_STATISTICS_get(p1.stats,"core","# discarded CORE_SEND request bytes",GNUNET_TIME_UNIT_SECONDS, &next_fin, &check_2, &p2);
261           GNUNET_STATISTICS_get(p1.stats,"core","# discarded lower priority CORE_SEND request bytes",GNUNET_TIME_UNIT_SECONDS, &next_fin, &check_2, &p1);
262           GNUNET_STATISTICS_get(p1.stats,"core","# discarded lower priority CORE_SEND request bytes",GNUNET_TIME_UNIT_SECONDS, &next_fin, &check_2, &p2);
263           measurement_running = GNUNET_NO;
264           duration = GNUNET_TIME_absolute_get_difference(start_time, GNUNET_TIME_absolute_get());
265           GNUNET_log (GNUNET_ERROR_TYPE_INFO,
266                           "\nQuota compliance: \n"\
267                           "Receive rate: %10llu kB/s\n"
268                           "Send rate   : %10llu kB/s\n"\
269                           "Quota       : %10llu kB/s\n",
270                           (total_bytes_recv/(duration.rel_value / 1000)/1024),
271                           (total_bytes_sent/(duration.rel_value / 1000)/1024),current_quota_p1_in/1024);
272
273
274       GNUNET_SCHEDULER_add_now (sched, &terminate_task, NULL);
275 }
276
277 static size_t
278 transmit_ready (void *cls, size_t size, void *buf);
279
280 static void
281 send_tsk (void *cls,
282            const struct GNUNET_SCHEDULER_TaskContext *tc)
283 {
284          send_task = GNUNET_SCHEDULER_NO_TASK;
285
286           ch = GNUNET_CORE_notify_transmit_ready (p1.ch,
287                                                                  0,
288                                                                  FAST_TIMEOUT,
289                                                                  &p2.id,
290                                                                  sizeof (struct TestMessage) + MEASUREMENT_MSG_SIZE,
291                                                                  &transmit_ready, &p1);
292 }
293
294 static void measure (unsigned long long quota_p1, unsigned long long quota_p2 )
295 {
296 #if VERBOSE
297   if ((is_asymmetric_send_constant == GNUNET_YES) || (is_asymmetric_recv_constant == GNUNET_YES))
298           GNUNET_log (GNUNET_ERROR_TYPE_INFO,
299               "Starting core level measurement for %u seconds receiving peer quota %llu kB/s, sending peer quota %llu kB/s\n", MEASUREMENT_INTERVALL.rel_value / 1000 , current_quota_p1_in / 1024, current_quota_p2_out / 1024);
300   else
301           GNUNET_log (GNUNET_ERROR_TYPE_INFO,
302               "Starting core level measurement for %u seconds, symmetric quota %llu kB/s\n", MEASUREMENT_INTERVALL.rel_value / 1000 , current_quota_p2_out / 1024);
303
304 #endif
305 #if DEBUG_CONNECTIONS
306   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
307               "Asking core (1) for transmission to peer `%4s'\n",
308               GNUNET_i2s (&p2.id));
309 #endif
310   err_task = GNUNET_SCHEDULER_add_delayed (sched,
311                               TIMEOUT,
312                               &terminate_task_error,
313                               NULL);
314   measure_task = GNUNET_SCHEDULER_add_delayed (sched,
315                               MEASUREMENT_INTERVALL,
316                               &measurement_end,
317                               NULL);
318   start_time = GNUNET_TIME_absolute_get ();
319   measurement_running = GNUNET_YES;
320   total_bytes = 0;
321   total_bytes_sent = 0;
322   ch = GNUNET_CORE_notify_transmit_ready (p1.ch,
323                                                0,
324                                                TIMEOUT,
325                                                &p2.id,
326                                                sizeof (struct TestMessage) + MEASUREMENT_MSG_SIZE,
327                                                &transmit_ready, &p1);
328 }
329
330 static int tr_n;
331
332
333 static int
334 process_mtype (void *cls,
335                const struct GNUNET_PeerIdentity *peer,
336                const struct GNUNET_MessageHeader *message,
337                struct GNUNET_TIME_Relative latency,
338                uint32_t distance)
339 {
340   static int n;
341   unsigned int s;
342   const struct TestMessage *hdr;
343
344   hdr = (const struct TestMessage*) message;
345   s = sizeof (struct TestMessage) + MEASUREMENT_MSG_SIZE;
346   if (MTYPE != ntohs (message->type))
347     return GNUNET_SYSERR;
348
349 #if DEBUG_CONNECTIONS
350   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
351               "Got message %u of size %u\n",
352               ntohl (hdr->num),
353               ntohs (message->size));         
354 #endif
355   n++;
356   if (0 == (n % (TOTAL_MSGS/100)))
357     fprintf (stderr, ".");
358
359   return GNUNET_OK;
360 }
361
362
363 static struct GNUNET_CORE_MessageHandler handlers[] = {
364   {&process_mtype, MTYPE, 0},
365   {NULL, 0, 0}
366 };
367
368
369 static size_t
370 transmit_ready (void *cls, size_t size, void *buf)
371 {
372   char *cbuf = buf;
373   struct TestMessage hdr;
374   unsigned int s;
375   unsigned int ret;
376
377   if (measurement_running != GNUNET_YES)
378         return 0;
379
380   GNUNET_assert (size <= GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE); 
381   if (buf == NULL)
382     {
383       if (p1.ch != NULL)
384       {
385                 ch = GNUNET_CORE_notify_transmit_ready (p1.ch,
386                                                          0,
387                                                          FAST_TIMEOUT,
388                                                          &p2.id,
389                                                          sizeof (struct TestMessage) + MEASUREMENT_MSG_SIZE,
390                                                          &transmit_ready, &p1);
391                 GNUNET_break (NULL != ch);
392       }
393       return 0;
394     }
395   ret = 0;
396   ch = NULL;
397   s = sizeof (struct TestMessage) + MEASUREMENT_MSG_SIZE;
398
399   GNUNET_assert (size >= s);
400   GNUNET_assert (buf != NULL);
401   cbuf = buf;
402   do
403     {
404 #if DEBUG_CONNECTIONS
405       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
406                   "Sending message %u of size %u at offset %u\n",
407                   tr_n,
408                   s,
409                   ret);
410 #endif
411       hdr.header.size = htons (s);
412       hdr.header.type = htons (MTYPE);
413       hdr.num = htonl (tr_n);
414       memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage));
415       ret += sizeof (struct TestMessage);
416       memset (&cbuf[ret], tr_n, s - sizeof (struct TestMessage));
417       ret += s - sizeof (struct TestMessage);
418       tr_n++;
419       if (0 == GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 16))
420         break; /* sometimes pack buffer full, sometimes not */
421     }
422   while (size - ret >= s);
423   GNUNET_SCHEDULER_cancel (sched, err_task);
424   err_task = GNUNET_SCHEDULER_add_delayed (sched,
425                                   TIMEOUT,
426                                   &terminate_task_error, 
427                                   NULL);
428
429   total_bytes += ret;
430   total_bytes_sent += ret;
431   if (send_task != GNUNET_SCHEDULER_NO_TASK)
432           GNUNET_SCHEDULER_cancel(sched, send_task);
433   send_task = GNUNET_SCHEDULER_add_delayed (sched, GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 20), &send_tsk, NULL);
434
435   return ret;
436 }
437
438
439
440 static void
441 init_notify (void *cls,
442              struct GNUNET_CORE_Handle *server,
443              const struct GNUNET_PeerIdentity *my_identity,
444              const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey)
445 {
446   struct PeerContext *p = cls;
447 #if DEBUG_CONNECTIONS
448   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
449               "Connection to CORE service of `%4s' established\n",
450               GNUNET_i2s (my_identity));
451 #endif
452   GNUNET_assert (server != NULL);
453   p->id = *my_identity;
454   p->ch = server;
455   if (cls == &p1)
456     {
457       GNUNET_assert (ok == 2);
458       OKPP;
459       /* connect p2 */
460       GNUNET_CORE_connect (sched,
461                            p2.cfg,
462                            TIMEOUT,
463                            &p2,
464                            &init_notify,                         
465                            &connect_notify,
466                            &disconnect_notify,
467                            NULL,
468                            &inbound_notify,
469                            GNUNET_YES,
470                            &outbound_notify, GNUNET_YES, handlers);
471     }
472   else
473     {
474       GNUNET_assert (ok == 3);
475       OKPP;
476       GNUNET_assert (cls == &p2);
477
478       measure (MEASUREMENT_MIN_QUOTA, MEASUREMENT_MIN_QUOTA);
479     }
480 }
481
482
483 static void
484 process_hello (void *cls,
485                const struct GNUNET_MessageHeader *message)
486 {
487   struct PeerContext *p = cls;
488
489   GNUNET_TRANSPORT_get_hello_cancel (p->th, &process_hello, p);
490 #if DEBUG_CONNECTIONS
491   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
492               "Received (my) `%s' from transport service\n",
493               "HELLO");
494 #endif
495   GNUNET_assert (message != NULL);
496   p->hello = GNUNET_malloc (ntohs (message->size));
497   memcpy (p->hello, message, ntohs (message->size));
498   if ((p == &p1) && (p2.th != NULL))
499     GNUNET_TRANSPORT_offer_hello (p2.th, message);
500   if ((p == &p2) && (p1.th != NULL))
501     GNUNET_TRANSPORT_offer_hello (p1.th, message);
502
503   if ((p == &p1) && (p2.hello != NULL))
504     GNUNET_TRANSPORT_offer_hello (p1.th, p2.hello);
505   if ((p == &p2) && (p1.hello != NULL))
506     GNUNET_TRANSPORT_offer_hello (p2.th, p1.hello);
507 }
508
509
510
511 static void
512 setup_peer (struct PeerContext *p, const char *cfgname)
513 {
514   p->cfg = GNUNET_CONFIGURATION_create ();
515 #if START_ARM
516   p->arm_proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm",
517                                         "gnunet-service-arm",
518 #if VERBOSE
519                                         "-L", "DEBUG",
520 #endif
521                                         "-c", cfgname, NULL);
522 #endif
523   GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
524   p->stats = GNUNET_STATISTICS_create (sched, "core", p->cfg);
525   GNUNET_assert (p->stats != NULL);
526   p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, NULL, p, NULL, NULL, NULL);
527   GNUNET_assert (p->th != NULL);
528   GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p);
529 }
530
531
532 static void
533 run (void *cls,
534      struct GNUNET_SCHEDULER_Handle *s,
535      char *const *args,
536      const char *cfgfile,
537      const struct GNUNET_CONFIGURATION_Handle *cfg)
538 {
539   GNUNET_assert (ok == 1);
540   OKPP;
541   sched = s;
542   setup_peer (&p1, "test_core_quota_peer1.conf");
543   setup_peer (&p2, "test_core_quota_peer2.conf");
544   GNUNET_CORE_connect (sched,
545                        p1.cfg,
546                        TIMEOUT,
547                        &p1,
548                        &init_notify,
549                        &connect_notify,
550                        &disconnect_notify,
551                        NULL,
552                        &inbound_notify,
553                        GNUNET_YES, &outbound_notify, GNUNET_YES, handlers);
554
555   GNUNET_assert (GNUNET_SYSERR != GNUNET_CONFIGURATION_get_value_number (p1.cfg,
556                                          "CORE",
557                                          "TOTAL_QUOTA_IN",
558                                          &current_quota_p1_in));
559   GNUNET_assert (GNUNET_SYSERR != GNUNET_CONFIGURATION_get_value_number (p2.cfg,
560                                          "CORE",
561                                          "TOTAL_QUOTA_IN",
562                                          &current_quota_p2_in));
563   GNUNET_assert (GNUNET_SYSERR != GNUNET_CONFIGURATION_get_value_number (p1.cfg,
564                                          "CORE",
565                                          "TOTAL_QUOTA_OUT",
566                                          &current_quota_p1_out));
567   GNUNET_assert (GNUNET_SYSERR != GNUNET_CONFIGURATION_get_value_number (p2.cfg,
568                                          "CORE",
569                                          "TOTAL_QUOTA_OUT",
570                                          &current_quota_p2_out));
571 }
572
573
574 static void
575 stop_arm (struct PeerContext *p)
576 {
577 #if START_ARM
578   if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
579         GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
580   if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK)
581         GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
582
583   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"ARM process stopped\n");
584   GNUNET_OS_process_close (p->arm_proc);
585   p->arm_proc = NULL;
586 #endif
587   GNUNET_STATISTICS_destroy (p->stats, 0);
588   GNUNET_CONFIGURATION_destroy (p->cfg);
589 }
590
591 static int
592 check ()
593 {
594   char *const argv[] = { "test-core-quota-compliance",
595     "-c",
596     "test_core_api_data.conf",
597 #if VERBOSE
598     "-L", "DEBUG",
599 #endif
600     NULL
601   };
602   struct GNUNET_GETOPT_CommandLineOption options[] = {
603     GNUNET_GETOPT_OPTION_END
604   };
605   ok = 1;
606   GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
607                       argv, "test_core_quota_compliance", "nohelp", options, &run, &ok);
608   stop_arm (&p1);
609   stop_arm (&p2);
610   return ok;
611 }
612
613 int
614 main (int argc, char *argv[])
615 {
616   int ret;
617
618   GNUNET_log_setup ("test-core-api",
619 #if VERBOSE
620                     "DEBUG",
621 #else
622                     "WARNING",
623 #endif
624                     NULL);
625   ret = check ();
626   GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-peer-2");
627   GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-peer-2");
628
629   return ret;
630 }
631
632 /* end of test_core_quota_compliance.c */