2fbe8dcc551051022727996b62f1bfd68238a470
[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_YES
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 int ok;
109 static int measurement_running;
110
111 struct GNUNET_CORE_TransmitHandle * ch;
112
113 #if VERBOSE
114 #define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
115 #else
116 #define OKPP do { ok++; } while (0)
117 #endif
118
119 struct TestMessage 
120 {
121   struct GNUNET_MessageHeader header;
122   uint32_t num;
123 };
124
125 static void
126 terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
127 {
128   unsigned long long delta;
129
130   GNUNET_CORE_disconnect (p1.ch);
131   p1.ch = NULL;
132   GNUNET_CORE_disconnect (p2.ch);
133   p2.ch = NULL;
134   GNUNET_TRANSPORT_disconnect (p1.th);
135   p1.th = NULL;
136   GNUNET_TRANSPORT_disconnect (p2.th);
137   p2.th = NULL;
138   delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value;
139   ok = 0;
140 }
141
142
143 static void
144 terminate_task_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
145 {
146   GNUNET_break (0);
147   if (send_task != GNUNET_SCHEDULER_NO_TASK)
148           GNUNET_SCHEDULER_cancel (send_task);
149   GNUNET_CORE_disconnect (p1.ch);
150   p1.ch = NULL;
151   GNUNET_CORE_disconnect (p2.ch);
152   p2.ch = NULL;
153   GNUNET_TRANSPORT_disconnect (p1.th);
154   p1.th = NULL;
155   GNUNET_TRANSPORT_disconnect (p2.th);
156   p2.th = NULL;
157   ok = 42;
158 }
159
160 static void
161 next_fin (void *cls, int success)
162 {
163
164 }
165
166
167 static int
168 check_2 (void *cls,
169          const char *subsystem,
170          const char *name, uint64_t value, int is_persistent)
171 {
172  fprintf(stderr, "%s %s %llu\n", subsystem, name, (long long unsigned int) value);
173  return GNUNET_OK;
174 }
175
176 static size_t
177 transmit_ready (void *cls, size_t size, void *buf);
178
179 static void
180 send_tsk (void *cls,
181            const struct GNUNET_SCHEDULER_TaskContext *tc)
182 {
183   send_task = GNUNET_SCHEDULER_NO_TASK;
184
185   ch = GNUNET_CORE_notify_transmit_ready (p1.ch,
186                                           0,
187                                           FAST_TIMEOUT,
188                                           &p2.id,
189                                           sizeof (struct TestMessage) + MEASUREMENT_MSG_SIZE,
190                                           &transmit_ready, &p1);
191 }
192
193 static void
194 measurement_end (void *cls,
195            const struct GNUNET_SCHEDULER_TaskContext *tc)
196 {
197   struct GNUNET_TIME_Relative duration;
198
199   measure_task  = GNUNET_SCHEDULER_NO_TASK;
200   if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
201     return;
202
203   if (err_task != GNUNET_SCHEDULER_NO_TASK)
204     GNUNET_SCHEDULER_cancel (err_task);
205   if (send_task != GNUNET_SCHEDULER_NO_TASK)
206     GNUNET_SCHEDULER_cancel (send_task);
207
208   GNUNET_STATISTICS_get(p1.stats,"core","# discarded CORE_SEND requests",GNUNET_TIME_UNIT_SECONDS, &next_fin, &check_2, &p1);
209   GNUNET_STATISTICS_get(p1.stats,"core","# discarded CORE_SEND requests",GNUNET_TIME_UNIT_SECONDS, &next_fin, &check_2, &p2);
210   GNUNET_STATISTICS_get(p1.stats,"core","# discarded lower priority CORE_SEND requests",GNUNET_TIME_UNIT_SECONDS, &next_fin, &check_2, &p1);
211   GNUNET_STATISTICS_get(p1.stats,"core","# discarded lower priority CORE_SEND requests",GNUNET_TIME_UNIT_SECONDS, &next_fin, &check_2, &p2);
212
213   GNUNET_STATISTICS_get(p1.stats,"core","# discarded CORE_SEND request bytes",GNUNET_TIME_UNIT_SECONDS, &next_fin, &check_2, &p1);
214   GNUNET_STATISTICS_get(p1.stats,"core","# discarded CORE_SEND request bytes",GNUNET_TIME_UNIT_SECONDS, &next_fin, &check_2, &p2);
215   GNUNET_STATISTICS_get(p1.stats,"core","# discarded lower priority CORE_SEND request bytes",GNUNET_TIME_UNIT_SECONDS, &next_fin, &check_2, &p1);
216   GNUNET_STATISTICS_get(p1.stats,"core","# discarded lower priority CORE_SEND request bytes",GNUNET_TIME_UNIT_SECONDS, &next_fin, &check_2, &p2);
217   measurement_running = GNUNET_NO;
218   duration = GNUNET_TIME_absolute_get_difference(start_time, GNUNET_TIME_absolute_get());
219   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
220               "\nQuota compliance: \n"                  \
221               "Receive rate: %10llu kB/s\n"
222               "Send rate   : %10llu kB/s\n"                     \
223               "Quota       : %10llu kB/s\n",
224               (total_bytes_recv/(duration.rel_value / 1000)/1024),
225               (total_bytes_sent/(duration.rel_value / 1000)/1024),
226               current_quota_p1_in/1024);
227   GNUNET_SCHEDULER_add_now (&terminate_task, NULL);
228 }
229
230
231 static void
232 measure (unsigned long long quota_p1, unsigned long long quota_p2)
233 {
234 #if VERBOSE
235   if ((is_asymmetric_send_constant == GNUNET_YES) || (is_asymmetric_recv_constant == GNUNET_YES))
236           GNUNET_log (GNUNET_ERROR_TYPE_INFO,
237               "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);
238   else
239           GNUNET_log (GNUNET_ERROR_TYPE_INFO,
240               "Starting core level measurement for %u seconds, symmetric quota %llu kB/s\n", MEASUREMENT_INTERVALL.rel_value / 1000 , current_quota_p2_out / 1024);
241
242 #endif
243 #if DEBUG_CONNECTIONS
244   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
245               "Asking core (1) for transmission to peer `%4s'\n",
246               GNUNET_i2s (&p2.id));
247 #endif
248   err_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
249                               &terminate_task_error,
250                               NULL);
251   measure_task = GNUNET_SCHEDULER_add_delayed (MEASUREMENT_INTERVALL,
252                               &measurement_end,
253                               NULL);
254   start_time = GNUNET_TIME_absolute_get ();
255   measurement_running = GNUNET_YES;
256   total_bytes = 0;
257   total_bytes_sent = 0;
258   ch = GNUNET_CORE_notify_transmit_ready (p1.ch,
259                                           0,
260                                           TIMEOUT,
261                                           &p2.id,
262                                           sizeof (struct TestMessage) + MEASUREMENT_MSG_SIZE,
263                                           &transmit_ready, &p1);
264 }
265
266 static void connect_notify (void *cls,
267                 const struct GNUNET_PeerIdentity *peer,
268                 const struct GNUNET_TRANSPORT_ATS_Information *atsi)
269 {
270           struct PeerContext *pc = cls;
271
272           GNUNET_assert (pc->connect_status == 0);
273           pc->connect_status = 1;
274           if (pc == &p1)
275             {
276               GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
277                           "Encrypted connection established to peer `%4s'\n",
278                           GNUNET_i2s (peer));
279               GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
280                           "Asking core (1) for transmission to peer `%4s'\n",
281                           GNUNET_i2s (&p2.id));
282               measure (MEASUREMENT_MIN_QUOTA, MEASUREMENT_MIN_QUOTA);
283             }
284 }
285
286
287 static void
288 disconnect_notify (void *cls,
289                    const struct GNUNET_PeerIdentity *peer)
290 {
291   struct PeerContext *pc = cls;
292   pc->connect_status = 0;
293 #if DEBUG_CONNECTIONS
294   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
295               "Encrypted connection to `%4s' cut\n", GNUNET_i2s (peer));
296 #endif
297 }
298
299
300 static int
301 inbound_notify (void *cls,
302                 const struct GNUNET_PeerIdentity *other,
303                 const struct GNUNET_MessageHeader *message,
304                 const struct GNUNET_TRANSPORT_ATS_Information *atsi)
305 {
306   total_bytes_recv += ntohs (message->size);
307   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
308               "Core provides inbound data from `%4s' size %u.\n", GNUNET_i2s (other), ntohs (message->size));
309 #if DEBUG_CONNECTIONS
310   #endif
311   return GNUNET_OK;
312 }
313
314
315 static int
316 outbound_notify (void *cls,
317                  const struct GNUNET_PeerIdentity *other,
318                  const struct GNUNET_MessageHeader *message,
319                  const struct GNUNET_TRANSPORT_ATS_Information *atsi)
320 {
321 #if DEBUG_CONNECTIONS
322   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
323               "Core notifies about outbound data for `%4s'.\n",
324               GNUNET_i2s (other));
325 #endif
326   return GNUNET_OK;
327 }
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                const struct GNUNET_TRANSPORT_ATS_Information *atsi)
338 {
339   static int n;
340   unsigned int s;
341   const struct TestMessage *hdr;
342
343   hdr = (const struct TestMessage*) message;
344   s = sizeof (struct TestMessage) + MEASUREMENT_MSG_SIZE;
345   if (MTYPE != ntohs (message->type))
346     return GNUNET_SYSERR;
347
348 #if DEBUG_CONNECTIONS
349   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
350               "Got message %u of size %u\n",
351               ntohl (hdr->num),
352               ntohs (message->size));         
353 #endif
354   n++;
355   if (0 == (n % (TOTAL_MSGS/100)))
356     fprintf (stderr, ".");
357
358   return GNUNET_OK;
359 }
360
361
362 static struct GNUNET_CORE_MessageHandler handlers[] = {
363   {&process_mtype, MTYPE, 0},
364   {NULL, 0, 0}
365 };
366
367
368 static size_t
369 transmit_ready (void *cls, size_t size, void *buf)
370 {
371   char *cbuf = buf;
372   struct TestMessage hdr;
373   unsigned int s;
374   unsigned int ret;
375
376   if (measurement_running != GNUNET_YES)
377         return 0;
378
379   GNUNET_assert (size <= GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE);
380   if (buf == NULL)
381     {
382       if (p1.ch != NULL)
383       {
384                 ch = GNUNET_CORE_notify_transmit_ready (p1.ch,
385                                                          0,
386                                                          FAST_TIMEOUT,
387                                                          &p2.id,
388                                                          sizeof (struct TestMessage) + MEASUREMENT_MSG_SIZE,
389                                                          &transmit_ready, &p1);
390                 GNUNET_break (NULL != ch);
391       }
392       return 0;
393     }
394   ret = 0;
395   ch = NULL;
396   s = sizeof (struct TestMessage) + MEASUREMENT_MSG_SIZE;
397
398   GNUNET_assert (size >= s);
399   GNUNET_assert (buf != NULL);
400   cbuf = buf;
401   do
402     {
403 #if DEBUG_CONNECTIONS
404       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
405                   "Sending message %u of size %u at offset %u\n",
406                   tr_n,
407                   s,
408                   ret);
409 #endif
410       hdr.header.size = htons (s);
411       hdr.header.type = htons (MTYPE);
412       hdr.num = htonl (tr_n);
413       memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage));
414       ret += sizeof (struct TestMessage);
415       memset (&cbuf[ret], tr_n, s - sizeof (struct TestMessage));
416       ret += s - sizeof (struct TestMessage);
417       tr_n++;
418       if (0 == GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 16))
419         break; /* sometimes pack buffer full, sometimes not */
420     }
421   while (size - ret >= s);
422   GNUNET_SCHEDULER_cancel (err_task);
423   err_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
424                                   &terminate_task_error,
425                                   NULL);
426
427   total_bytes += ret;
428   total_bytes_sent += ret;
429   if (send_task != GNUNET_SCHEDULER_NO_TASK)
430           GNUNET_SCHEDULER_cancel(send_task);
431   send_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 20), &send_tsk, NULL);
432
433   return ret;
434 }
435
436
437
438 static void
439 init_notify (void *cls,
440              struct GNUNET_CORE_Handle *server,
441              const struct GNUNET_PeerIdentity *my_identity,
442              const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey)
443 {
444   struct PeerContext *p = cls;
445 #if DEBUG_CONNECTIONS
446   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
447               "Connection to CORE service of `%4s' established\n",
448               GNUNET_i2s (my_identity));
449 #endif
450   GNUNET_assert (server != NULL);
451   p->id = *my_identity;
452   p->ch = server;
453   if (cls == &p1)
454     {
455       GNUNET_assert (ok == 2);
456       OKPP;
457       /* connect p2 */
458       GNUNET_CORE_connect (p2.cfg, 1,
459                            &p2,
460                            &init_notify,                         
461                            &connect_notify,
462                            &disconnect_notify,
463                            NULL,
464                            &inbound_notify,
465                            GNUNET_YES,
466                            &outbound_notify, GNUNET_YES, handlers);
467     }
468   else
469     {
470       GNUNET_assert (ok == 3);
471       OKPP;
472       GNUNET_assert (cls == &p2);
473       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
474                   "Asking core (1) to connect to peer `%4s'\n",
475                   GNUNET_i2s (&p2.id));
476       GNUNET_CORE_peer_request_connect (p1.ch,
477                         GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5),
478                                         &p2.id,
479                                         NULL, NULL);
480     }
481 }
482
483
484 static void
485 process_hello (void *cls,
486                const struct GNUNET_MessageHeader *message)
487 {
488   struct PeerContext *p = cls;
489
490   GNUNET_TRANSPORT_get_hello_cancel (p->th, &process_hello, p);
491 #if DEBUG_CONNECTIONS
492   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
493               "Received (my) `%s' from transport service\n",
494               "HELLO");
495 #endif
496   GNUNET_assert (message != NULL);
497   p->hello = GNUNET_malloc (ntohs (message->size));
498   memcpy (p->hello, message, ntohs (message->size));
499   if ((p == &p1) && (p2.th != NULL))
500     GNUNET_TRANSPORT_offer_hello (p2.th, message);
501   if ((p == &p2) && (p1.th != NULL))
502     GNUNET_TRANSPORT_offer_hello (p1.th, message);
503
504   if ((p == &p1) && (p2.hello != NULL))
505     GNUNET_TRANSPORT_offer_hello (p1.th, p2.hello);
506   if ((p == &p2) && (p1.hello != NULL))
507     GNUNET_TRANSPORT_offer_hello (p2.th, p1.hello);
508 }
509
510
511
512 static void
513 setup_peer (struct PeerContext *p, const char *cfgname)
514 {
515   p->cfg = GNUNET_CONFIGURATION_create ();
516 #if START_ARM
517   p->arm_proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm",
518                                         "gnunet-service-arm",
519 #if VERBOSE
520                                         "-L", "DEBUG",
521 #endif
522                                         "-c", cfgname, NULL);
523 #endif
524   GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
525   p->stats = GNUNET_STATISTICS_create ("core", p->cfg);
526   GNUNET_assert (p->stats != NULL);
527   p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, NULL, NULL);
528   GNUNET_assert (p->th != NULL);
529   GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p);
530 }
531
532
533 static void
534 run (void *cls,
535      char *const *args,
536      const char *cfgfile,
537      const struct GNUNET_CONFIGURATION_Handle *cfg)
538 {
539   GNUNET_assert (ok == 1);
540   OKPP;
541   setup_peer (&p1, "test_core_quota_peer1.conf");
542   setup_peer (&p2, "test_core_quota_peer2.conf");
543   GNUNET_CORE_connect (p1.cfg, 1,
544                        &p1,
545                        &init_notify,
546                        &connect_notify,
547                        &disconnect_notify,
548                        NULL,
549                        &inbound_notify,
550                        GNUNET_YES, &outbound_notify, GNUNET_YES, handlers);
551
552   GNUNET_assert (GNUNET_SYSERR != GNUNET_CONFIGURATION_get_value_number (p1.cfg,
553                                          "CORE",
554                                          "TOTAL_QUOTA_IN",
555                                          &current_quota_p1_in));
556   GNUNET_assert (GNUNET_SYSERR != GNUNET_CONFIGURATION_get_value_number (p2.cfg,
557                                          "CORE",
558                                          "TOTAL_QUOTA_IN",
559                                          &current_quota_p2_in));
560   GNUNET_assert (GNUNET_SYSERR != GNUNET_CONFIGURATION_get_value_number (p1.cfg,
561                                          "CORE",
562                                          "TOTAL_QUOTA_OUT",
563                                          &current_quota_p1_out));
564   GNUNET_assert (GNUNET_SYSERR != GNUNET_CONFIGURATION_get_value_number (p2.cfg,
565                                          "CORE",
566                                          "TOTAL_QUOTA_OUT",
567                                          &current_quota_p2_out));
568 }
569
570
571 static void
572 stop_arm (struct PeerContext *p)
573 {
574 #if START_ARM
575   if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
576         GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
577   if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK)
578         GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
579
580   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"ARM process stopped\n");
581   GNUNET_OS_process_close (p->arm_proc);
582   p->arm_proc = NULL;
583 #endif
584   GNUNET_STATISTICS_destroy (p->stats, 0);
585   GNUNET_CONFIGURATION_destroy (p->cfg);
586 }
587
588 static int
589 check ()
590 {
591   char *const argv[] = { "test-core-quota-compliance",
592     "-c",
593     "test_core_api_data.conf",
594 #if VERBOSE
595     "-L", "DEBUG",
596 #endif
597     NULL
598   };
599   struct GNUNET_GETOPT_CommandLineOption options[] = {
600     GNUNET_GETOPT_OPTION_END
601   };
602   ok = 1;
603   GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
604                       argv, "test_core_quota_compliance", "nohelp", options, &run, &ok);
605   stop_arm (&p1);
606   stop_arm (&p2);
607   return ok;
608 }
609
610 int
611 main (int argc, char *argv[])
612 {
613   int ret;
614
615   GNUNET_log_setup ("test-core-quota-compliance",
616 #if VERBOSE
617                     "DEBUG",
618 #else
619                     "WARNING",
620 #endif
621                     NULL);
622   ret = check ();
623   GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-peer-2");
624   GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-peer-2");
625
626   return ret;
627 }
628
629 /* end of test_core_quota_compliance.c */