commenting out dead test
[oweals/gnunet.git] / src / dht / test_dht_monitor.c
1 /*
2      This file is part of GNUnet.
3      (C) 2011, 2012 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 dht/test_dht_monitor.c
22  *
23  * @brief Test for the dht service: store, retrieve and monitor in a line.
24  * TODO: update this description
25  * Each peer stores it own ID in the DHT and then a different peer tries to
26  * retrieve that key from it. The GET starts after a first round of PUTS has
27  * been made. Periodically, each peer stores its ID into the DHT. If after
28  * a timeout no result has been returned, the test fails.
29  */
30 #include "platform.h"
31 #include "gnunet_testing_lib.h"
32 #include "gnunet_dht_service.h"
33
34 #define REMOVE_DIR GNUNET_YES
35
36
37 /**
38  * How long until we give up on connecting the peers?
39  */
40 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1500)
41
42 #define GET_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120)
43
44 #define PUT_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
45
46 static int ok;
47
48 /**
49  * Be verbose
50  */
51 static int verbose;
52
53 /**
54  * Total number of peers in the test.
55  */
56 static unsigned long long num_peers;
57
58 /**
59  * Global configuration file
60  */
61 static struct GNUNET_CONFIGURATION_Handle *testing_cfg;
62
63 /**
64  * Total number of currently running peers.
65  */
66 static unsigned long long peers_running;
67
68 /**
69  * Total number of connections in the whole network.
70  */
71 static unsigned int total_connections;
72
73 /**
74  * The currently running peer group.
75  */
76 static struct GNUNET_TESTING_PeerGroup *pg;
77
78 /**
79  * File to report results to.
80  */
81 static struct GNUNET_DISK_FileHandle *output_file;
82
83 /**
84  * File to log connection info, statistics to.
85  */
86 static struct GNUNET_DISK_FileHandle *data_file;
87
88 /**
89  * Task called to disconnect peers.
90  */
91 static GNUNET_SCHEDULER_TaskIdentifier disconnect_task;
92
93 /**
94  * Task To perform tests
95  */
96 static GNUNET_SCHEDULER_TaskIdentifier test_task;
97
98 /**
99  * Task to do DHT_puts
100  */
101 static GNUNET_SCHEDULER_TaskIdentifier put_task;
102
103 /**
104  * Task called to shutdown test.
105  */
106 static GNUNET_SCHEDULER_TaskIdentifier shutdown_handle;
107
108 static char *topology_file;
109
110 static struct GNUNET_DHT_Handle **hs;
111
112 static struct GNUNET_DHT_MonitorHandle **mhs;
113
114 static struct GNUNET_DHT_GetHandle *get_h_far;
115
116 static const char *id_far = "2UVH";
117
118 static struct GNUNET_TESTING_Daemon *d_far;
119
120 static struct GNUNET_TESTING_Daemon *o;
121
122 static unsigned int monitor_counter;
123
124 static unsigned int monitor_expect = UINT_MAX;
125
126 static int in_test;
127
128
129 /**
130  * Check whether peers successfully shut down.
131  */
132 static void
133 shutdown_callback (void *cls, const char *emsg)
134 {
135   if (emsg != NULL)
136   {
137     GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "test: Shutdown of peers failed: %s\n",
138                 emsg);
139     ok++;
140   }
141   else
142   {
143     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
144                 "test: All peers successfully shut down!\n");
145   }
146   GNUNET_CONFIGURATION_destroy (testing_cfg);
147 }
148
149
150 static void
151 shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
152 {
153   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Ending test.\n");
154   if (disconnect_task != GNUNET_SCHEDULER_NO_TASK)
155   {
156     GNUNET_SCHEDULER_cancel (disconnect_task);
157     disconnect_task = GNUNET_SCHEDULER_NO_TASK;
158   }
159   if (data_file != NULL)
160     GNUNET_DISK_file_close (data_file);
161   GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
162 }
163
164
165 static void
166 disconnect_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
167 {
168   unsigned int i;
169
170   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: disconnecting peers\n");
171   disconnect_task = GNUNET_SCHEDULER_NO_TASK;
172   GNUNET_SCHEDULER_cancel (put_task);
173   if (NULL != get_h_far)
174     GNUNET_DHT_get_stop (get_h_far);
175   for (i = 0; i < num_peers; i++)
176   {
177     GNUNET_DHT_monitor_stop(mhs[i]);
178     GNUNET_DHT_disconnect (hs[i]);
179   }
180   GNUNET_SCHEDULER_cancel (shutdown_handle);
181   shutdown_handle = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
182 }
183
184
185 static void
186 dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
187                     const struct GNUNET_HashCode * key,
188                     const struct GNUNET_PeerIdentity *get_path,
189                     unsigned int get_path_length,
190                     const struct GNUNET_PeerIdentity *put_path,
191                     unsigned int put_path_length, enum GNUNET_BLOCK_Type type,
192                     size_t size, const void *data)
193 {
194   int i;
195
196   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
197               "test: ************* FOUND!!! ***********\n");
198   if (sizeof (struct GNUNET_HashCode) == size)
199   {
200     const struct GNUNET_HashCode *h = data;
201
202     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test:   Contents: %s\n",
203                 GNUNET_h2s_full (h));
204
205   }
206   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: PATH: (get %u, put %u)\n",
207               get_path_length, put_path_length);
208   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test:   LOCAL\n");
209   for (i = get_path_length - 1; i >= 0; i--)
210   {
211     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test:   %s\n",
212                 GNUNET_i2s (&get_path[i]));
213   }
214   for (i = put_path_length - 1; i >= 0; i--)
215   {
216     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test:   %s\n",
217                 GNUNET_i2s (&put_path[i]));
218   }
219   monitor_expect = get_path_length + put_path_length;
220   if (monitor_counter >= monitor_expect)
221   {
222     ok = 0;
223     GNUNET_log (GNUNET_ERROR_TYPE_INFO, "expected at least %u hops, got %u\n",
224                 get_path_length + put_path_length, monitor_counter);
225     GNUNET_SCHEDULER_cancel (disconnect_task);
226     disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_peers, NULL);
227   }
228 }
229
230
231 /**
232  * Start test: start GET request from the first node in the line looking for
233  * the ID of the last node in the line.
234  * 
235  * @param cls Closure (not used).
236  * @param tc Task context.
237  */
238 static void
239 do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
240 {
241   if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
242   {
243     return;
244   }
245   
246   in_test = GNUNET_YES;
247   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: test_task\n");
248   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: looking for %s\n",
249               GNUNET_h2s_full (&d_far->id.hashPubKey));
250   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test:        from %s\n",
251               GNUNET_h2s_full (&o->id.hashPubKey));
252   get_h_far = GNUNET_DHT_get_start (hs[0], 
253                                     GNUNET_BLOCK_TYPE_TEST,     /* type */
254                                     &d_far->id.hashPubKey,      /*key to search */
255                                     4U, /* replication level */
256                                     GNUNET_DHT_RO_RECORD_ROUTE | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, NULL,    /* xquery */
257                                     0,  /* xquery bits */
258                                     &dht_get_id_handler, NULL);
259   GNUNET_SCHEDULER_cancel (disconnect_task);
260   disconnect_task =
261       GNUNET_SCHEDULER_add_delayed (GET_TIMEOUT, &disconnect_peers, NULL);
262 }
263
264
265 /**
266  * Periodic function used to put the ID of the far peer in the DHT.
267  * 
268  * @param cls Closure (not used).
269  * @param tc Task context.
270  */
271 static void
272 put_id (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
273 {
274   struct GNUNET_TESTING_Daemon *d;
275
276   if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
277   {
278     put_task = GNUNET_SCHEDULER_NO_TASK;
279     return;
280   }
281
282   d = GNUNET_TESTING_daemon_get (pg, 4);
283   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: putting into DHT: %s\n",
284               GNUNET_h2s_full (&d->id.hashPubKey));
285   GNUNET_DHT_put (hs[4], &d->id.hashPubKey, 10U,
286                   GNUNET_DHT_RO_RECORD_ROUTE |
287                   GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE,
288                   GNUNET_BLOCK_TYPE_TEST, sizeof (struct GNUNET_PeerIdentity),
289                   (const char *) &d->id, GNUNET_TIME_UNIT_FOREVER_ABS,
290                   GNUNET_TIME_UNIT_FOREVER_REL, NULL, NULL);
291
292   put_task = GNUNET_SCHEDULER_add_delayed (PUT_FREQUENCY, &put_id, NULL);
293 }
294
295
296 /**
297  * Callback called on each GET request going through the DHT.
298  * Prints the info about the intercepted packet and increments a counter.
299  *
300  * @param cls Closure.
301  * @param options Options, for instance RecordRoute, DemultiplexEverywhere.
302  * @param type The type of data in the request.
303  * @param hop_count Hop count so far.
304  * @param path_length number of entries in path (or 0 if not recorded).
305  * @param path peers on the GET path (or NULL if not recorded).
306  * @param desired_replication_level Desired replication level.
307  * @param key Key of the requested data.
308  */
309 static void
310 monitor_get_cb (void *cls,
311                 enum GNUNET_DHT_RouteOption options,
312                 enum GNUNET_BLOCK_Type type,
313                 uint32_t hop_count,
314                 uint32_t desired_replication_level,
315                 unsigned int path_length,
316                 const struct GNUNET_PeerIdentity *path,
317                 const struct GNUNET_HashCode * key)
318 {
319   const char *s_key;
320   unsigned int i;
321
322   i = (unsigned int) (long) cls;
323   s_key = GNUNET_h2s(key);
324   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
325               "%u got a GET message for key %s\n",
326               i, s_key);
327
328   if (strncmp (s_key, id_far, 4) == 0 && in_test == GNUNET_YES)
329   {
330     monitor_counter++;
331     if (monitor_counter >= monitor_expect)
332     {
333       ok = 0;
334       GNUNET_log (GNUNET_ERROR_TYPE_INFO, "expected at least %u hops, got %u\n",
335                   monitor_expect, monitor_counter);
336       GNUNET_SCHEDULER_cancel (disconnect_task);
337       disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_peers, NULL);
338     }
339   }
340 }
341
342
343 /**
344  * Callback called on each PUT request going through the DHT.
345  * Prints the info about the intercepted packet and increments a counter.
346  *
347  * @param cls Closure.
348  * @param options Options, for instance RecordRoute, DemultiplexEverywhere.
349  * @param type The type of data in the request.
350  * @param hop_count Hop count so far.
351  * @param path_length number of entries in path (or 0 if not recorded).
352  * @param path peers on the PUT path (or NULL if not recorded).
353  * @param desired_replication_level Desired replication level.
354  * @param exp Expiration time of the data.
355  * @param key Key under which data is to be stored.
356  * @param data Pointer to the data carried.
357  * @param size Number of bytes in data.
358  */
359 static void
360 monitor_put_cb (void *cls,
361                 enum GNUNET_DHT_RouteOption options,
362                 enum GNUNET_BLOCK_Type type,
363                 uint32_t hop_count,
364                 uint32_t desired_replication_level,
365                 unsigned int path_length,
366                 const struct GNUNET_PeerIdentity *path,
367                 struct GNUNET_TIME_Absolute exp,
368                 const struct GNUNET_HashCode * key,
369                 const void *data,
370                 size_t size)
371 {
372   const char *s_key;
373   unsigned int i;
374
375   i = (unsigned int) (long) cls;
376   s_key = GNUNET_h2s(key);
377
378   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
379               "%u got a PUT message for key %s with %u bytes\n",
380               i, s_key, size);
381
382   if (strncmp (s_key, id_far, 4) == 0 && in_test == GNUNET_YES)
383     monitor_counter++;
384 }
385
386
387 /**
388  * Callback called on each GET reply going through the DHT.
389  * Prints the info about the intercepted packet and increments a counter.
390  *
391  * @param cls Closure.
392  * @param type The type of data in the result.
393  * @param get_path Peers on GET path (or NULL if not recorded).
394  * @param get_path_length number of entries in get_path.
395  * @param put_path peers on the PUT path (or NULL if not recorded).
396  * @param put_path_length number of entries in get_path.
397  * @param exp Expiration time of the data.
398  * @param key Key of the data.
399  * @param data Pointer to the result data.
400  * @param size Number of bytes in data.
401  */
402 static void
403 monitor_res_cb (void *cls,
404                 enum GNUNET_BLOCK_Type type,
405                 const struct GNUNET_PeerIdentity *get_path,
406                 unsigned int get_path_length,
407                 const struct GNUNET_PeerIdentity *put_path,
408                 unsigned int put_path_length,
409                 struct GNUNET_TIME_Absolute exp,
410                 const struct GNUNET_HashCode * key,
411                 const void *data,
412                 size_t size)
413 {
414   const char *s_key;
415   unsigned int i;
416
417   i = (unsigned int) (long) cls;
418   s_key = GNUNET_h2s(key);
419   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
420               "%u got a REPLY message for key %s with %u bytes\n",
421               i, s_key, size);
422
423   if (strncmp (s_key, id_far, 4) == 0 && in_test == GNUNET_YES)
424     monitor_counter++;
425 }
426
427
428 /**
429  * peergroup_ready: start test when all peers are connected
430  *
431  * @param cls closure
432  * @param emsg error message
433  */
434 static void
435 peergroup_ready (void *cls, const char *emsg)
436 {
437   struct GNUNET_TESTING_Daemon *d;
438   char *buf;
439   int buf_len;
440   unsigned int i;
441
442   if (emsg != NULL)
443   {
444     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
445                 "test: Peergroup callback called with error, aborting test!\n");
446     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Error from testing: `%s'\n",
447                 emsg);
448     ok++;
449     GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
450     return;
451   }
452   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
453               "test: Peer Group started successfully with %u connections\n",
454               total_connections);
455   if (data_file != NULL)
456   {
457     buf = NULL;
458     buf_len = GNUNET_asprintf (&buf, "CONNECTIONS_0: %u\n", total_connections);
459     if (buf_len > 0)
460       GNUNET_DISK_file_write (data_file, buf, buf_len);
461     GNUNET_free (buf);
462   }
463   peers_running = GNUNET_TESTING_daemons_running (pg);
464
465   GNUNET_assert (peers_running == num_peers);
466   hs = GNUNET_malloc (num_peers * sizeof (struct GNUNET_DHT_Handle *));
467   mhs = GNUNET_malloc (num_peers * sizeof (struct GNUNET_DHT_MonitorHandle *));
468   d_far = o = NULL;
469   o = GNUNET_TESTING_daemon_get (pg, 0);
470   d_far = GNUNET_TESTING_daemon_get (pg, 4);
471
472   for (i = 0; i < num_peers; i++)
473   {
474     d = GNUNET_TESTING_daemon_get (pg, i);
475     hs[i] = GNUNET_DHT_connect (d->cfg, 32);
476     mhs[i] = GNUNET_DHT_monitor_start(hs[i],
477                                       GNUNET_BLOCK_TYPE_ANY,
478                                       NULL,
479                                       &monitor_get_cb,
480                                       &monitor_res_cb,
481                                       &monitor_put_cb,
482                                       (void *)(long)i);
483   }
484
485   if ((NULL == o) || (NULL == d_far))
486   {
487     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
488                 "test: Error getting daemons from pg\n");
489     GNUNET_SCHEDULER_cancel (disconnect_task);
490     disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_peers, NULL);
491     return;
492   }
493   monitor_counter = 0;
494   put_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
495                                            (GNUNET_TIME_UNIT_SECONDS, 3),
496                                            &put_id, NULL);
497   test_task =
498       GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
499                                     (GNUNET_TIME_UNIT_SECONDS, 6), &do_test,
500                                     NULL);
501   disconnect_task =
502       GNUNET_SCHEDULER_add_delayed (GET_TIMEOUT, &disconnect_peers, NULL);
503
504 }
505
506
507 /**
508  * Function that will be called whenever two daemons are connected by
509  * the testing library.
510  *
511  * @param cls closure
512  * @param first peer id for first daemon
513  * @param second peer id for the second daemon
514  * @param distance distance between the connected peers
515  * @param first_cfg config for the first daemon
516  * @param second_cfg config for the second daemon
517  * @param first_daemon handle for the first daemon
518  * @param second_daemon handle for the second daemon
519  * @param emsg error message (NULL on success)
520  */
521 static void
522 connect_cb (void *cls, const struct GNUNET_PeerIdentity *first,
523             const struct GNUNET_PeerIdentity *second, uint32_t distance,
524             const struct GNUNET_CONFIGURATION_Handle *first_cfg,
525             const struct GNUNET_CONFIGURATION_Handle *second_cfg,
526             struct GNUNET_TESTING_Daemon *first_daemon,
527             struct GNUNET_TESTING_Daemon *second_daemon, const char *emsg)
528 {
529
530   if (emsg == NULL)
531   {
532     total_connections++;
533     GNUNET_PEER_intern (first);
534     GNUNET_PEER_intern (second);
535   }
536   else
537   {
538     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
539                 "test: Problem with new connection (%s)\n", emsg);
540   }
541 }
542
543
544 /**
545  * run: load configuration options and schedule test to run (start peergroup)
546  * @param cls closure
547  * @param args argv
548  * @param cfgfile configuration file name (can be NULL)
549  * @param cfg configuration handle
550  */
551 static void
552 run (void *cls, char *const *args, const char *cfgfile,
553      const struct GNUNET_CONFIGURATION_Handle *cfg)
554 {
555   char *temp_str;
556   struct GNUNET_TESTING_Host *hosts;
557   char *data_filename;
558
559   ok = 1;
560   testing_cfg = GNUNET_CONFIGURATION_dup (cfg);
561
562   GNUNET_log_setup ("test_dht_monitor",
563                     "WARNING",
564                     NULL);
565
566   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Starting daemons.\n");
567   GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing_old",
568                                          "use_progressbars", "YES");
569   if (GNUNET_OK !=
570       GNUNET_CONFIGURATION_get_value_number (testing_cfg, "testing_old",
571                                              "num_peers", &num_peers))
572   {
573     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
574                 "Option TESTING:NUM_PEERS is required!\n");
575     return;
576   }
577
578   if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (testing_cfg, "testing_old",
579                                              "topology_output_file",
580                                              &topology_file))
581   {
582     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
583                 "Option test_dht_monitor:topology_output_file is required!\n");
584     return;
585   }
586
587   if (GNUNET_OK ==
588       GNUNET_CONFIGURATION_get_value_string (testing_cfg, "test_dht_topo",
589                                              "data_output_file",
590                                              &data_filename))
591   {
592     data_file =
593         GNUNET_DISK_file_open (data_filename,
594                                GNUNET_DISK_OPEN_READWRITE |
595                                GNUNET_DISK_OPEN_CREATE,
596                                GNUNET_DISK_PERM_USER_READ |
597                                GNUNET_DISK_PERM_USER_WRITE);
598     if (data_file == NULL)
599     {
600       GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to open %s for output!\n",
601                   data_filename);
602       GNUNET_free (data_filename);
603     }
604   }
605
606   if (GNUNET_YES ==
607       GNUNET_CONFIGURATION_get_value_string (cfg, "test_dht_topo",
608                                              "output_file", &temp_str))
609   {
610     output_file =
611         GNUNET_DISK_file_open (temp_str,
612                                GNUNET_DISK_OPEN_READWRITE |
613                                GNUNET_DISK_OPEN_CREATE,
614                                GNUNET_DISK_PERM_USER_READ |
615                                GNUNET_DISK_PERM_USER_WRITE);
616     if (output_file == NULL)
617       GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to open %s for output!\n",
618                   temp_str);
619   }
620   GNUNET_free_non_null (temp_str);
621
622   hosts = GNUNET_TESTING_hosts_load (testing_cfg);
623
624   pg = GNUNET_TESTING_peergroup_start (testing_cfg, num_peers, TIMEOUT,
625                                        &connect_cb, &peergroup_ready, NULL,
626                                        hosts);
627   GNUNET_assert (pg != NULL);
628   shutdown_handle =
629       GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
630                                     &shutdown_task, NULL);
631 }
632
633
634 /**
635  * test_dht_monitor command line options
636  */
637 static struct GNUNET_GETOPT_CommandLineOption options[] = {
638   {'V', "verbose", NULL,
639    gettext_noop ("be verbose (print progress information)"),
640    0, &GNUNET_GETOPT_set_one, &verbose},
641   GNUNET_GETOPT_OPTION_END
642 };
643
644
645 /**
646  * Main: start test
647  */
648 int
649 main (int xargc, char *xargv[])
650 {
651   char *const argv[] = { "test-dht-monitor",
652     "-c",
653     "test_dht_line.conf",
654     NULL
655   };
656
657   in_test = GNUNET_NO;
658   GNUNET_PROGRAM_run (sizeof (argv) / sizeof (char *) - 1, argv,
659                       "test_dht_monitor",
660                       gettext_noop ("Test dht monitoring in a line."),
661                       options, &run, NULL);
662 #if REMOVE_DIR
663   GNUNET_DISK_directory_remove ("/tmp/test_dht_monitor");
664 #endif
665   if (0 != ok)
666   {
667     GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: FAILED!\n");
668   }
669   return ok;
670 }
671
672 /* end of test_dht_monitor.c */