gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r24676 - gnunet/src/dht


From: gnunet
Subject: [GNUnet-SVN] r24676 - gnunet/src/dht
Date: Fri, 2 Nov 2012 11:19:00 +0100

Author: grothoff
Date: 2012-11-02 11:19:00 +0100 (Fri, 02 Nov 2012)
New Revision: 24676

Added:
   gnunet/src/dht/test_dht_multipeer.conf
   gnunet/src/dht/test_dht_multipeer_topology.dat
Removed:
   gnunet/src/dht/multipeer_topo.dat
   gnunet/src/dht/test_dht_multipeer.c
   gnunet/src/dht/test_dht_multipeer_data.conf
   gnunet/src/dht/test_dht_twopeer.c
   gnunet/src/dht/test_dht_twopeer_data.conf
   gnunet/src/dht/test_dht_twopeer_get_put.c
   gnunet/src/dht/test_dht_twopeer_path_tracking.c
   gnunet/src/dht/test_dht_twopeer_put_get.c
Modified:
   gnunet/src/dht/Makefile.am
   gnunet/src/dht/dht.conf.in
   gnunet/src/dht/test_dht_2dtorus.conf
   gnunet/src/dht/test_dht_line.conf
   gnunet/src/dht/test_dht_monitor.c
   gnunet/src/dht/test_dht_topo.c
Log:
-major DHT test cleanup


Modified: gnunet/src/dht/Makefile.am
===================================================================
--- gnunet/src/dht/Makefile.am  2012-11-02 10:18:43 UTC (rev 24675)
+++ gnunet/src/dht/Makefile.am  2012-11-02 10:19:00 UTC (rev 24676)
@@ -123,27 +123,23 @@
 check_PROGRAMS = \
  test_dht_api \
  test_dht_twopeer \
- test_dht_twopeer_put_get \
- test_dht_twopeer_get_put \
- test_dht_twopeer_path_tracking \
  test_dht_multipeer \
  test_dht_line \
- test_dht_2dtorus \
- test_dht_monitor
+ test_dht_2dtorus 
+# test_dht_monitor
 
 if HAVE_EXPERIMENTAL
- NEW_TESTS = test_dht_line test_dht_2dtorus
+# These tests still do not work as testbed does
+# not support the respective topology op
+ NEW_TESTS = test_dht_2dtorus test_dht_multipeer
 endif
 
 if ENABLE_TEST_RUN
 TESTS = test_dht_api $(check_SCRIPTS) \
  test_dht_twopeer \
- test_dht_twopeer_put_get \
- test_dht_twopeer_get_put \
- test_dht_twopeer_path_tracking \
- test_dht_multipeer \
- $(NEW_TESTS) \
- test_dht_monitor
+ test_dht_line \
+ $(NEW_TESTS) 
+# test_dht_monitor
 endif
 
 test_dht_api_SOURCES = \
@@ -156,9 +152,8 @@
 test_dht_api_DEPENDENCIES = \
   libgnunetdht.la                          
 
-# twopeer is obsolete once new test_dht_topo works...
 test_dht_twopeer_SOURCES = \
- test_dht_twopeer.c
+ test_dht_topo.c
 test_dht_twopeer_LDADD = \
  $(top_builddir)/src/util/libgnunetutil.la \
  $(top_builddir)/src/testing_old/libgnunettesting_old.la \
@@ -166,42 +161,6 @@
 test_dht_twopeer_DEPENDENCIES = \
   libgnunetdht.la                          
 
-# twopeer_put_get is obsolete once new test_dht_topo works...
-test_dht_twopeer_put_get_SOURCES = \
- test_dht_twopeer_put_get.c
-test_dht_twopeer_put_get_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/testing_old/libgnunettesting_old.la \
- $(top_builddir)/src/dht/libgnunetdht.la   
-
-# twopeer_get_put is obsolete once new test_dht_topo works...
-test_dht_twopeer_get_put_SOURCES = \
- test_dht_twopeer_get_put.c
-test_dht_twopeer_get_put_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/testing_old/libgnunettesting_old.la \
- $(top_builddir)/src/dht/libgnunetdht.la   
-
-# twopeer_path_tracking is obsolete once new test_dht_topo works...
-test_dht_twopeer_path_tracking_SOURCES = \
- test_dht_twopeer_path_tracking.c
-test_dht_twopeer_path_tracking_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/testing_old/libgnunettesting_old.la \
- $(top_builddir)/src/dht/libgnunetdht.la   
-
-# statistics functions should be integrated with test_dht_topo,
-# then this one also becomes obsolete...
-test_dht_multipeer_SOURCES = \
- test_dht_multipeer.c
-test_dht_multipeer_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/testing_old/libgnunettesting_old.la \
- $(top_builddir)/src/dht/libgnunetdht.la  
-test_dht_multipeer_DEPENDENCIES = \
-  libgnunetdht.la                          
-
 test_dht_2dtorus_SOURCES = \
  test_dht_topo.c
 test_dht_2dtorus_LDADD = \
@@ -222,6 +181,16 @@
 test_dht_line_DEPENDENCIES = \
   libgnunetdht.la
 
+test_dht_multipeer_SOURCES = \
+ test_dht_topo.c
+test_dht_multipeer_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/statistics/libgnunetstatistics.la \
+ $(top_builddir)/src/testing_old/libgnunettesting_old.la \
+ $(top_builddir)/src/dht/libgnunetdht.la  
+test_dht_multipeer_DEPENDENCIES = \
+  libgnunetdht.la                          
+
 # fixme, rewrite based on test_dht_topo.c!
 test_dht_monitor_SOURCES = test_dht_monitor.c
 test_dht_monitor_LDADD = \
@@ -236,11 +205,11 @@
   test_dht_api_data.conf \
   test_dht_api_peer1.conf \
   test_dht_twopeer_data.conf \
-  test_dht_multipeer_data.conf \
+  test_dht_multipeer.conf \
   test_dht_2dtorus.conf \
   test_dht_line.conf \
   test_dht_tools.py.in \
-  multipeer_topo.dat
+  test_dht_multipeer_topology.dat
 
 check_SCRIPTS = \
   test_dht_tools.py

Modified: gnunet/src/dht/dht.conf.in
===================================================================
--- gnunet/src/dht/dht.conf.in  2012-11-02 10:18:43 UTC (rev 24675)
+++ gnunet/src/dht/dht.conf.in  2012-11-02 10:19:00 UTC (rev 24676)
@@ -21,16 +21,8 @@
 # REJECT_FROM =
 # REJECT_FROM6 =
 # PREFIX =
-# DO_FIND_PEER =
-# STRICT_KADEMLIA =
-# USE_MAX_HOPS =
-# MAX_HOPS =
-# REPUBLISH = YES
-# REPLICATION_FREQUENCY = 60 
-# STOP_ON_CLOSEST =
-# STOP_FOUND =
-# CONVERGE_MODIFIER =
 
+
 # Special option to disable DHT calling 'try_connect' (for testing)
 DISABLE_TRY_CONNECT = NO
 

Deleted: gnunet/src/dht/multipeer_topo.dat
===================================================================
--- gnunet/src/dht/multipeer_topo.dat   2012-11-02 10:18:43 UTC (rev 24675)
+++ gnunet/src/dht/multipeer_topo.dat   2012-11-02 10:19:00 UTC (rev 24676)
@@ -1,31 +0,0 @@
-10
-1:2
-2:3
-3:4
-4:5
-5:6
-6:7
-7:8
-8:9
-9:10
-10:1
-4:2
-5:3
-6:4
-7:5
-8:6
-9:7
-10:8
-1:9
-2:10
-3:1
-6:2
-7:3
-8:4
-9:5
-10:6
-1:7
-2:8
-3:9
-4:10
-5:1

Modified: gnunet/src/dht/test_dht_2dtorus.conf
===================================================================
--- gnunet/src/dht/test_dht_2dtorus.conf        2012-11-02 10:18:43 UTC (rev 
24675)
+++ gnunet/src/dht/test_dht_2dtorus.conf        2012-11-02 10:19:00 UTC (rev 
24676)
@@ -1,34 +1,15 @@
 [PATHS]
-SERVICEHOME = /tmp/test_dht_topo/
+SERVICEHOME = /tmp/test_dht_2dtorus/
 
 [arm]
-PORT = 10010
 DEFAULTSERVICES = core dht
-#DEBUG = YES
 
-[statistics]
-AUTOSTART = YES
-PORT = 10000
-
-[dht]
-DEBUG = NO
-AUTOSTART = YES
-ACCEPT_FROM6 = ::1;
-ACCEPT_FROM = 127.0.0.1;
-HOSTNAME = localhost
-PORT = 10001
-
 [dns]
 AUTOSTART = NO
-PORT = 10011
 
-[transport]
-PORT = 10002
-AUTOSTART = YES
-
 [nat]
 DISABLEV6 = YES 
-BINDTO = 127.0.0.1
+RETURN_LOCAL_ADDRESSES = YES
 ENABLE_UPNP = NO
 BEHIND_NAT = NO
 ALLOW_NAT = NO
@@ -39,54 +20,18 @@
 WAN_QUOTA_IN = 1 GB
 WAN_QUOTA_OUT = 1 GB
 
-[core]
-AUTOSTART = YES
-PORT = 10003
-
-[peerinfo]
-AUTOSTART = YES
-PORT = 10004
-
 [testing]
 WEAKRANDOM = YES
 
-[testing_old]
-NUM_PEERS = 16 
-TOPOLOGY = NONE
-CONNECT_TOPOLOGY = 2D_TORUS
-BLACKLIST_TOPOLOGY = 2D_TORUS
-#TOPOLOGY_FILE = small.dat
-#CONNECT_TOPOLOGY = ERDOS_RENYI
-#CONNECT_TOPOLOGY_OPTION = CONNECT_MINIMUM
-#CONNECT_TOPOLOGY_OPTION_MODIFIER = 25
-#PERCENTAGE = 3
-#PROBABILITY = .1
-F2F = NO
-CONNECT_TIMEOUT = 60 s
-CONNECT_ATTEMPTS = 3
-DEBUG = YES
-HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat
-MAX_CONCURRENT_SSH = 20
-USE_PROGRESSBARS = YES
-PEERGROUP_TIMEOUT = 2400 s
-TOPOLOGY_OUTPUT_FILE = 2dtorus_topo_initial
-MAX_OUTSTANDING_CONNECTIONS = 75
-#SINGLE_PEERINFO_PER_HOST = YES
-#NUM_PEERINFO_PER_HOST = 10
-#SINGLE_STATISTICS_PER_HOST = YES
-#NUM_STATISTICS_PER_HOST = 10
-DELETE_FILES = YES
+[testbed]
+OVERLAY_TOPOLOGY = 2D_TORUS
 
-[test_dht_topo]
-CONNECTION_LIMIT = 20
-#DATA_OUTPUT_FILE=data_output
-
-
 [nse]
 WORKDELAY = 500 ms
 INTERVAL = 60 s
 WORKBITS = 0
+
 [vpn]
-AUTOSTART=NO
+AUTOSTART = NO
 
 

Modified: gnunet/src/dht/test_dht_line.conf
===================================================================
--- gnunet/src/dht/test_dht_line.conf   2012-11-02 10:18:43 UTC (rev 24675)
+++ gnunet/src/dht/test_dht_line.conf   2012-11-02 10:19:00 UTC (rev 24676)
@@ -1,34 +1,15 @@
 [PATHS]
-SERVICEHOME = /tmp/test_dht_topo/
+SERVICEHOME = /tmp/test_dht_line/
 
 [arm]
-PORT = 10010
 DEFAULTSERVICES = core dht
-#DEBUG = YES
 
-[statistics]
-AUTOSTART = YES
-PORT = 10000
-
-[dht]
-DEBUG = NO
-AUTOSTART = YES
-ACCEPT_FROM6 = ::1;
-ACCEPT_FROM = 127.0.0.1;
-HOSTNAME = localhost
-PORT = 10001
-
 [dns]
 AUTOSTART = NO
-PORT = 10011
 
-[transport]
-PORT = 10002
-AUTOSTART = YES
-
 [nat]
 DISABLEV6 = YES 
-BINDTO = 127.0.0.1
+RETURN_LOCAL_ADDRESSES = YES
 ENABLE_UPNP = NO
 BEHIND_NAT = NO
 ALLOW_NAT = NO
@@ -39,49 +20,12 @@
 WAN_QUOTA_IN = 1 GB
 WAN_QUOTA_OUT = 1 GB
 
-[core]
-AUTOSTART = YES
-PORT = 10003
-
-[peerinfo]
-AUTOSTART = YES
-PORT = 10004
-
 [testing]
 WEAKRANDOM = YES
 
-[testing_old]
-NUM_PEERS = 5
-TOPOLOGY = NONE
-CONNECT_TOPOLOGY = LINE
-BLACKLIST_TOPOLOGY = LINE
-BLACKLIST_TRANSPORTS = tcp udp http unix
-#TOPOLOGY_FILE = small.dat
-#CONNECT_TOPOLOGY = ERDOS_RENYI
-#CONNECT_TOPOLOGY_OPTION = CONNECT_MINIMUM
-#CONNECT_TOPOLOGY_OPTION_MODIFIER = 25
-#PERCENTAGE = 3
-#PROBABILITY = .1
-F2F = NO
-CONNECT_TIMEOUT = 60 s
-CONNECT_ATTEMPTS = 3
-DEBUG = YES
-HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat
-MAX_CONCURRENT_SSH = 10
-USE_PROGRESSBARS = YES
-PEERGROUP_TIMEOUT = 2400 s
-TOPOLOGY_OUTPUT_FILE = line_topo_initial
-MAX_OUTSTANDING_CONNECTIONS = 75
-#SINGLE_PEERINFO_PER_HOST = YES
-#NUM_PEERINFO_PER_HOST = 10
-#SINGLE_STATISTICS_PER_HOST = YES
-#NUM_STATISTICS_PER_HOST = 10
-DELETE_FILES = YES
+[testbed]
+OVERLAY_TOPOLOGY = LINE
 
-[test_dht_topo]
-CONNECTION_LIMIT = 5
-#DATA_OUTPUT_FILE=data_output
-
 [namestore]
 AUTOSTART = NO
 
@@ -89,7 +33,8 @@
 WORKDELAY = 500 ms
 INTERVAL = 60 s
 WORKBITS = 0
+
 [vpn]
-AUTOSTART=NO
+AUTOSTART = NO
 
 

Modified: gnunet/src/dht/test_dht_monitor.c
===================================================================
--- gnunet/src/dht/test_dht_monitor.c   2012-11-02 10:18:43 UTC (rev 24675)
+++ gnunet/src/dht/test_dht_monitor.c   2012-11-02 10:19:00 UTC (rev 24676)
@@ -426,71 +426,38 @@
 
 
 /**
- * peergroup_ready: start test when all peers are connected
+ * Main function of the test.
  *
- * @param cls closure
- * @param emsg error message
+ * @param cls closure (NULL)
+ * @param ctx argument to give to GNUNET_DHT_TEST_cleanup on test end
+ * @param num_peers number of peers that are running
+ * @param peers array of peers
+ * @param dhts handle to each of the DHTs of the peers
  */
 static void
-peergroup_ready (void *cls, const char *emsg)
+run (void *cls,
+     struct GNUNET_DHT_TEST_Context *ctx,
+     unsigned int num_peers,
+     struct GNUNET_TESTBED_Peer **peers,
+     struct GNUNET_DHT_Handle **dhts)
 {
-  struct GNUNET_TESTING_Daemon *d;
-  char *buf;
-  int buf_len;
   unsigned int i;
 
-  if (emsg != NULL)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "test: Peergroup callback called with error, aborting 
test!\n");
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Error from testing: `%s'\n",
-                emsg);
-    ok++;
-    GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
-    return;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "test: Peer Group started successfully with %u connections\n",
-              total_connections);
-  if (data_file != NULL)
-  {
-    buf = NULL;
-    buf_len = GNUNET_asprintf (&buf, "CONNECTIONS_0: %u\n", total_connections);
-    if (buf_len > 0)
-      GNUNET_DISK_file_write (data_file, buf, buf_len);
-    GNUNET_free (buf);
-  }
-  peers_running = GNUNET_TESTING_daemons_running (pg);
-
-  GNUNET_assert (peers_running == num_peers);
-  hs = GNUNET_malloc (num_peers * sizeof (struct GNUNET_DHT_Handle *));
+  GNUNET_assert (NUM_PEERS == num_peers);
+  my_peers = peers;
   mhs = GNUNET_malloc (num_peers * sizeof (struct GNUNET_DHT_MonitorHandle *));
-  d_far = o = NULL;
-  o = GNUNET_TESTING_daemon_get (pg, 0);
-  d_far = GNUNET_TESTING_daemon_get (pg, 4);
-
   for (i = 0; i < num_peers; i++)
   {
     d = GNUNET_TESTING_daemon_get (pg, i);
     hs[i] = GNUNET_DHT_connect (d->cfg, 32);
-    mhs[i] = GNUNET_DHT_monitor_start(hs[i],
-                                      GNUNET_BLOCK_TYPE_ANY,
-                                      NULL,
-                                      &monitor_get_cb,
-                                      &monitor_res_cb,
-                                      &monitor_put_cb,
-                                      (void *)(long)i);
+    mhs[i] = GNUNET_DHT_monitor_start (hs[i],
+                                      GNUNET_BLOCK_TYPE_ANY,
+                                      NULL,
+                                      &monitor_get_cb,
+                                      &monitor_res_cb,
+                                      &monitor_put_cb,
+                                      (void *)(long)i);
   }
-
-  if ((NULL == o) || (NULL == d_far))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "test: Error getting daemons from pg\n");
-    GNUNET_SCHEDULER_cancel (disconnect_task);
-    disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_peers, NULL);
-    return;
-  }
-  monitor_counter = 0;
   put_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
                                           (GNUNET_TIME_UNIT_SECONDS, 3),
                                           &put_id, NULL);
@@ -500,173 +467,21 @@
                                     NULL);
   disconnect_task =
       GNUNET_SCHEDULER_add_delayed (GET_TIMEOUT, &disconnect_peers, NULL);
-
 }
 
 
 /**
- * Function that will be called whenever two daemons are connected by
- * the testing library.
- *
- * @param cls closure
- * @param first peer id for first daemon
- * @param second peer id for the second daemon
- * @param distance distance between the connected peers
- * @param first_cfg config for the first daemon
- * @param second_cfg config for the second daemon
- * @param first_daemon handle for the first daemon
- * @param second_daemon handle for the second daemon
- * @param emsg error message (NULL on success)
- */
-static void
-connect_cb (void *cls, const struct GNUNET_PeerIdentity *first,
-            const struct GNUNET_PeerIdentity *second, uint32_t distance,
-            const struct GNUNET_CONFIGURATION_Handle *first_cfg,
-            const struct GNUNET_CONFIGURATION_Handle *second_cfg,
-            struct GNUNET_TESTING_Daemon *first_daemon,
-            struct GNUNET_TESTING_Daemon *second_daemon, const char *emsg)
-{
-
-  if (emsg == NULL)
-  {
-    total_connections++;
-    GNUNET_PEER_intern (first);
-    GNUNET_PEER_intern (second);
-  }
-  else
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "test: Problem with new connection (%s)\n", emsg);
-  }
-}
-
-
-/**
- * run: load configuration options and schedule test to run (start peergroup)
- * @param cls closure
- * @param args argv
- * @param cfgfile configuration file name (can be NULL)
- * @param cfg configuration handle
- */
-static void
-run (void *cls, char *const *args, const char *cfgfile,
-     const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  char *temp_str;
-  struct GNUNET_TESTING_Host *hosts;
-  char *data_filename;
-
-  ok = 1;
-  testing_cfg = GNUNET_CONFIGURATION_dup (cfg);
-
-  GNUNET_log_setup ("test_dht_monitor",
-                    "WARNING",
-                    NULL);
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Starting daemons.\n");
-  GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing_old",
-                                         "use_progressbars", "YES");
-  if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_number (testing_cfg, "testing_old",
-                                             "num_peers", &num_peers))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Option TESTING:NUM_PEERS is required!\n");
-    return;
-  }
-
-  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (testing_cfg, 
"testing_old",
-                                             "topology_output_file",
-                                             &topology_file))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Option test_dht_monitor:topology_output_file is required!\n");
-    return;
-  }
-
-  if (GNUNET_OK ==
-      GNUNET_CONFIGURATION_get_value_string (testing_cfg, "test_dht_topo",
-                                             "data_output_file",
-                                             &data_filename))
-  {
-    data_file =
-        GNUNET_DISK_file_open (data_filename,
-                               GNUNET_DISK_OPEN_READWRITE |
-                               GNUNET_DISK_OPEN_CREATE,
-                               GNUNET_DISK_PERM_USER_READ |
-                               GNUNET_DISK_PERM_USER_WRITE);
-    if (data_file == NULL)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to open %s for output!\n",
-                  data_filename);
-      GNUNET_free (data_filename);
-    }
-  }
-
-  if (GNUNET_YES ==
-      GNUNET_CONFIGURATION_get_value_string (cfg, "test_dht_topo",
-                                             "output_file", &temp_str))
-  {
-    output_file =
-        GNUNET_DISK_file_open (temp_str,
-                               GNUNET_DISK_OPEN_READWRITE |
-                               GNUNET_DISK_OPEN_CREATE,
-                               GNUNET_DISK_PERM_USER_READ |
-                               GNUNET_DISK_PERM_USER_WRITE);
-    if (output_file == NULL)
-      GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to open %s for output!\n",
-                  temp_str);
-  }
-  GNUNET_free_non_null (temp_str);
-
-  hosts = GNUNET_TESTING_hosts_load (testing_cfg);
-
-  pg = GNUNET_TESTING_peergroup_start (testing_cfg, num_peers, TIMEOUT,
-                                       &connect_cb, &peergroup_ready, NULL,
-                                       hosts);
-  GNUNET_assert (pg != NULL);
-  shutdown_handle =
-      GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
-                                    &shutdown_task, NULL);
-}
-
-
-/**
- * test_dht_monitor command line options
- */
-static struct GNUNET_GETOPT_CommandLineOption options[] = {
-  {'V', "verbose", NULL,
-   gettext_noop ("be verbose (print progress information)"),
-   0, &GNUNET_GETOPT_set_one, &verbose},
-  GNUNET_GETOPT_OPTION_END
-};
-
-
-/**
  * Main: start test
  */
 int
 main (int xargc, char *xargv[])
 {
-  char *const argv[] = { "test-dht-monitor",
-    "-c",
-    "test_dht_line.conf",
-    NULL
-  };
-
-  in_test = GNUNET_NO;
-  GNUNET_PROGRAM_run (sizeof (argv) / sizeof (char *) - 1, argv,
-                      "test_dht_monitor",
-                      gettext_noop ("Test dht monitoring in a line."),
-                      options, &run, NULL);
-#if REMOVE_DIR
-  GNUNET_DISK_directory_remove ("/tmp/test_dht_monitor");
-#endif
-  if (0 != ok)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: FAILED!\n");
-  }
+  GNUNET_DHT_TEST_run ("test-dht-monitor",
+                      "test_dht_monitor.conf",
+                      NUM_PEERS,
+                      &run, NULL);
   return ok;
 }
 
+
 /* end of test_dht_monitor.c */

Deleted: gnunet/src/dht/test_dht_multipeer.c
===================================================================
--- gnunet/src/dht/test_dht_multipeer.c 2012-11-02 10:18:43 UTC (rev 24675)
+++ gnunet/src/dht/test_dht_multipeer.c 2012-11-02 10:19:00 UTC (rev 24676)
@@ -1,859 +0,0 @@
-/*
-     This file is part of GNUnet.
-     (C) 2009 Christian Grothoff (and other contributing authors)
-
-     GNUnet is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 3, or (at your
-     option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
-
-     You should have received a copy of the GNU General Public License
-     along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
-*/
-/**
- * @file dht/test_dht_multipeer.c
- * @brief testcase for testing DHT service with
- *        multiple peers.
- */
-#include "platform.h"
-#include "gnunet_testing_lib.h"
-#include "gnunet_core_service.h"
-#include "gnunet_dht_service.h"
-
-/* Timeout for entire testcase */
-#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 30)
-
-/* Timeout for waiting for replies to get requests */
-#define GET_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 
300)
-
-/* */
-#define START_DELAY GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30)
-
-/* Timeout for waiting for gets to complete */
-#define GET_DELAY GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 
50)
-
-/* Timeout for waiting for puts to complete */
-#define PUT_DELAY GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 
50)
-
-/* If number of peers not in config file, use this number */
-#define DEFAULT_NUM_PEERS 10
-
-#define TEST_DATA_SIZE 8
-
-#define MAX_OUTSTANDING_PUTS 100
-
-#define MAX_OUTSTANDING_GETS 100
-
-#define PATH_TRACKING GNUNET_NO
-
-
-
-struct TestPutContext
-{
-  /**
-   * This is a linked list
-   */
-  struct TestPutContext *next;
-
-  /**
-   * This is a linked list
-   */
-  struct TestPutContext *prev;
-
-  /**
-   * Handle to the first peers DHT service (via the API)
-   */
-  struct GNUNET_DHT_Handle *dht_handle;
-
-  /**
-   *  Handle to the PUT peer daemon
-   */
-  struct GNUNET_TESTING_Daemon *daemon;
-
-  /**
-   *  Identifier for this PUT
-   */
-  uint32_t uid;
-
-  /**
-   * Task handle for processing of the put.
-   */
-  GNUNET_SCHEDULER_TaskIdentifier task;
-};
-
-
-struct TestGetContext
-{
-  /**
-   * This is a linked list
-   */
-  struct TestGetContext *next;
-
-  /**
-   * This is a linked list
-   */
-  struct TestGetContext *prev;
-
-  /**
-   * Handle to the first peers DHT service (via the API)
-   */
-  struct GNUNET_DHT_Handle *dht_handle;
-
-  /**
-   * Handle for the DHT get request
-   */
-  struct GNUNET_DHT_GetHandle *get_handle;
-
-  /**
-   *  Handle to the GET peer daemon
-   */
-  struct GNUNET_TESTING_Daemon *daemon;
-
-  /**
-   *  Identifier for this GET
-   */
-  uint32_t uid;
-
-  /**
-   * Task for disconnecting DHT handles (and stopping GET)
-   */
-  GNUNET_SCHEDULER_TaskIdentifier task;
-
-  /**
-   * Whether or not this request has been fulfilled already.
-   */
-  int succeeded;
-};
-
-
-/**
- * List of GETS to perform
- */
-static struct TestGetContext *all_gets_head;
-
-/**
- * List of GETS to perform
- */
-static struct TestGetContext *all_gets_tail;
-
-/**
- * List of PUTS to perform
- */
-static struct TestPutContext *all_puts_head;
-
-/**
- * List of PUTS to perform
- */
-static struct TestPutContext *all_puts_tail;
-
-/**
- * Handle to the set of all peers run for this test.
- */
-static struct GNUNET_TESTING_PeerGroup *pg;
-
-/**
- * Total number of peers to run, set based on config file.
- */
-static unsigned long long num_peers;
-
-/**
- * How many puts do we currently have in flight?
- */
-static unsigned long long outstanding_puts;
-
-/**
- * How many puts are done?
- */
-static unsigned long long puts_completed;
-
-/**
- * How many puts do we currently have in flight?
- */
-static unsigned long long outstanding_gets;
-
-/**
- * How many gets are done?
- */
-static unsigned long long gets_completed;
-
-/**
- * How many gets failed?
- */
-static unsigned long long gets_failed;
-
-/**
- * Directory to remove on shutdown.
- */
-static char *test_directory;
-
-/**
- * Option to use when routing.
- */
-static enum GNUNET_DHT_RouteOption route_option;
-
-/**
- * Task handle to use to schedule test failure / success.
- */
-static GNUNET_SCHEDULER_TaskIdentifier die_task;
-
-/**
- * Task handle to use to schedule test shutdown
- */
-GNUNET_SCHEDULER_TaskIdentifier shutdown_task;
-
-/**
- * Global return value (0 for success, anything else for failure)
- */
-static int ok;
-
-
-/**
- * Check whether peers successfully shut down.
- */
-static void
-shutdown_callback (void *cls, const char *emsg)
-{
-  if (emsg != NULL)
-  {
-    FPRINTF (stderr, "Failed to shutdown testing topology: %s\n", emsg);
-    if (ok == 0)
-      ok = 2;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown callback completed.\n");
-}
-
-static void
-do_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) == 0)
-  {
-    if (GNUNET_SCHEDULER_NO_TASK != shutdown_task)
-    {
-      GNUNET_SCHEDULER_cancel(shutdown_task);
-      shutdown_task = GNUNET_SCHEDULER_NO_TASK;
-    }
-  }
-  else
-  {
-    shutdown_task = GNUNET_SCHEDULER_NO_TASK ;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown requested.\n");
-  if (NULL != pg)
-    GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
-  pg = NULL;
-}
-
-
-/**
- * Master context for 'stat_run'.
- */
-struct StatMaster
-{
-  struct GNUNET_STATISTICS_Handle *stat;
-  unsigned int daemon;
-  unsigned int value;
-};
-
-struct StatValues
-{
-  const char *subsystem;
-  const char *name;
-  unsigned long long total;
-};
-
-/**
- * Statistics we print out.
- */
-static struct StatValues stats[] = {
-  {"core", "# bytes decrypted", 0},
-  {"core", "# bytes encrypted", 0},
-  {"core", "# type maps received", 0},
-  {"core", "# session keys confirmed via PONG", 0},
-  {"core", "# peers connected", 0},
-  {"core", "# key exchanges initiated", 0},
-  {"core", "# send requests dropped (disconnected)", 0},
-  {"core", "# transmissions delayed due to corking", 0},
-  {"core", "# messages discarded (expired prior to transmission)", 0},
-  {"core", "# messages discarded (disconnected)", 0},
-  {"core", "# discarded CORE_SEND requests", 0},
-  {"core", "# discarded lower priority CORE_SEND requests", 0},
-  {"transport", "# bytes received via TCP", 0},
-  {"transport", "# bytes transmitted via TCP", 0},
-  {"dht", "# PUT messages queued for transmission", 0},
-  {"dht", "# P2P PUT requests received", 0},
-  {"dht", "# GET messages queued for transmission", 0},
-  {"dht", "# P2P GET requests received", 0},
-  {"dht", "# RESULT messages queued for transmission", 0},
-  {"dht", "# P2P RESULTS received", 0},
-  {"dht", "# Queued messages discarded (peer disconnected)", 0},
-  {"dht", "# Peers excluded from routing due to Bloomfilter", 0},
-  {"dht", "# Peer selection failed", 0},
-  {"dht", "# FIND PEER requests ignored due to Bloomfilter", 0},
-  {"dht", "# FIND PEER requests ignored due to lack of HELLO", 0},
-  {"dht", "# P2P FIND PEER requests processed", 0},
-  {"dht", "# P2P GET requests ONLY routed", 0},
-  {"dht", "# Preference updates given to core", 0},
-  {"dht", "# REPLIES ignored for CLIENTS (no match)", 0},
-  {"dht", "# GET requests from clients injected", 0},
-  {"dht", "# GET requests received from clients", 0},
-  {"dht", "# GET STOP requests received from clients", 0},
-  {"dht", "# ITEMS stored in datacache", 0},
-  {"dht", "# Good RESULTS found in datacache", 0},
-  {"dht", "# GET requests given to datacache", 0},
-  {NULL, NULL, 0}
-};
-
-
-/**
- * Callback function to process statistic values.
- *
- * @param cls closure
- * @param subsystem name of subsystem that created the statistic
- * @param name the name of the datum
- * @param value the current value
- * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not
- * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
- */
-static int
-print_stat (void *cls, const char *subsystem, const char *name, uint64_t value,
-            int is_persistent)
-{
-  struct StatMaster *sm = cls;
-
-  stats[sm->value].total += value;
-  FPRINTF (stderr, "Peer %2u: %12s/%50s = %12llu\n", sm->daemon, subsystem,
-           name, (unsigned long long) value);
-  return GNUNET_OK;
-}
-
-
-/**
- * Function that gathers stats from all daemons.
- */
-static void
-stat_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
-
-
-/**
- * Function called when GET operation on stats is done.
- */
-static void
-get_done (void *cls, int success)
-{
-  struct StatMaster *sm = cls;
-
-  GNUNET_break (GNUNET_OK == success);
-  sm->value++;
-  GNUNET_SCHEDULER_add_now (&stat_run, sm);
-}
-
-
-/**
- * Function that gathers stats from all daemons.
- */
-static void
-stat_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  struct StatMaster *sm = cls;
-  unsigned int i;
-
-  die_task = GNUNET_SCHEDULER_NO_TASK;
-  if (stats[sm->value].name != NULL)
-  {
-    GNUNET_STATISTICS_get (sm->stat,
-#if 0
-                           NULL, NULL,
-#else
-                           stats[sm->value].subsystem, stats[sm->value].name,
-#endif
-                           GNUNET_TIME_UNIT_FOREVER_REL, &get_done, 
&print_stat,
-                           sm);
-    return;
-  }
-  GNUNET_STATISTICS_destroy (sm->stat, GNUNET_NO);
-  sm->value = 0;
-  sm->daemon++;
-  if (sm->daemon == num_peers)
-  {
-    GNUNET_free (sm);
-    i = 0;
-    while (stats[i].name != NULL)
-    {
-      FPRINTF (stderr, "Total  : %12s/%50s = %12llu\n", stats[i].subsystem,
-               stats[i].name, (unsigned long long) stats[i].total);
-      i++;
-    }
-    die_task = GNUNET_SCHEDULER_add_now (&do_stop, NULL);
-    return;
-  }
-  sm->stat =
-      GNUNET_STATISTICS_create ("<driver>",
-                                GNUNET_TESTING_daemon_get (pg,
-                                                           sm->daemon)->cfg);
-  die_task = GNUNET_SCHEDULER_add_now (&stat_run, sm);
-}
-
-
-/**
- * Function scheduled to be run on the successful completion of this
- * testcase.
- */
-static void
-finish_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  struct TestPutContext *test_put;
-  struct TestGetContext *test_get;
-  struct StatMaster *sm;
-
-  die_task = GNUNET_SCHEDULER_NO_TASK;
-  while (NULL != (test_put = all_puts_head))
-  {
-    if (test_put->task != GNUNET_SCHEDULER_NO_TASK)
-      GNUNET_SCHEDULER_cancel (test_put->task);
-    if (test_put->dht_handle != NULL)
-      GNUNET_DHT_disconnect (test_put->dht_handle);
-    GNUNET_CONTAINER_DLL_remove (all_puts_head, all_puts_tail, test_put);
-    GNUNET_free (test_put);
-  }
-
-  while (NULL != (test_get = all_gets_head))
-  {
-    if (test_get->task != GNUNET_SCHEDULER_NO_TASK)
-      GNUNET_SCHEDULER_cancel (test_get->task);
-    if (test_get->get_handle != NULL)
-      GNUNET_DHT_get_stop (test_get->get_handle);
-    if (test_get->dht_handle != NULL)
-      GNUNET_DHT_disconnect (test_get->dht_handle);
-    GNUNET_CONTAINER_DLL_remove (all_gets_head, all_gets_tail, test_get);
-    GNUNET_free (test_get);
-  }
-  sm = GNUNET_malloc (sizeof (struct StatMaster));
-  sm->stat =
-      GNUNET_STATISTICS_create ("<driver>",
-                                GNUNET_TESTING_daemon_get (pg,
-                                                           sm->daemon)->cfg);
-  die_task = GNUNET_SCHEDULER_add_now (&stat_run, sm);
-}
-
-
-/**
- * Check if the get_handle is being used, if so stop the request.  Either
- * way, schedule the end_badly_cont function which actually shuts down the
- * test.
- */
-static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  const char *emsg = cls;
-  struct TestPutContext *test_put;
-  struct TestGetContext *test_get;
-
-  die_task = GNUNET_SCHEDULER_NO_TASK;
-  FPRINTF (stderr, "Failing test with error: `%s'!\n", emsg);
-  while (NULL != (test_put = all_puts_head))
-  {
-    if (test_put->task != GNUNET_SCHEDULER_NO_TASK)
-      GNUNET_SCHEDULER_cancel (test_put->task);
-    if (test_put->dht_handle != NULL)
-      GNUNET_DHT_disconnect (test_put->dht_handle);
-    GNUNET_CONTAINER_DLL_remove (all_puts_head, all_puts_tail, test_put);
-    GNUNET_free (test_put);
-  }
-
-  while (NULL != (test_get = all_gets_head))
-  {
-    if (test_get->task != GNUNET_SCHEDULER_NO_TASK)
-      GNUNET_SCHEDULER_cancel (test_get->task);
-    if (test_get->get_handle != NULL)
-      GNUNET_DHT_get_stop (test_get->get_handle);
-    if (test_get->dht_handle != NULL)
-      GNUNET_DHT_disconnect (test_get->dht_handle);
-    GNUNET_CONTAINER_DLL_remove (all_gets_head, all_gets_tail, test_get);
-    GNUNET_free (test_get);
-  }
-  ok = 1;
-  /* testing_peergroup will do that in its own end_badly() handler */
-  /*GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); */
-  pg = NULL;
-}
-
-
-/**
- * Task to release get handle.
- */
-static void
-get_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  struct TestGetContext *test_get = cls;
-  struct GNUNET_HashCode search_key;   /* Key stored under */
-  char original_data[TEST_DATA_SIZE];   /* Made up data to store */
-
-  test_get->task = GNUNET_SCHEDULER_NO_TASK;
-  memset (original_data, test_get->uid, sizeof (original_data));
-  GNUNET_CRYPTO_hash (original_data, TEST_DATA_SIZE, &search_key);
-  if (test_get->succeeded != GNUNET_YES)
-  {
-    gets_failed++;
-    FPRINTF (stderr, "Get from peer %s for key %s failed!\n",
-             GNUNET_i2s (&test_get->daemon->id), GNUNET_h2s (&search_key));
-  }
-  GNUNET_assert (test_get->get_handle != NULL);
-  GNUNET_DHT_get_stop (test_get->get_handle);
-  test_get->get_handle = NULL;
-
-  outstanding_gets--;           /* GET is really finished */
-  GNUNET_DHT_disconnect (test_get->dht_handle);
-  test_get->dht_handle = NULL;
-
-  GNUNET_CONTAINER_DLL_remove (all_gets_head, all_gets_tail, test_get);
-  GNUNET_free (test_get);
-  if ((gets_failed > 10) && (outstanding_gets == 0))
-  {
-    /* Had more than 10% failures */
-    FPRINTF (stderr, "%llu gets succeeded, %llu gets failed!\n", 
gets_completed,
-             gets_failed);
-    GNUNET_SCHEDULER_cancel (die_task);
-    ok = 1;
-    die_task =
-        GNUNET_SCHEDULER_add_now (&finish_testing, "not all gets succeeded");
-    return;
-  }
-  if ((gets_completed + gets_failed == num_peers * num_peers) && 
(outstanding_gets == 0))       /* All gets successful */
-  {
-    FPRINTF (stderr, "%llu gets succeeded, %llu gets failed!\n", 
gets_completed,
-             gets_failed);
-    GNUNET_SCHEDULER_cancel (die_task);
-    ok = 0;
-    die_task = GNUNET_SCHEDULER_add_now (&finish_testing, NULL);
-  }
-}
-
-
-/**
- * Iterator called if the GET request initiated returns a response.
- *
- * @param cls closure
- * @param exp when will this value expire
- * @param key key of the result
- * @param type type of the result
- * @param size number of bytes in data
- * @param data pointer to the result data
- */
-static void
-get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
-                     const struct GNUNET_HashCode * key,
-                     const struct GNUNET_PeerIdentity *get_path,
-                     unsigned int get_path_length,
-                     const struct GNUNET_PeerIdentity *put_path,
-                     unsigned int put_path_length, enum GNUNET_BLOCK_Type type,
-                     size_t size, const void *data)
-{
-  struct TestGetContext *test_get = cls;
-  struct GNUNET_HashCode search_key;   /* Key stored under */
-  char original_data[TEST_DATA_SIZE];   /* Made up data to store */
-
-  memset (original_data, test_get->uid, sizeof (original_data));
-  GNUNET_CRYPTO_hash (original_data, TEST_DATA_SIZE, &search_key);
-  if (test_get->succeeded == GNUNET_YES)
-    return;                     /* Get has already been successful, probably 
ending now */
-
-#if PATH_TRACKING
-  if (put_path != NULL)
-  {
-    unsigned int i;
-
-    FPRINTF (stderr, "PUT (%u) Path: ", test_get->uid);
-    for (i = 0; i < put_path_length; i++)
-      FPRINTF (stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s (&put_path[i]));
-    FPRINTF (stderr, "%s",  "\n");
-  }
-  if (get_path != NULL)
-  {
-    unsigned int i;
-
-    FPRINTF (stderr, "GET (%u) Path: ", test_get->uid);
-    for (i = 0; i < get_path_length; i++)
-      FPRINTF (stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s (&get_path[i]));
-    FPRINTF (stderr, "%s%s\n", get_path_length > 0 ? "->" : "",
-             GNUNET_i2s (&test_get->daemon->id));
-  }
-#endif
-
-  if ((0 != memcmp (&search_key, key, sizeof (struct GNUNET_HashCode))) ||
-      (0 != memcmp (original_data, data, sizeof (original_data))))
-  {
-    FPRINTF (stderr, "%s",  "Key or data is not the same as was inserted!\n");
-    return;
-  }
-  gets_completed++;
-  test_get->succeeded = GNUNET_YES;
-  GNUNET_SCHEDULER_cancel (test_get->task);
-  test_get->task = GNUNET_SCHEDULER_add_now (&get_stop_task, test_get);
-}
-
-
-/**
- * Set up some data, and call API PUT function
- */
-static void
-do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  struct TestGetContext *test_get = cls;
-  struct GNUNET_HashCode key;          /* Made up key to store data under */
-  char data[TEST_DATA_SIZE];    /* Made up data to store */
-
-  if (outstanding_gets > MAX_OUTSTANDING_GETS)
-  {
-    test_get->task =
-        GNUNET_SCHEDULER_add_delayed (GET_DELAY, &do_get, test_get);
-    return;
-  }
-  memset (data, test_get->uid, sizeof (data));
-  GNUNET_CRYPTO_hash (data, TEST_DATA_SIZE, &key);
-  test_get->dht_handle = GNUNET_DHT_connect (test_get->daemon->cfg, 10);
-  GNUNET_assert (test_get->dht_handle != NULL);
-  outstanding_gets++;
-  test_get->get_handle =
-      GNUNET_DHT_get_start (test_get->dht_handle, 
-                            GNUNET_BLOCK_TYPE_TEST, &key, 1, route_option, 
NULL,
-                            0, &get_result_iterator, test_get);
-  test_get->task =
-      GNUNET_SCHEDULER_add_delayed (GET_TIMEOUT, &get_stop_task, test_get);
-}
-
-
-/**
- * Task to release DHT handles for PUT
- */
-static void
-put_disconnect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  struct TestPutContext *test_put = cls;
-
-  test_put->task = GNUNET_SCHEDULER_NO_TASK;
-  GNUNET_DHT_disconnect (test_put->dht_handle);
-  test_put->dht_handle = NULL;
-  GNUNET_CONTAINER_DLL_remove (all_puts_head, all_puts_tail, test_put);
-  GNUNET_free (test_put);
-}
-
-
-/**
- * Schedule the GET requests
- */
-static void
-start_gets (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  unsigned long long i;
-  unsigned long long j;
-  struct TestGetContext *test_get;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             "Issuing %llu GETs\n",
-             (unsigned long long) (num_peers * num_peers));
-  for (i = 0; i < num_peers; i++)
-    for (j = 0; j < num_peers; j++)
-    {
-      test_get = GNUNET_malloc (sizeof (struct TestGetContext));
-      test_get->uid = i + j * num_peers;
-      test_get->daemon = GNUNET_TESTING_daemon_get (pg, j);
-      GNUNET_CONTAINER_DLL_insert (all_gets_head, all_gets_tail, test_get);
-      test_get->task = GNUNET_SCHEDULER_add_now (&do_get, test_get);
-    }
-}
-
-
-/**
- * Called when the PUT request has been transmitted to the DHT service.
- */
-static void
-put_finished (void *cls, int success)
-{
-  struct TestPutContext *test_put = cls;
-
-  outstanding_puts--;
-  puts_completed++;
-  if (GNUNET_SCHEDULER_NO_TASK != test_put->task)
-  {
-    GNUNET_SCHEDULER_cancel (test_put->task);
-  }
-  test_put->task = GNUNET_SCHEDULER_add_now (&put_disconnect_task, test_put);
-  if (puts_completed != num_peers * num_peers)
-    return;
-
-  GNUNET_assert (outstanding_puts == 0);
-  GNUNET_SCHEDULER_add_delayed (START_DELAY, &start_gets, NULL);
-}
-
-
-/**
- * Set up some data, and call API PUT function
- */
-static void
-do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  struct TestPutContext *test_put = cls;
-  struct GNUNET_HashCode key;          /* Made up key to store data under */
-  char data[TEST_DATA_SIZE];    /* Made up data to store */
-
-  test_put->task = GNUNET_SCHEDULER_NO_TASK;
-  if (outstanding_puts > MAX_OUTSTANDING_PUTS)
-  {
-    test_put->task =
-        GNUNET_SCHEDULER_add_delayed (PUT_DELAY, &do_put, test_put);
-    return;
-  }
-  memset (data, test_put->uid, sizeof (data));
-  GNUNET_CRYPTO_hash (data, TEST_DATA_SIZE, &key);
-  test_put->dht_handle = GNUNET_DHT_connect (test_put->daemon->cfg, 10);
-  GNUNET_assert (test_put->dht_handle != NULL);
-  outstanding_puts++;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             "PUT %u at `%s'\n", test_put->uid,
-             GNUNET_i2s (&test_put->daemon->id));
-  GNUNET_DHT_put (test_put->dht_handle, &key, 1, route_option,
-                  GNUNET_BLOCK_TYPE_TEST, sizeof (data), data,
-                  GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_UNIT_FOREVER_REL,
-                  &put_finished, test_put);
-  test_put->task =
-      GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
-                                    &put_disconnect_task, test_put);
-}
-
-
-static void
-run_dht_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  unsigned long long i;
-  struct TestPutContext *test_put;
-
-  if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
-  {
-    ok = 1;
-    return;
-  }
-#if PATH_TRACKING
-  route_option =
-      GNUNET_DHT_RO_RECORD_ROUTE | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE;
-#else
-  route_option = GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE;
-#endif
-  die_task =
-      GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
-                                    "from setup puts/gets");
-  FPRINTF (stderr, "Issuing %llu PUTs (one per peer)\n",
-           (unsigned long long) (num_peers * num_peers));
-  for (i = 0; i < num_peers * num_peers; i++)
-  {
-    test_put = GNUNET_malloc (sizeof (struct TestPutContext));
-    test_put->uid = i;
-    test_put->daemon = GNUNET_TESTING_daemon_get (pg, i % num_peers);
-    test_put->task = GNUNET_SCHEDULER_add_now (&do_put, test_put);
-    GNUNET_CONTAINER_DLL_insert (all_puts_head, all_puts_tail, test_put);
-  }
-}
-
-
-/**
- * This function is called once testing has finished setting up the topology.
- *
- * @param cls unused
- * @param emsg variable is NULL on success (peers connected), and non-NULL on
- * failure (peers failed to connect).
- */
-static void
-startup_done (void *cls, const char *emsg)
-{
-  if (emsg != NULL)
-  {
-    FPRINTF (stderr, "Failed to setup topology: %s\n", emsg);
-    die_task = GNUNET_SCHEDULER_add_now (&end_badly, "topology setup failed");
-    return;
-  }
-  die_task =
-      GNUNET_SCHEDULER_add_delayed (START_DELAY, &run_dht_test,
-                                    "from setup puts/gets");
-}
-
-
-static void
-run (void *cls, char *const *args, const char *cfgfile,
-     const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  /* Get path from configuration file */
-  if (GNUNET_YES !=
-      GNUNET_CONFIGURATION_get_value_string (cfg, "paths", "servicehome",
-                                             &test_directory))
-  {
-    GNUNET_break (0);
-    ok = 404;
-    return;
-  }
-  if (GNUNET_SYSERR ==
-      GNUNET_CONFIGURATION_get_value_number (cfg, "testing_old", "num_peers",
-                                             &num_peers))
-    num_peers = DEFAULT_NUM_PEERS;
-  pg = GNUNET_TESTING_peergroup_start (cfg, num_peers, TIMEOUT, NULL,
-                                       &startup_done, NULL, NULL);
-  GNUNET_assert (NULL != pg);
-  shutdown_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_FOREVER_REL,
-                                               &do_stop, NULL);
-}
-
-
-static int
-check ()
-{
-  int ret;
-
-  /* Arguments for GNUNET_PROGRAM_run */
-  char *const argv[] = { "test-dht-multipeer",  /* Name to give running binary 
*/
-    "-c",
-    "test_dht_multipeer_data.conf",     /* Config file to use */
-    NULL
-  };
-  struct GNUNET_GETOPT_CommandLineOption options[] = {
-    GNUNET_GETOPT_OPTION_END
-  };
-  /* Run the run function as a new program */
-  ret =
-      GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
-                          "test-dht-multipeer", "nohelp", options, &run, &ok);
-  if (ret != GNUNET_OK)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "`test-dht-multipeer': Failed with error code %d\n", ret);
-  }
-  return ok;
-}
-
-
-int
-main (int argc, char *argv[])
-{
-  int ret;
-
-  GNUNET_log_setup ("test-dht-multipeer",
-                    "WARNING",
-                    NULL);
-  ret = check ();
-  /**
-   * Need to remove base directory, subdirectories taken care
-   * of by the testing framework.
-   */
-  if (GNUNET_DISK_directory_remove (test_directory) != GNUNET_OK)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Failed to remove testing directory %s\n", test_directory);
-  }
-  return ret;
-}
-
-/* end of test_dht_multipeer.c */

Copied: gnunet/src/dht/test_dht_multipeer.conf (from rev 24670, 
gnunet/src/dht/test_dht_multipeer_data.conf)
===================================================================
--- gnunet/src/dht/test_dht_multipeer.conf                              (rev 0)
+++ gnunet/src/dht/test_dht_multipeer.conf      2012-11-02 10:19:00 UTC (rev 
24676)
@@ -0,0 +1,58 @@
+[fs]
+AUTOSTART = NO
+
+[resolver]
+AUTOSTART = NO
+
+[block]
+plugins = test dht
+
+[dhtcache]
+QUOTA = 1 MB
+DATABASE = sqlite
+
+[transport]
+PLUGINS = tcp
+
+[ats]
+WAN_QUOTA_IN = 1 GB
+WAN_QUOTA_OUT = 1 GB
+
+[arm]
+DEFAULTSERVICES = dht core
+
+[TESTING]
+WEAKRANDOM = YES
+
+[testbed]
+OVERLAY_TOPOLOGY = FROM_FILE
+OVERLAY_TOPOLOGY_FILE = test_dht_multipeer_topology.dat
+
+[gnunetd]
+HOSTKEY = $SERVICEHOME/.hostkey
+
+[PATHS]
+SERVICEHOME = /tmp/test-dht-multipeer/
+
+[nat]
+DISABLEV6 = YES
+ENABLE_UPNP = NO
+BEHIND_NAT = NO
+ALLOW_NAT = NO
+INTERNAL_ADDRESS = 127.0.0.1
+EXTERNAL_ADDRESS = 127.0.0.1
+USE_LOCALADDR = YES
+
+[dns]
+AUTOSTART = NO
+
+[namestore]
+AUTOSTART = NO
+
+[nse]
+AUTOSTART = NO
+
+[vpn]
+AUTOSTART=NO
+
+

Deleted: gnunet/src/dht/test_dht_multipeer_data.conf
===================================================================
--- gnunet/src/dht/test_dht_multipeer_data.conf 2012-11-02 10:18:43 UTC (rev 
24675)
+++ gnunet/src/dht/test_dht_multipeer_data.conf 2012-11-02 10:19:00 UTC (rev 
24676)
@@ -1,130 +0,0 @@
-[fs]
-AUTOSTART = NO
-
-[resolver]
-AUTOSTART = NO
-
-[dht]
-DEBUG = NO
-STOP_ON_CLOSEST = YES
-AUTOSTART = YES
-ACCEPT_FROM6 = ::1;
-ACCEPT_FROM = 127.0.0.1;
-#BINARY = 
/home/mrwiggles/documents/research/gnunet/gnunet-ng/src/dht/.libs/gnunet-service-dht
-#PREFIX = xterm -T dht -e gdb --args
-#PREFIX = valgrind --log-file=dht_%p
-HOME = $SERVICEHOME
-HOSTNAME = localhost
-PORT = 12100
-STOP_FOUND = YES
-USE_MAX_HOPS = YES
-MAX_HOPS = 16
-CONVERGE_BINARY = YES
-CONVERGE_MODIFIER = 4
-
-[block]
-plugins = test dht
-
-[dhtcache]
-QUOTA = 1 MB
-DATABASE = sqlite
-
-[transport]
-PLUGINS = tcp
-DEBUG = NO
-ACCEPT_FROM6 = ::1;
-ACCEPT_FROM = 127.0.0.1;
-NEIGHBOUR_LIMIT = 50
-BINARY = gnunet-service-transport
-HOME = $SERVICEHOME
-HOSTNAME = localhost
-PORT = 12365
-
-[DHTLOG]
-PLUGIN = mysql_dump
-
-[ats]
-WAN_QUOTA_IN = 1 GB
-WAN_QUOTA_OUT = 1 GB
-
-[core]
-ACCEPT_FROM6 = ::1;
-ACCEPT_FROM = 127.0.0.1;
-BINARY = gnunet-service-core
-HOME = $SERVICEHOME
-HOSTNAME = localhost
-PORT = 12092
-DEBUG = NO
-
-[arm]
-DEFAULTSERVICES = dht core
-ACCEPT_FROM6 = ::1;
-ACCEPT_FROM = 127.0.0.1;
-BINARY = gnunet-service-arm
-HOME = $SERVICEHOME
-HOSTNAME = localhost
-PORT = 12366
-DEBUG = NO
-
-[transport-tcp]
-TIMEOUT = 300 s
-PORT = 12368
-BINDTO = 127.0.0.1
-
-[DHT_TESTING]
-MYSQL_LOGGING_EXTENDED = NO
-MYSQL_LOGGING = NO
-NUM_GETS = 5
-NUM_PUTS = 5
-
-[TESTING]
-WEAKRANDOM = YES
-
-[testing_old]
-TOPOLOGY = FROM_FILE
-# file contains a ring
-CONNECT_TOPOLOGY = NONE
-# None == use all allowed connections
-# BLACKLIST_TOPOLOGY = X
-# No additional restrictions...
-
-TOPOLOGY_FILE = multipeer_topo.dat
-MAX_CONCURRENT_SSH = 1
-PEERGROUP_TIMEOUT = 2400 s
-USE_PROGRESSBARS = YES
-#CONNECT_TOPOLOGY_OPTION = CONNECT_RANDOM_SUBSET
-#CONNECT_TOPOLOGY_OPTION_MODIFIER = 2
-#LOGNMODIFIER = .65
-#PERCENTAGE = .75
-NUM_PEERS = 10
-HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat
-
-[gnunetd]
-HOSTKEY = $SERVICEHOME/.hostkey
-
-[PATHS]
-SERVICEHOME = /tmp/test-dht-multipeer/
-
-[nat]
-DISABLEV6 = YES
-ENABLE_UPNP = NO
-BEHIND_NAT = NO
-ALLOW_NAT = NO
-INTERNAL_ADDRESS = 127.0.0.1
-EXTERNAL_ADDRESS = 127.0.0.1
-USE_LOCALADDR = YES
-
-[dns]
-AUTOSTART = NO
-
-[namestore]
-AUTOSTART = NO
-
-[nse]
-AUTOSTART = NO
-
-
-[vpn]
-AUTOSTART=NO
-
-

Copied: gnunet/src/dht/test_dht_multipeer_topology.dat (from rev 24670, 
gnunet/src/dht/multipeer_topo.dat)
===================================================================
--- gnunet/src/dht/test_dht_multipeer_topology.dat                              
(rev 0)
+++ gnunet/src/dht/test_dht_multipeer_topology.dat      2012-11-02 10:19:00 UTC 
(rev 24676)
@@ -0,0 +1,31 @@
+10
+1:2
+2:3
+3:4
+4:5
+5:6
+6:7
+7:8
+8:9
+9:10
+10:1
+4:2
+5:3
+6:4
+7:5
+8:6
+9:7
+10:8
+1:9
+2:10
+3:1
+6:2
+7:3
+8:4
+9:5
+10:6
+1:7
+2:8
+3:9
+4:10
+5:1

Modified: gnunet/src/dht/test_dht_topo.c
===================================================================
--- gnunet/src/dht/test_dht_topo.c      2012-11-02 10:18:43 UTC (rev 24675)
+++ gnunet/src/dht/test_dht_topo.c      2012-11-02 10:19:00 UTC (rev 24676)
@@ -30,11 +30,6 @@
 #include "dht_test_lib.h"
 
 /**
- * Number of peers to run.
- */
-#define NUM_PEERS 5
-
-/**
  * How long until we give up on fetching the data?
  */
 #define GET_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 
120)
@@ -93,8 +88,133 @@
  */
 static struct GetOperation *get_tail;
 
+/**
+ * Array of the testbed's peers.
+ */ 
+static struct GNUNET_TESTBED_Peer **my_peers;
 
 /**
+ * Number of peers to run.
+ */
+static unsigned int NUM_PEERS;
+
+
+/**
+ * Statistics we print out.
+ */
+static struct
+{
+  const char *subsystem;
+  const char *name;
+  unsigned long long total;
+} stats[] = {
+  {"core", "# bytes decrypted", 0},
+  {"core", "# bytes encrypted", 0},
+  {"core", "# type maps received", 0},
+  {"core", "# session keys confirmed via PONG", 0},
+  {"core", "# peers connected", 0},
+  {"core", "# key exchanges initiated", 0},
+  {"core", "# send requests dropped (disconnected)", 0},
+  {"core", "# transmissions delayed due to corking", 0},
+  {"core", "# messages discarded (expired prior to transmission)", 0},
+  {"core", "# messages discarded (disconnected)", 0},
+  {"core", "# discarded CORE_SEND requests", 0},
+  {"core", "# discarded lower priority CORE_SEND requests", 0},
+  {"transport", "# bytes received via TCP", 0},
+  {"transport", "# bytes transmitted via TCP", 0},
+  {"dht", "# PUT messages queued for transmission", 0},
+  {"dht", "# P2P PUT requests received", 0},
+  {"dht", "# GET messages queued for transmission", 0},
+  {"dht", "# P2P GET requests received", 0},
+  {"dht", "# RESULT messages queued for transmission", 0},
+  {"dht", "# P2P RESULTS received", 0},
+  {"dht", "# Queued messages discarded (peer disconnected)", 0},
+  {"dht", "# Peers excluded from routing due to Bloomfilter", 0},
+  {"dht", "# Peer selection failed", 0},
+  {"dht", "# FIND PEER requests ignored due to Bloomfilter", 0},
+  {"dht", "# FIND PEER requests ignored due to lack of HELLO", 0},
+  {"dht", "# P2P FIND PEER requests processed", 0},
+  {"dht", "# P2P GET requests ONLY routed", 0},
+  {"dht", "# Preference updates given to core", 0},
+  {"dht", "# REPLIES ignored for CLIENTS (no match)", 0},
+  {"dht", "# GET requests from clients injected", 0},
+  {"dht", "# GET requests received from clients", 0},
+  {"dht", "# GET STOP requests received from clients", 0},
+  {"dht", "# ITEMS stored in datacache", 0},
+  {"dht", "# Good RESULTS found in datacache", 0},
+  {"dht", "# GET requests given to datacache", 0},
+  {NULL, NULL, 0}
+};
+
+
+/**
+ * Function called once we're done processing stats.
+ *
+ * @param cls the test context
+ * @param op the stats operation
+ * @param emsg error message on failure
+ */
+static void
+stats_finished (void *cls,
+               struct GNUNET_TESTBED_Operation *op,
+               const char *emsg)
+{
+  struct GNUNET_DHT_TEST_Context *ctx = cls;
+  unsigned int i;
+
+  if (NULL != op)
+    GNUNET_TESTBED_operation_done (op); // needed?
+  if (NULL != emsg)
+  {
+    fprintf (stderr, _("Gathering statistics failed: %s\n"),
+            emsg);
+    GNUNET_SCHEDULER_cancel (put_task);
+    GNUNET_DHT_TEST_cleanup (ctx);
+    return;
+  }
+  for (i = 0; NULL != stats[i].name; i++)
+    FPRINTF (stderr, 
+            "%6s/%60s = %12llu\n", 
+            stats[i].subsystem,
+            stats[i].name, 
+            stats[i].total);
+  GNUNET_SCHEDULER_cancel (put_task);
+  GNUNET_DHT_TEST_cleanup (ctx);
+}
+
+
+/**
+ * Function called to process statistic values from all peers.
+ *
+ * @param cls closure
+ * @param peer the peer the statistic belong to
+ * @param subsystem name of subsystem that created the statistic
+ * @param name the name of the datum
+ * @param value the current value
+ * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not
+ * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
+ */
+static int 
+handle_stats (void *cls,
+             const struct GNUNET_TESTBED_Peer *peer,
+             const char *subsystem,
+             const char *name,
+             uint64_t value,
+             int is_persistent)
+{
+  unsigned int i;
+
+  for (i = 0; NULL != stats[i].name; i++)
+    if ( (0 == strcasecmp (subsystem,
+                          stats[i].subsystem)) &&
+        (0 == strcasecmp (name,
+                          stats[i].name)) )
+      stats[i].total += value;
+  return GNUNET_OK;
+}
+
+
+/**
  * Task run on success or timeout to clean up.
  * Terminates active get operations and shuts down
  * the testbed.
@@ -117,8 +237,11 @@
                                 get_op);
     GNUNET_free (get_op);
   }
-  GNUNET_SCHEDULER_cancel (put_task);
-  GNUNET_DHT_TEST_cleanup (ctx);
+  (void) GNUNET_TESTBED_get_statistics (NUM_PEERS,
+                                       my_peers,
+                                       &handle_stats,
+                                       &stats_finished,
+                                       ctx);
 }
 
 
@@ -249,16 +372,9 @@
   struct GetOperation *get_op;
 
   GNUNET_assert (NUM_PEERS == num_peers);
+  my_peers = peers;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
              "Peers setup, starting test\n");
-  /* FIXME: once testbed is finished, this call should
-     no longer be needed */
-  GNUNET_TESTBED_overlay_configure_topology (NULL, 
-                                            num_peers,
-                                            peers,
-                                            GNUNET_TESTBED_TOPOLOGY_LINE,
-                                            
GNUNET_TESTBED_TOPOLOGY_OPTION_END);
-
   put_task = GNUNET_SCHEDULER_add_now (&do_puts, dhts);
   for (i=0;i<num_peers;i++)
   {
@@ -297,12 +413,26 @@
   {
     cfg_filename = "test_dht_2dtorus.conf";
     test_name = "test-dht-2dtorus";
+    NUM_PEERS = 16;
   }
   else if (NULL != strstr (xargv[0], "test_dht_line"))
   {
     cfg_filename = "test_dht_line.conf"; 
     test_name = "test-dht-line";
+    NUM_PEERS = 5;
   }
+  else if (NULL != strstr (xargv[0], "test_dht_twopeer"))
+  {
+    cfg_filename = "test_dht_line.conf"; 
+    test_name = "test-dht-twopeer";
+    NUM_PEERS = 2;
+  }
+  else if (NULL != strstr (xargv[0], "test_dht_multipeer"))
+  {
+    cfg_filename = "test_dht_multipeer.conf"; 
+    test_name = "test-dht-multipeer";
+    NUM_PEERS = 10;
+  }
   else
   {
     GNUNET_break (0);

Deleted: gnunet/src/dht/test_dht_twopeer.c
===================================================================
--- gnunet/src/dht/test_dht_twopeer.c   2012-11-02 10:18:43 UTC (rev 24675)
+++ gnunet/src/dht/test_dht_twopeer.c   2012-11-02 10:19:00 UTC (rev 24676)
@@ -1,494 +0,0 @@
-/*
-     This file is part of GNUnet.
-     (C) 2009 Christian Grothoff (and other contributing authors)
-
-     GNUnet is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 3, or (at your
-     option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
-
-     You should have received a copy of the GNU General Public License
-     along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
-*/
-/**
- * @file dht/test_dht_twopeer.c
- * @brief base testcase for testing DHT service with
- *        two running peers
- */
-#include "platform.h"
-#include "gnunet_testing_lib.h"
-#include "gnunet_core_service.h"
-#include "gnunet_dht_service.h"
-
-/* DEFINES */
-#define MAX_GET_ATTEMPTS 10
-
-#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 5)
-
-#define DEFAULT_NUM_PEERS 2
-
-/* Structs */
-
-struct PeerGetContext
-{
-  struct GNUNET_PeerIdentity *peer;
-
-  struct GNUNET_DHT_Handle *dht_handle;
-
-  struct GNUNET_DHT_GetHandle *get_handle;
-
-  unsigned int get_attempts;
-
-  GNUNET_SCHEDULER_TaskIdentifier retry_task;
-};
-
-/* Globals */
-static char *test_directory;
-
-static struct PeerGetContext curr_get_ctx;
-
-static unsigned int expected_connections;
-
-static unsigned long long peers_left;
-
-static struct GNUNET_TESTING_PeerGroup *pg;
-
-static unsigned long long num_peers;
-
-static unsigned int total_gets;
-
-static unsigned int gets_succeeded;
-
-static unsigned int total_connections;
-
-static unsigned int failed_connections;
-
-static GNUNET_SCHEDULER_TaskIdentifier die_task;
-
-static int ok;
-
-static struct GNUNET_PeerIdentity peer1id;
-
-static struct GNUNET_PeerIdentity peer2id;
-
-static struct GNUNET_DHT_Handle *peer1dht;
-
-static struct GNUNET_DHT_Handle *peer2dht;
-
-/**
- * Check whether peers successfully shut down.
- */
-static void
-shutdown_callback (void *cls, const char *emsg)
-{
-  if (emsg != NULL)
-  {
-    if (ok == 0)
-      ok = 2;
-  }
-}
-
-static void
-finish_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  GNUNET_assert (pg != NULL);
-  GNUNET_assert (peer1dht != NULL);
-  GNUNET_assert (peer2dht != NULL);
-  GNUNET_DHT_disconnect (peer1dht);
-  GNUNET_DHT_disconnect (peer2dht);
-  GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
-  pg = NULL;
-  ok = 0;
-}
-
-static void
-end_badly_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  if (peer1dht != NULL)
-    GNUNET_DHT_disconnect (peer1dht);
-
-  if (peer2dht != NULL)
-    GNUNET_DHT_disconnect (peer2dht);
-
-  if (pg != NULL)
-  {
-    GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
-    pg = NULL;
-  }
-
-  if (curr_get_ctx.retry_task != GNUNET_SCHEDULER_NO_TASK)
-  {
-    GNUNET_SCHEDULER_cancel (curr_get_ctx.retry_task);
-    curr_get_ctx.retry_task = GNUNET_SCHEDULER_NO_TASK;
-  }
-}
-
-
-static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  const char *emsg = cls;
-
-  FPRINTF (stderr, "Error: %s\n", emsg);
-  if (curr_get_ctx.retry_task != GNUNET_SCHEDULER_NO_TASK)
-  {
-    GNUNET_SCHEDULER_cancel (curr_get_ctx.retry_task);
-    curr_get_ctx.retry_task = GNUNET_SCHEDULER_NO_TASK;
-  }
-  if (curr_get_ctx.get_handle != NULL)
-  {
-    GNUNET_DHT_get_stop (curr_get_ctx.get_handle);
-  }
-
-  GNUNET_SCHEDULER_add_now (&end_badly_cont, NULL);
-  ok = 1;
-}
-
-
-/* Forward declaration */
-static void
-do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
-
-/**
- * Iterator called on each result obtained for a DHT
- * operation that expects a reply
- *
- * @param cls closure
- * @param exp when will this value expire
- * @param key key of the result
- * @param type type of the result
- * @param size number of bytes in data
- * @param data pointer to the result data
- */
-static void
-get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
-                     const struct GNUNET_HashCode * key,
-                     const struct GNUNET_PeerIdentity *get_path,
-                     unsigned int get_path_length,
-                     const struct GNUNET_PeerIdentity *put_path,
-                     unsigned int put_path_length, enum GNUNET_BLOCK_Type type,
-                     size_t size, const void *data)
-{
-  struct PeerGetContext *get_context = cls;
-
-  if (0 !=
-      memcmp (&get_context->peer->hashPubKey, key, sizeof (struct 
GNUNET_HashCode)))
-  {
-    FPRINTF (stderr, "%s",  "??\n");
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Key returned is not the same key as was searched for!\n");
-    GNUNET_SCHEDULER_cancel (die_task);
-    die_task =
-        GNUNET_SCHEDULER_add_now (&end_badly,
-                                  "key mismatch in get response!\n");
-    return;
-  }
-  if (get_context->retry_task != GNUNET_SCHEDULER_NO_TASK)
-  {
-    GNUNET_SCHEDULER_cancel (get_context->retry_task);
-    get_context->retry_task = GNUNET_SCHEDULER_NO_TASK;
-  }
-
-  if (get_context->peer == &peer2id)
-  {
-    get_context->peer = &peer1id;
-    get_context->dht_handle = peer2dht;
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Received first correct GET request response!\n");
-    GNUNET_DHT_get_stop (get_context->get_handle);
-    GNUNET_SCHEDULER_add_now (&do_get, get_context);
-  }
-  else
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Received second correct GET request response!\n");
-    GNUNET_SCHEDULER_cancel (die_task);
-    GNUNET_DHT_get_stop (get_context->get_handle);
-    die_task = GNUNET_SCHEDULER_add_now (&finish_testing, NULL);
-  }
-
-}
-
-static void
-stop_retry_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
-
-
-static void
-get_stop_finished (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  struct PeerGetContext *get_context = cls;
-
-  if (get_context->get_attempts >= MAX_GET_ATTEMPTS)
-  {
-    FPRINTF (stderr, "%s",  "?\n");
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Too many attempts failed, ending test!\n",
-                get_context->get_attempts);
-    GNUNET_SCHEDULER_cancel (die_task);
-    die_task =
-        GNUNET_SCHEDULER_add_now (&end_badly,
-                                  "GET attempt failed, ending test!\n");
-    return;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Get attempt %u failed, retrying request!\n",
-              get_context->get_attempts);
-  FPRINTF (stderr, "%s",  ".");
-  get_context->get_attempts++;
-  get_context->retry_task =
-      GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
-                                    (GNUNET_TIME_UNIT_SECONDS, 60),
-                                    &stop_retry_get, get_context);
-  get_context->get_handle =
-      GNUNET_DHT_get_start (get_context->dht_handle,
-                            GNUNET_BLOCK_TYPE_DHT_HELLO,
-                            &get_context->peer->hashPubKey, 1,
-                            GNUNET_DHT_RO_NONE, NULL, 0, &get_result_iterator,
-                            get_context);
-}
-
-
-static void
-stop_retry_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  struct PeerGetContext *get_context = cls;
-
-  get_context->retry_task = GNUNET_SCHEDULER_NO_TASK;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Get attempt %u failed, canceling request!\n",
-              get_context->get_attempts);
-  GNUNET_DHT_get_stop (get_context->get_handle);
-  get_context->get_handle = NULL;
-  GNUNET_SCHEDULER_add_now (&get_stop_finished, get_context);
-}
-
-
-static void
-do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  struct PeerGetContext *get_context = cls;
-
-  get_context->retry_task =
-      GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
-                                    (GNUNET_TIME_UNIT_SECONDS, 10),
-                                    &stop_retry_get, get_context);
-  get_context->get_handle =
-      GNUNET_DHT_get_start (get_context->dht_handle,
-                            GNUNET_BLOCK_TYPE_DHT_HELLO,
-                            &get_context->peer->hashPubKey, 1,
-                            GNUNET_DHT_RO_FIND_PEER, NULL, 0,
-                            &get_result_iterator, get_context);
-}
-
-
-static void
-topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
-                   const struct GNUNET_PeerIdentity *second, uint32_t distance,
-                   const struct GNUNET_CONFIGURATION_Handle *first_cfg,
-                   const struct GNUNET_CONFIGURATION_Handle *second_cfg,
-                   struct GNUNET_TESTING_Daemon *first_daemon,
-                   struct GNUNET_TESTING_Daemon *second_daemon,
-                   const char *emsg)
-{
-  if (emsg == NULL)
-  {
-    total_connections++;
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "connected peer %s to peer %s, distance %u\n",
-                first_daemon->shortname, second_daemon->shortname, distance);
-  }
-  else
-  {
-    failed_connections++;
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Failed to connect peer %s to peer %s with error :\n%s\n",
-                first_daemon->shortname, second_daemon->shortname, emsg);
-  }
-
-  if (total_connections == expected_connections)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Created %d total connections, which is our target number!  
Starting next phase of testing.\n",
-                total_connections);
-    GNUNET_SCHEDULER_cancel (die_task);
-    die_task =
-        GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
-                                      "Timeout trying to GET");
-
-    curr_get_ctx.dht_handle = peer1dht;
-    curr_get_ctx.peer = &peer2id;
-    GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
-                                  (GNUNET_TIME_UNIT_SECONDS, 2), &do_get,
-                                  &curr_get_ctx);
-  }
-  else if (total_connections + failed_connections == expected_connections)
-  {
-    GNUNET_SCHEDULER_cancel (die_task);
-    die_task =
-        GNUNET_SCHEDULER_add_now (&end_badly,
-                                  "from topology_callback (too many failed 
connections)");
-  }
-}
-
-
-static void
-connect_topology (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  expected_connections = -1;
-  if ((pg != NULL) && (peers_left == 0))
-    expected_connections =
-        GNUNET_TESTING_connect_topology (pg, GNUNET_TESTING_TOPOLOGY_CLIQUE,
-                                         GNUNET_TESTING_TOPOLOGY_OPTION_ALL,
-                                         0.0, TIMEOUT, 12, NULL, NULL);
-
-  GNUNET_SCHEDULER_cancel (die_task);
-  if (expected_connections == GNUNET_SYSERR)
-    die_task =
-        GNUNET_SCHEDULER_add_now (&end_badly,
-                                  "from connect topology (bad return)");
-  else
-    die_task =
-        GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
-                                      "from connect topology (timeout)");
-}
-
-
-static void
-peers_started_callback (void *cls, const struct GNUNET_PeerIdentity *id,
-                        const struct GNUNET_CONFIGURATION_Handle *cfg,
-                        struct GNUNET_TESTING_Daemon *d, const char *emsg)
-{
-  if (emsg != NULL)
-  {
-    FPRINTF (stderr, "Failed to start daemon: `%s'\n", emsg);
-    return;
-  }
-  GNUNET_assert (id != NULL);
-  if (peers_left == num_peers)
-  {
-    memcpy (&peer1id, id, sizeof (struct GNUNET_PeerIdentity));
-    peer1dht = GNUNET_DHT_connect (cfg, 100);
-    if (peer1dht == NULL)
-    {
-      GNUNET_SCHEDULER_cancel (die_task);
-      die_task =
-          GNUNET_SCHEDULER_add_now (&end_badly, "Failed to get dht handle!\n");
-    }
-  }
-  else
-  {
-    memcpy (&peer2id, id, sizeof (struct GNUNET_PeerIdentity));
-    peer2dht = GNUNET_DHT_connect (cfg, 100);
-    if (peer2dht == NULL)
-    {
-      GNUNET_SCHEDULER_cancel (die_task);
-      die_task =
-          GNUNET_SCHEDULER_add_now (&end_badly, "Failed to get dht handle!\n");
-    }
-  }
-
-
-  peers_left--;
-
-  if (peers_left == 0)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "All %d daemons started, now connecting peers!\n", num_peers);
-    GNUNET_SCHEDULER_cancel (die_task);
-    /* Set up task in case topology creation doesn't finish
-     * within a reasonable amount of time */
-    die_task =
-        GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
-                                      "from peers_started_callback");
-
-    GNUNET_SCHEDULER_add_now (&connect_topology, NULL);
-    ok = 0;
-  }
-}
-
-
-static void
-run (void *cls, char *const *args, const char *cfgfile,
-     const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-
-  if (GNUNET_YES !=
-      GNUNET_CONFIGURATION_get_value_string (cfg, "paths", "servicehome",
-                                             &test_directory))
-  {
-    ok = 404;
-    return;
-  }
-
-  if (GNUNET_SYSERR ==
-      GNUNET_CONFIGURATION_get_value_number (cfg, "testing_old", "num_peers",
-                                             &num_peers))
-    num_peers = DEFAULT_NUM_PEERS;
-
-  peers_left = num_peers;
-  total_gets = num_peers;
-  gets_succeeded = 0;
-  /* Set up a task to end testing if peer start fails */
-  die_task =
-      GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
-                                    "didn't start all daemons in reasonable 
amount of time!!!");
-
-  pg = GNUNET_TESTING_daemons_start (cfg, num_peers, 10, num_peers, TIMEOUT,
-                                     NULL, NULL, &peers_started_callback, NULL,
-                                     &topology_callback, NULL, NULL);
-
-}
-
-static int
-check ()
-{
-  int ret;
-
-  char *const argv[] = { "test-dht-twopeer",
-    "-c",
-    "test_dht_twopeer_data.conf",
-    NULL
-  };
-  struct GNUNET_GETOPT_CommandLineOption options[] = {
-    GNUNET_GETOPT_OPTION_END
-  };
-  ret =
-      GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
-                          "test-dht-twopeer", "nohelp", options, &run, &ok);
-  if (ret != GNUNET_OK)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "`test-dht-twopeer': Failed with error code %d\n", ret);
-  }
-  return ok;
-}
-
-int
-main (int argc, char *argv[])
-{
-  int ret;
-
-  GNUNET_log_setup ("test-dht-twopeer",
-                    "WARNING",
-                    NULL);
-  ret = check ();
-  /**
-   * Need to remove base directory, subdirectories taken care
-   * of by the testing framework.
-   */
-  if (GNUNET_DISK_directory_remove (test_directory) != GNUNET_OK)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Failed to remove testing directory %s\n", test_directory);
-  }
-  return ret;
-}
-
-/* end of test_dht_twopeer.c */

Deleted: gnunet/src/dht/test_dht_twopeer_data.conf
===================================================================
--- gnunet/src/dht/test_dht_twopeer_data.conf   2012-11-02 10:18:43 UTC (rev 
24675)
+++ gnunet/src/dht/test_dht_twopeer_data.conf   2012-11-02 10:19:00 UTC (rev 
24676)
@@ -1,81 +0,0 @@
-[PATHS]
-SERVICEHOME = /tmp/test-dht-twopeer/
-
-[resolver]
-AUTOSTART = YES
-
-[dht]
-DEBUG = NO
-AUTOSTART = YES
-#PREFIX = xterm -T dht -e gdb --args
-PORT = 12100
-BINARY = gnunet-service-dht
-
-[block]
-plugins = test dht dns
-
-[dhtcache]
-QUOTA = 1 MB
-DATABASE = sqlite
-
-[transport]
-PLUGINS = tcp
-DEBUG = NO
-NEIGHBOUR_LIMIT = 50
-PORT = 12365
-
-[ats]
-WAN_QUOTA_IN = 1 GB
-WAN_QUOTA_OUT = 1 GB
-
-[core]
-HOSTNAME = localhost
-PORT = 12092
-
-[arm]
-DEFAULTSERVICES = core dht
-PORT = 12366
-DEBUG = NO
-
-[transport-tcp]
-TIMEOUT = 300 s
-PORT = 12368
-BINDTO = 127.0.0.1
-
-[TESTING]
-WEAKRANDOM = YES
-
-[testing_old]
-NUM_PEERS = 2
-HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat
-
-[gnunetd]
-HOSTKEY = $SERVICEHOME/.hostkey
-
-[nat]
-DISABLEV6 = YES
-ENABLE_UPNP = NO
-BEHIND_NAT = NO
-ALLOW_NAT = NO
-INTERNAL_ADDRESS = 127.0.0.1
-EXTERNAL_ADDRESS = 127.0.0.1
-USE_LOCALADDR = YES
-
-[dns]
-AUTOSTART = NO
-
-[mesh]
-AUTOSTART = NO
-
-[nse]
-AUTOSTART = NO
-
-[fs]
-AUTOSTART = NO
-
-[namestore]
-AUTOSTART = NO
-[vpn]
-AUTOSTART=NO
-
-

Deleted: gnunet/src/dht/test_dht_twopeer_get_put.c
===================================================================
--- gnunet/src/dht/test_dht_twopeer_get_put.c   2012-11-02 10:18:43 UTC (rev 
24675)
+++ gnunet/src/dht/test_dht_twopeer_get_put.c   2012-11-02 10:19:00 UTC (rev 
24676)
@@ -1,590 +0,0 @@
-/*
-     This file is part of GNUnet.
-     (C) 2009 Christian Grothoff (and other contributing authors)
-
-     GNUnet is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 3, or (at your
-     option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
-
-     You should have received a copy of the GNU General Public License
-     along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
-*/
-/**
- * @file dht/test_dht_twopeer_get_put.c
- * @brief base testcase for testing DHT service with
- *        two running peers.
- *
- * This testcase starts peers using the GNUNET_TESTING_daemons_start
- * function call.  On peer start, connects to the peers DHT service
- * by calling GNUNET_DHT_connected.  Once notified about all peers
- * being started (by the peers_started_callback function), calls
- * GNUNET_TESTING_connect_topology, which connects the peers in a
- * "straight line" topology.  On notification that all peers have
- * been properly connected, calls the do_get function which initiates
- * a GNUNET_DHT_get from the *second* peer. Once the GNUNET_DHT_get
- * function starts, runs the do_put function to insert data at the first peer.
- *   If the GET is successful, schedules finish_testing
- * to stop the test and shut down peers.  If GET is unsuccessful
- * after GET_TIMEOUT seconds, prints an error message and shuts down
- * the peers.
- */
-#include "platform.h"
-#include "gnunet_testing_lib.h"
-#include "gnunet_core_service.h"
-#include "gnunet_dht_service.h"
-#include "block_dns.h"
-#include "gnunet_signatures.h"
-
-/* DEFINES */
-#define VERBOSE GNUNET_NO
-
-/* Timeout for entire testcase */
-#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 40)
-
-/* Timeout for waiting for replies to get requests */
-#define GET_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30)
-
-/* If number of peers not in config file, use this number */
-#define DEFAULT_NUM_PEERS 2
-
-#define DNS GNUNET_NO
-
-/* Globals */
-
-/**
- * Directory to store temp data in, defined in config file
- */
-static char *test_directory;
-
-/**
- * Variable used to store the number of connections we should wait for.
- */
-static unsigned int expected_connections;
-
-/**
- * Variable used to keep track of how many peers aren't yet started.
- */
-static unsigned long long peers_left;
-
-/**
- * Handle to the set of all peers run for this test.
- */
-static struct GNUNET_TESTING_PeerGroup *pg;
-
-/**
- * Global handle we will use for GET requests.
- */
-struct GNUNET_DHT_GetHandle *global_get_handle;
-
-
-/**
- * Total number of peers to run, set based on config file.
- */
-static unsigned long long num_peers;
-
-/**
- * Global used to count how many connections we have currently
- * been notified about (how many times has topology_callback been called
- * with success?)
- */
-static unsigned int total_connections;
-
-/**
- * Global used to count how many failed connections we have
- * been notified about (how many times has topology_callback
- * been called with failure?)
- */
-static unsigned int failed_connections;
-
-/* Task handle to use to schedule test failure */
-GNUNET_SCHEDULER_TaskIdentifier die_task;
-
-/* Global return value (0 for success, anything else for failure) */
-static int ok;
-
-#if DNS
-struct GNUNET_DNS_Record data;
-#endif
-
-/**
- * Peer identity of the first peer started.
- */
-static struct GNUNET_PeerIdentity peer1id;
-
-/**
- * Peer identity of the second peer started.
- */
-static struct GNUNET_PeerIdentity peer2id;
-
-/**
- * Handle to the first peers DHT service (via the API)
- */
-static struct GNUNET_DHT_Handle *peer1dht;
-
-/**
- * Handle to the second peers DHT service (via the API)
- */
-static struct GNUNET_DHT_Handle *peer2dht;
-
-static void
-do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
-
-/**
- * Check whether peers successfully shut down.
- */
-void
-shutdown_callback (void *cls, const char *emsg)
-{
-  if (emsg != NULL)
-  {
-    if (ok == 0)
-      ok = 2;
-  }
-}
-
-/**
- * Function scheduled to be run on the successful completion of this
- * testcase.  Specifically, called when our get request completes.
- */
-static void
-finish_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  GNUNET_assert (pg != NULL);
-  GNUNET_assert (peer1dht != NULL);
-  GNUNET_assert (peer2dht != NULL);
-  GNUNET_DHT_disconnect (peer1dht);
-  GNUNET_DHT_disconnect (peer2dht);
-  GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
-  ok = 0;
-}
-
-/**
- * Continuation for the GNUNET_DHT_get_stop call, so that we don't shut
- * down the peers without freeing memory associated with GET request.
- */
-static void
-end_badly_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  if (peer1dht != NULL)
-    GNUNET_DHT_disconnect (peer1dht);
-
-  if (peer2dht != NULL)
-    GNUNET_DHT_disconnect (peer2dht);
-
-  if (pg != NULL)
-    GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
-}
-
-/**
- * Check if the get_handle is being used, if so stop the request.  Either
- * way, schedule the end_badly_cont function which actually shuts down the
- * test.
- */
-static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failing test with error: `%s'!\n",
-              (char *) cls);
-  if (global_get_handle != NULL)
-  {
-    GNUNET_DHT_get_stop (global_get_handle);
-    global_get_handle = NULL;
-  }
-  GNUNET_SCHEDULER_add_now (&end_badly_cont, NULL);
-  ok = 1;
-}
-
-/**
- * Iterator called if the GET request initiated returns a response.
- *
- * @param cls closure
- * @param exp when will this value expire
- * @param key key of the result
- * @param type type of the result
- * @param size number of bytes in data
- * @param data pointer to the result data
- */
-void
-get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
-                     const struct GNUNET_HashCode * key,
-                     const struct GNUNET_PeerIdentity *get_path,
-                     unsigned int get_path_size,
-                     const struct GNUNET_PeerIdentity *put_path,
-                     unsigned int put_path_size, enum GNUNET_BLOCK_Type type,
-                     size_t size, const void *result_data)
-{
-  struct GNUNET_HashCode original_key; /* Key data was stored data under */
-  char original_data[4];        /* Made up data that was stored */
-
-  memset (&original_key, 42, sizeof (struct GNUNET_HashCode)); /* Set the key 
to what it was set to previously */
-  memset (original_data, 43, sizeof (original_data));
-
-#if DNS
-  if ((sizeof (original_data) != size) ||
-      (0 != memcmp (&data.service_descriptor, key, sizeof (struct 
GNUNET_HashCode))) ||
-      (0 != memcmp ((char *) &data, result_data, sizeof (original_data))))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Key or data is not the same as was inserted!\n");
-    GNUNET_SCHEDULER_cancel (die_task);
-    GNUNET_SCHEDULER_add_now (&end_badly,
-                              "key or data mismatch in get response!\n");
-    return;
-  }
-#else
-  if ((sizeof (original_data) != size) ||
-      (0 != memcmp (&original_key, key, sizeof (struct GNUNET_HashCode))) ||
-      (0 != memcmp (original_data, result_data, sizeof (original_data))))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Key or data is not the same as was inserted!\n");
-    GNUNET_SCHEDULER_cancel (die_task);
-    GNUNET_SCHEDULER_add_now (&end_badly,
-                              "key or data mismatch in get response!\n");
-    return;
-  }
-#endif
-
-  GNUNET_SCHEDULER_cancel (die_task);
-  GNUNET_DHT_get_stop (global_get_handle);
-  GNUNET_SCHEDULER_add_now (&finish_testing, NULL);
-}
-
-/**
- * Start the GET request for the same key/data that was inserted.
- */
-static void
-do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  struct GNUNET_HashCode key;          /* Key for data lookup */
-
-#if DNS
-  memcpy (&key, &data.service_descriptor, sizeof (struct GNUNET_HashCode));
-#else
-  memset (&key, 42, sizeof (struct GNUNET_HashCode));  /* Set the key to the 
same thing as when data was inserted */
-#endif
-  global_get_handle =
-      GNUNET_DHT_get_start (peer2dht, 
-#if DNS
-                            GNUNET_BLOCK_TYPE_DNS,
-#else
-                            GNUNET_BLOCK_TYPE_TEST,
-#endif
-                            &key, 1, GNUNET_DHT_RO_NONE, NULL, 0,
-                            &get_result_iterator, NULL);
-  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
-                                (GNUNET_TIME_UNIT_SECONDS, 10), &do_put, NULL);
-}
-
-/**
- * Called when the PUT request has been transmitted to the DHT service.
- * Schedule the GET request for some time in the future.
- */
-static void
-put_finished (void *cls, int success)
-{
-  GNUNET_SCHEDULER_cancel (die_task);
-  die_task =
-      GNUNET_SCHEDULER_add_delayed (GET_TIMEOUT, &end_badly,
-                                    "waiting for get response (data not 
found)");
-}
-
-
-#if !DNS
-/**
- * Set up some data, and call API PUT function
- */
-static void
-do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  struct GNUNET_HashCode key;          /* Made up key to store data under */
-  char data[4];                 /* Made up data to store */
-
-  memset (&key, 42, sizeof (struct GNUNET_HashCode));  /* Set the key to 
something simple so we can issue GET request */
-  memset (data, 43, sizeof (data));
-
-  /* Insert the data at the first peer */
-  GNUNET_DHT_put (peer1dht, &key, 1, GNUNET_DHT_RO_NONE, 
GNUNET_BLOCK_TYPE_TEST,
-                  sizeof (data), data, GNUNET_TIME_UNIT_FOREVER_ABS,
-                  GNUNET_TIME_UNIT_FOREVER_REL, &put_finished, NULL);
-}
-#else
-
-/**
- * Set up some data, and call API PUT function
- */
-static void
-do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  char *name = "philipptoelke.gnunet.";
-  size_t size = sizeof (struct GNUNET_DNS_Record);
-
-  memset (&data, 0, size);
-
-  data.purpose.size = htonl (size - sizeof (struct 
GNUNET_CRYPTO_RsaSignature));
-  data.purpose.purpose = GNUNET_SIGNATURE_PURPOSE_DNS_RECORD;
-
-  GNUNET_CRYPTO_hash (name, strlen (name) + 1, &data.service_descriptor);
-
-  data.service_type = htonl (GNUNET_DNS_SERVICE_TYPE_UDP);
-  data.ports = htons (69);
-
-  char *keyfile;
-
-  GNUNET_asprintf (&keyfile, "/tmp/test_dns_data_key");
-  struct GNUNET_CRYPTO_RsaPrivateKey *my_private_key =
-      GNUNET_CRYPTO_rsa_key_create_from_file (keyfile);
-  GNUNET_free (keyfile);
-  GNUNET_assert (my_private_key != NULL);
-
-  GNUNET_CRYPTO_rsa_key_get_public (my_private_key, &data.peer);
-
-  data.expiration_time =
-      GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS);
-
-  /* Sign the block */
-  if (GNUNET_OK !=
-      GNUNET_CRYPTO_rsa_sign (my_private_key, &data.purpose, &data.signature))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "could not sign DNS_Record\n");
-    return;
-  }
-  GNUNET_CRYPTO_rsa_key_free (my_private_key);
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Putting with key %08x\n",
-              *((unsigned int *) &data.service_descriptor));
-
-  GNUNET_DHT_put (peer1dht, &data.service_descriptor, DEFAULT_PUT_REPLICATION,
-                  GNUNET_DHT_RO_NONE, GNUNET_BLOCK_TYPE_DNS, size,
-                  (char *) &data,
-                  GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS),
-                  GNUNET_TIME_UNIT_MINUTES, &put_finished, NULL);
-}
-#endif
-
-/**
- * This function is called whenever a connection attempt is finished between 
two of
- * the started peers (started with GNUNET_TESTING_daemons_start).  The total
- * number of times this function is called should equal the number returned
- * from the GNUNET_TESTING_connect_topology call.
- *
- * The emsg variable is NULL on success (peers connected), and non-NULL on
- * failure (peers failed to connect).
- */
-void
-topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
-                   const struct GNUNET_PeerIdentity *second, uint32_t distance,
-                   const struct GNUNET_CONFIGURATION_Handle *first_cfg,
-                   const struct GNUNET_CONFIGURATION_Handle *second_cfg,
-                   struct GNUNET_TESTING_Daemon *first_daemon,
-                   struct GNUNET_TESTING_Daemon *second_daemon,
-                   const char *emsg)
-{
-  if (emsg == NULL)
-  {
-    total_connections++;
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "connected peer %s to peer %s, distance %u\n",
-                first_daemon->shortname, second_daemon->shortname, distance);
-  }
-  else
-  {
-    failed_connections++;
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Failed to connect peer %s to peer %s with error :\n%s\n",
-                first_daemon->shortname, second_daemon->shortname, emsg);
-  }
-
-  if (total_connections == expected_connections)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Created %d total connections, which is our target number!  
Starting next phase of testing.\n",
-                total_connections);
-    GNUNET_SCHEDULER_cancel (die_task);
-    die_task =
-        GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, "from test gets");
-
-    GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
-                                  (GNUNET_TIME_UNIT_SECONDS, 2), &do_get, 
NULL);
-  }
-  else if (total_connections + failed_connections == expected_connections)
-  {
-    GNUNET_SCHEDULER_cancel (die_task);
-    die_task =
-        GNUNET_SCHEDULER_add_now (&end_badly,
-                                  "from topology_callback (too many failed 
connections)");
-  }
-}
-
-
-/**
- * Callback which is called whenever a peer is started (as a result of the
- * GNUNET_TESTING_daemons_start call.
- *
- * @param cls closure argument given to GNUNET_TESTING_daemons_start
- * @param id the GNUNET_PeerIdentity of the started peer
- * @param cfg the configuration for this specific peer (needed to connect
- *            to the DHT)
- * @param d the handle to the daemon started
- * @param emsg NULL if peer started, non-NULL on error
- */
-static void
-peers_started_callback (void *cls, const struct GNUNET_PeerIdentity *id,
-                        const struct GNUNET_CONFIGURATION_Handle *cfg,
-                        struct GNUNET_TESTING_Daemon *d, const char *emsg)
-{
-  if (emsg != NULL)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Failed to start daemon with error: `%s'\n", emsg);
-    return;
-  }
-  GNUNET_assert (id != NULL);
-
-  /* This is the first peer started */
-  if (peers_left == num_peers)
-  {
-    memcpy (&peer1id, id, sizeof (struct GNUNET_PeerIdentity)); /* Save the 
peer id */
-    peer1dht = GNUNET_DHT_connect (cfg, 100);   /* Connect to the first peers 
DHT service */
-    if (peer1dht == NULL)       /* If DHT connect failed */
-    {
-      GNUNET_SCHEDULER_cancel (die_task);
-      GNUNET_SCHEDULER_add_now (&end_badly, "Failed to get dht handle!\n");
-    }
-  }
-  else                          /* This is the second peer started */
-  {
-    memcpy (&peer2id, id, sizeof (struct GNUNET_PeerIdentity)); /* Same as for 
first peer... */
-    peer2dht = GNUNET_DHT_connect (cfg, 100);
-    if (peer2dht == NULL)
-    {
-      GNUNET_SCHEDULER_cancel (die_task);
-      GNUNET_SCHEDULER_add_now (&end_badly, "Failed to get dht handle!\n");
-    }
-  }
-
-  /* Decrement number of peers left to start */
-  peers_left--;
-
-  if (peers_left == 0)          /* Indicates all peers started */
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "All %d daemons started, now connecting peers!\n", num_peers);
-    expected_connections = -1;
-    if ((pg != NULL))           /* Sanity check */
-    {
-      /* Connect peers in a "straight line" topology, return the number of 
expected connections */
-      expected_connections =
-          GNUNET_TESTING_connect_topology (pg, GNUNET_TESTING_TOPOLOGY_LINE,
-                                           GNUNET_TESTING_TOPOLOGY_OPTION_ALL,
-                                           0.0, TIMEOUT, 12, NULL, NULL);
-    }
-
-    /* Cancel current timeout fail task */
-    GNUNET_SCHEDULER_cancel (die_task);
-    if (expected_connections == GNUNET_SYSERR)  /* Some error happened */
-      die_task =
-          GNUNET_SCHEDULER_add_now (&end_badly,
-                                    "from connect topology (bad return)");
-
-    /* Schedule timeout on failure task */
-    die_task =
-        GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
-                                      "from connect topology (timeout)");
-    ok = 0;
-  }
-}
-
-static void
-run (void *cls, char *const *args, const char *cfgfile,
-     const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-
-  /* Get path from configuration file */
-  if (GNUNET_YES !=
-      GNUNET_CONFIGURATION_get_value_string (cfg, "paths", "servicehome",
-                                             &test_directory))
-  {
-    ok = 404;
-    return;
-  }
-
-  /* Get number of peers to start from configuration (should be two) */
-  if (GNUNET_SYSERR ==
-      GNUNET_CONFIGURATION_get_value_number (cfg, "testing_old", "num_peers",
-                                             &num_peers))
-    num_peers = DEFAULT_NUM_PEERS;
-
-  /* Set peers_left so we know when all peers started */
-  peers_left = num_peers;
-
-  /* Set up a task to end testing if peer start fails */
-  die_task =
-      GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
-                                    "didn't start all daemons in reasonable 
amount of time!!!");
-
-  /* Start num_peers peers, call peers_started_callback on peer start, 
topology_callback on peer connect */
-  /* Read the API documentation for other parameters! */
-  pg = GNUNET_TESTING_daemons_start (cfg, num_peers, 2, 2, TIMEOUT, NULL, NULL,
-                                     &peers_started_callback, NULL,
-                                     &topology_callback, NULL, NULL);
-
-}
-
-static int
-check ()
-{
-  int ret;
-
-  /* Arguments for GNUNET_PROGRAM_run */
-  char *const argv[] = { "test-dht-twopeer-get-put",    /* Name to give 
running binary */
-    "-c",
-    "test_dht_twopeer_data.conf",       /* Config file to use */
-    NULL
-  };
-  struct GNUNET_GETOPT_CommandLineOption options[] = {
-    GNUNET_GETOPT_OPTION_END
-  };
-  /* Run the run function as a new program */
-  ret =
-      GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
-                          "test-dht-twopeer-get-put", "nohelp", options, &run,
-                          &ok);
-  if (ret != GNUNET_OK)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "`test-dht-twopeer': Failed with error code %d\n", ret);
-  }
-  return ok;
-}
-
-int
-main (int argc, char *argv[])
-{
-  int ret;
-
-  GNUNET_log_setup ("test-dht-twopeer",
-                    "WARNING",
-                    NULL);
-  ret = check ();
-  /**
-   * Need to remove base directory, subdirectories taken care
-   * of by the testing framework.
-   */
-  if (GNUNET_DISK_directory_remove (test_directory) != GNUNET_OK)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Failed to remove testing directory %s\n", test_directory);
-  }
-  return ret;
-}
-
-/* end of test_dht_twopeer_get_put.c */

Deleted: gnunet/src/dht/test_dht_twopeer_path_tracking.c
===================================================================
--- gnunet/src/dht/test_dht_twopeer_path_tracking.c     2012-11-02 10:18:43 UTC 
(rev 24675)
+++ gnunet/src/dht/test_dht_twopeer_path_tracking.c     2012-11-02 10:19:00 UTC 
(rev 24676)
@@ -1,522 +0,0 @@
-/*
-     This file is part of GNUnet.
-     (C) 2009 Christian Grothoff (and other contributing authors)
-
-     GNUnet is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 3, or (at your
-     option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
-
-     You should have received a copy of the GNU General Public License
-     along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
-*/
-/**
- * @file dht/test_dht_twopeer_path_tracking.c
- * @brief testcase for testing DHT service with
- *        two running peers, logging the path of the dht requests.
- */
-#include "platform.h"
-#include "gnunet_testing_lib.h"
-#include "gnunet_core_service.h"
-#include "gnunet_dht_service.h"
-
-/* DEFINES */
-#define VERBOSE GNUNET_NO
-
-/* Timeout for entire testcase */
-#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 5)
-
-/* Timeout for waiting for replies to get requests */
-#define GET_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30)
-
-/* If number of peers not in config file, use this number */
-#define DEFAULT_NUM_PEERS 2
-
-/* Globals */
-
-/**
- * Directory to store temp data in, defined in config file
- */
-static char *test_directory;
-
-/**
- * Variable used to store the number of connections we should wait for.
- */
-static unsigned int expected_connections;
-
-/**
- * Variable used to keep track of how many peers aren't yet started.
- */
-static unsigned long long peers_left;
-
-/**
- * Handle to the set of all peers run for this test.
- */
-static struct GNUNET_TESTING_PeerGroup *pg;
-
-/**
- * Global handle we will use for GET requests.
- */
-struct GNUNET_DHT_GetHandle *global_get_handle;
-
-
-/**
- * Total number of peers to run, set based on config file.
- */
-static unsigned long long num_peers;
-
-/**
- * Global used to count how many connections we have currently
- * been notified about (how many times has topology_callback been called
- * with success?)
- */
-static unsigned int total_connections;
-
-/**
- * Global used to count how many failed connections we have
- * been notified about (how many times has topology_callback
- * been called with failure?)
- */
-static unsigned int failed_connections;
-
-/**
- * Task handle to use to schedule test failure
- */
-GNUNET_SCHEDULER_TaskIdentifier die_task;
-
-/**
- * Global return value (0 for success, anything else for failure)
- */
-static int ok;
-
-/**
- * Peer identity of the first peer started.
- */
-static struct GNUNET_PeerIdentity peer1id;
-
-/**
- * Peer identity of the second peer started.
- */
-static struct GNUNET_PeerIdentity peer2id;
-
-/**
- * Handle to the first peers DHT service (via the API)
- */
-static struct GNUNET_DHT_Handle *peer1dht;
-
-/**
- * Handle to the second peers DHT service (via the API)
- */
-static struct GNUNET_DHT_Handle *peer2dht;
-
-/**
- * Check whether peers successfully shut down.
- */
-void
-shutdown_callback (void *cls, const char *emsg)
-{
-  if (emsg != NULL)
-  {
-    if (ok == 0)
-      ok = 2;
-  }
-}
-
-/**
- * Function scheduled to be run on the successful completion of this
- * testcase.  Specifically, called when our get request completes.
- */
-static void
-finish_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  GNUNET_assert (pg != NULL);
-  GNUNET_assert (peer1dht != NULL);
-  GNUNET_assert (peer2dht != NULL);
-  GNUNET_DHT_disconnect (peer1dht);
-  GNUNET_DHT_disconnect (peer2dht);
-  GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
-  ok = 0;
-}
-
-/**
- * Continuation for the GNUNET_DHT_get_stop call, so that we don't shut
- * down the peers without freeing memory associated with GET request.
- */
-static void
-end_badly_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  if (peer1dht != NULL)
-    GNUNET_DHT_disconnect (peer1dht);
-
-  if (peer2dht != NULL)
-    GNUNET_DHT_disconnect (peer2dht);
-
-  if (pg != NULL)
-    GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
-}
-
-/**
- * Check if the get_handle is being used, if so stop the request.  Either
- * way, schedule the end_badly_cont function which actually shuts down the
- * test.
- */
-static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failing test with error: `%s'!\n",
-              (char *) cls);
-  if (global_get_handle != NULL)
-  {
-    GNUNET_DHT_get_stop (global_get_handle);
-    global_get_handle = NULL;
-  }
-  GNUNET_SCHEDULER_add_now (&end_badly_cont, NULL);
-  ok = 1;
-}
-
-/**
- * Iterator called if the GET request initiated returns a response.
- *
- * @param cls closure
- * @param exp when will this value expire
- * @param key key of the result
- * @param type type of the result
- * @param size number of bytes in data
- * @param data pointer to the result data
- */
-static void
-get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
-                     const struct GNUNET_HashCode * key,
-                     const struct GNUNET_PeerIdentity *get_path,
-                     unsigned int get_path_length,
-                     const struct GNUNET_PeerIdentity *put_path,
-                     unsigned int put_path_length, enum GNUNET_BLOCK_Type type,
-                     size_t size, const void *data)
-{
-  struct GNUNET_HashCode original_key; /* Key data was stored data under */
-  char original_data[4];        /* Made up data that was stored */
-
-  memset (&original_key, 42, sizeof (struct GNUNET_HashCode)); /* Set the key 
to what it was set to previously */
-  memset (original_data, 43, sizeof (original_data));
-#if VERBOSE
-  unsigned int i;
-#endif
-
-  if ((0 != memcmp (&original_key, key, sizeof (struct GNUNET_HashCode))) ||
-      (0 != memcmp (original_data, data, sizeof (original_data))))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Key or data is not the same as was inserted!\n");
-    GNUNET_SCHEDULER_cancel (die_task);
-    GNUNET_SCHEDULER_add_now (&end_badly,
-                              "key or data mismatch in get response!\n");
-    return;
-  }
-
-#if VERBOSE
-  if (put_path != NULL)
-  {
-    FPRINTF (stderr, "%s",  "PUT Path: ");
-    for (i = 0; i < put_path_length; i++)
-      FPRINTF (stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s (&put_path[i]));
-    FPRINTF (stderr, "%s",  "\n");
-  }
-  if (get_path != NULL)
-  {
-    FPRINTF (stderr, "%s",  "GET Path: ");
-    for (i = 0; i < get_path_length; i++)
-      FPRINTF (stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s (&get_path[i]));
-    FPRINTF (stderr, "%s",  "\n");
-  }
-#endif
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received correct GET response!\n");
-  GNUNET_SCHEDULER_cancel (die_task);
-  GNUNET_DHT_get_stop (global_get_handle);
-  GNUNET_SCHEDULER_add_now (&finish_testing, NULL);
-}
-
-
-/**
- * Called when the PUT request has been transmitted to the DHT service.
- * Schedule the GET request for some time in the future.
- */
-static void
-put_finished (void *cls, int success)
-{
-  struct GNUNET_HashCode key;          /* Key for data lookup */
-
-  GNUNET_SCHEDULER_cancel (die_task);
-  die_task =
-      GNUNET_SCHEDULER_add_delayed (GET_TIMEOUT, &end_badly,
-                                    "waiting for get response (data not 
found)");
-  memset (&key, 42, sizeof (struct GNUNET_HashCode));  /* Set the key to the 
same thing as when data was inserted */
-  global_get_handle =
-      GNUNET_DHT_get_start (peer2dht, 
-                            GNUNET_BLOCK_TYPE_TEST, &key, 1,
-                            GNUNET_DHT_RO_RECORD_ROUTE, NULL, 0,
-                            &get_result_iterator, NULL);
-}
-
-/**
- * Set up some data, and call API PUT function
- */
-static void
-do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  struct GNUNET_HashCode key;          /* Made up key to store data under */
-  char data[4];                 /* Made up data to store */
-
-  memset (&key, 42, sizeof (struct GNUNET_HashCode));  /* Set the key to 
something simple so we can issue GET request */
-  memset (data, 43, sizeof (data));
-
-  /* Insert the data at the first peer */
-  GNUNET_DHT_put (peer1dht, &key, 1, GNUNET_DHT_RO_RECORD_ROUTE,
-                  GNUNET_BLOCK_TYPE_TEST, sizeof (data), data,
-                  GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_UNIT_FOREVER_REL,
-                  &put_finished, NULL);
-}
-
-/**
- * This function is called whenever a connection attempt is finished between 
two of
- * the started peers (started with GNUNET_TESTING_daemons_start).  The total
- * number of times this function is called should equal the number returned
- * from the GNUNET_TESTING_connect_topology call.
- *
- * The emsg variable is NULL on success (peers connected), and non-NULL on
- * failure (peers failed to connect).
- */
-static void
-topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
-                   const struct GNUNET_PeerIdentity *second, uint32_t distance,
-                   const struct GNUNET_CONFIGURATION_Handle *first_cfg,
-                   const struct GNUNET_CONFIGURATION_Handle *second_cfg,
-                   struct GNUNET_TESTING_Daemon *first_daemon,
-                   struct GNUNET_TESTING_Daemon *second_daemon,
-                   const char *emsg)
-{
-  if (emsg == NULL)
-  {
-    total_connections++;
-#if VERBOSE
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "connected peer %s to peer %s, distance %u\n",
-                first_daemon->shortname, second_daemon->shortname, distance);
-#endif
-  }
-#if VERBOSE
-  else
-  {
-    failed_connections++;
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Failed to connect peer %s to peer %s with error :\n%s\n",
-                first_daemon->shortname, second_daemon->shortname, emsg);
-  }
-#endif
-
-  if (total_connections == expected_connections)
-  {
-#if VERBOSE
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Created %d total connections, which is our target number!  
Starting next phase of testing.\n",
-                total_connections);
-#endif
-    GNUNET_SCHEDULER_cancel (die_task);
-    die_task =
-        GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, "from test gets");
-
-    GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
-                                  (GNUNET_TIME_UNIT_SECONDS, 2), &do_put, 
NULL);
-  }
-  else if (total_connections + failed_connections == expected_connections)
-  {
-    GNUNET_SCHEDULER_cancel (die_task);
-    die_task =
-        GNUNET_SCHEDULER_add_now (&end_badly,
-                                  "from topology_callback (too many failed 
connections)");
-  }
-}
-
-
-/**
- * Callback which is called whenever a peer is started (as a result of the
- * GNUNET_TESTING_daemons_start call.
- *
- * @param cls closure argument given to GNUNET_TESTING_daemons_start
- * @param id the GNUNET_PeerIdentity of the started peer
- * @param cfg the configuration for this specific peer (needed to connect
- *            to the DHT)
- * @param d the handle to the daemon started
- * @param emsg NULL if peer started, non-NULL on error
- */
-static void
-peers_started_callback (void *cls, const struct GNUNET_PeerIdentity *id,
-                        const struct GNUNET_CONFIGURATION_Handle *cfg,
-                        struct GNUNET_TESTING_Daemon *d, const char *emsg)
-{
-  if (emsg != NULL)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Failed to start daemon with error: `%s'\n", emsg);
-    return;
-  }
-  GNUNET_assert (id != NULL);
-
-  /* This is the first peer started */
-  if (peers_left == num_peers)
-  {
-    memcpy (&peer1id, id, sizeof (struct GNUNET_PeerIdentity)); /* Save the 
peer id */
-    peer1dht = GNUNET_DHT_connect (cfg, 100);   /* Connect to the first peers 
DHT service */
-    if (peer1dht == NULL)       /* If DHT connect failed */
-    {
-      GNUNET_SCHEDULER_cancel (die_task);
-      GNUNET_SCHEDULER_add_now (&end_badly, "Failed to get dht handle!\n");
-    }
-  }
-  else                          /* This is the second peer started */
-  {
-    memcpy (&peer2id, id, sizeof (struct GNUNET_PeerIdentity)); /* Same as for 
first peer... */
-    peer2dht = GNUNET_DHT_connect (cfg, 100);
-    if (peer2dht == NULL)
-    {
-      GNUNET_SCHEDULER_cancel (die_task);
-      GNUNET_SCHEDULER_add_now (&end_badly, "Failed to get dht handle!\n");
-    }
-  }
-
-  /* Decrement number of peers left to start */
-  peers_left--;
-
-  if (peers_left == 0)          /* Indicates all peers started */
-  {
-#if VERBOSE
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "All %d daemons started, now connecting peers!\n", num_peers);
-#endif
-    expected_connections = -1;
-    if ((pg != NULL))           /* Sanity check */
-    {
-      /* Connect peers in a "straight line" topology, return the number of 
expected connections */
-      expected_connections =
-          GNUNET_TESTING_connect_topology (pg, GNUNET_TESTING_TOPOLOGY_LINE,
-                                           GNUNET_TESTING_TOPOLOGY_OPTION_ALL,
-                                           0.0, TIMEOUT, 2, NULL, NULL);
-    }
-
-    /* Cancel current timeout fail task */
-    GNUNET_SCHEDULER_cancel (die_task);
-    if (expected_connections == GNUNET_SYSERR)  /* Some error happened */
-      die_task =
-          GNUNET_SCHEDULER_add_now (&end_badly,
-                                    "from connect topology (bad return)");
-
-    /* Schedule timeout on failure task */
-    die_task =
-        GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
-                                      "from connect topology (timeout)");
-    ok = 0;
-  }
-}
-
-static void
-run (void *cls, char *const *args, const char *cfgfile,
-     const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-
-  /* Get path from configuration file */
-  if (GNUNET_YES !=
-      GNUNET_CONFIGURATION_get_value_string (cfg, "paths", "servicehome",
-                                             &test_directory))
-  {
-    ok = 404;
-    return;
-  }
-
-  /* Get number of peers to start from configuration (should be two) */
-  if (GNUNET_SYSERR ==
-      GNUNET_CONFIGURATION_get_value_number (cfg, "testing_old", "num_peers",
-                                             &num_peers))
-    num_peers = DEFAULT_NUM_PEERS;
-
-  /* Set peers_left so we know when all peers started */
-  peers_left = num_peers;
-
-  /* Set up a task to end testing if peer start fails */
-  die_task =
-      GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
-                                    "didn't start all daemons in reasonable 
amount of time!!!");
-
-  /* Start num_peers peers, call peers_started_callback on peer start, 
topology_callback on peer connect */
-  /* Read the API documentation for other parameters! */
-  pg = GNUNET_TESTING_daemons_start (cfg, peers_left,   /* Total number of 
peers */
-                                     peers_left,        /* Number of 
outstanding connections */
-                                     peers_left,        /* Number of parallel 
ssh connections, or peers being started at once */
-                                     TIMEOUT, NULL, NULL,
-                                     &peers_started_callback, NULL,
-                                     &topology_callback, NULL, NULL);
-
-}
-
-static int
-check ()
-{
-  int ret;
-
-  /* Arguments for GNUNET_PROGRAM_run */
-  char *const argv[] = { "test-dht-twopeer-put-get",    /* Name to give 
running binary */
-    "-c",
-    "test_dht_twopeer_data.conf",       /* Config file to use */
-#if VERBOSE
-    "-L", "DEBUG",
-#endif
-    NULL
-  };
-  struct GNUNET_GETOPT_CommandLineOption options[] = {
-    GNUNET_GETOPT_OPTION_END
-  };
-  /* Run the run function as a new program */
-  ret =
-      GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
-                          "test-dht-twopeer-put-get", "nohelp", options, &run,
-                          &ok);
-  if (ret != GNUNET_OK)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "`test-dht-twopeer': Failed with error code %d\n", ret);
-  }
-  return ok;
-}
-
-int
-main (int argc, char *argv[])
-{
-  int ret;
-
-  GNUNET_log_setup ("test-dht-twopeer",
-#if VERBOSE
-                    "DEBUG",
-#else
-                    "WARNING",
-#endif
-                    NULL);
-  ret = check ();
-  /**
-   * Need to remove base directory, subdirectories taken care
-   * of by the testing framework.
-   */
-  if (GNUNET_DISK_directory_remove (test_directory) != GNUNET_OK)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Failed to remove testing directory %s\n", test_directory);
-  }
-  return ret;
-}
-
-/* end of test_dht_twopeer_put_get.c */

Deleted: gnunet/src/dht/test_dht_twopeer_put_get.c
===================================================================
--- gnunet/src/dht/test_dht_twopeer_put_get.c   2012-11-02 10:18:43 UTC (rev 
24675)
+++ gnunet/src/dht/test_dht_twopeer_put_get.c   2012-11-02 10:19:00 UTC (rev 
24676)
@@ -1,510 +0,0 @@
-/*
-     This file is part of GNUnet.
-     (C) 2009 Christian Grothoff (and other contributing authors)
-
-     GNUnet is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 3, or (at your
-     option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
-
-     You should have received a copy of the GNU General Public License
-     along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
-*/
-/**
- * @file dht/test_dht_twopeer_put_get.c
- * @brief base testcase for testing DHT service with
- *        two running peers.
- *
- * This testcase starts peers using the GNUNET_TESTING_daemons_start
- * function call.  On peer start, connects to the peers DHT service
- * by calling GNUNET_DHT_connected.  Once notified about all peers
- * being started (by the peers_started_callback function), calls
- * GNUNET_TESTING_connect_topology, which connects the peers in a
- * "straight line" topology.  On notification that all peers have
- * been properly connected, runs the do_put function to insert data
- * at the first peer.  Once the GNUNET_DHT_put function completes,
- * calls the do_get function which initiates a GNUNET_DHT_get from
- * the *second* peer.  If the GET is successful, schedules finish_testing
- * to stop the test and shut down peers.  If GET is unsuccessful
- * after GET_TIMEOUT seconds, prints an error message and shuts down
- * the peers.
- */
-#include "platform.h"
-#include "gnunet_testing_lib.h"
-#include "gnunet_core_service.h"
-#include "gnunet_dht_service.h"
-#include "block_dns.h"
-#include "gnunet_signatures.h"
-
-/* DEFINES */
-#define VERBOSE GNUNET_NO
-
-/* Timeout for entire testcase */
-#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 5)
-
-/* Timeout for waiting for replies to get requests */
-#define GET_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30)
-
-/* If number of peers not in config file, use this number */
-#define DEFAULT_NUM_PEERS 2
-
-/* Globals */
-
-/**
- * Directory to store temp data in, defined in config file
- */
-static char *test_directory;
-
-/**
- * Variable used to store the number of connections we should wait for.
- */
-static unsigned int expected_connections;
-
-/**
- * Variable used to keep track of how many peers aren't yet started.
- */
-static unsigned long long peers_left;
-
-/**
- * Handle to the set of all peers run for this test.
- */
-static struct GNUNET_TESTING_PeerGroup *pg;
-
-/**
- * Global handle we will use for GET requests.
- */
-struct GNUNET_DHT_GetHandle *global_get_handle;
-
-
-/**
- * Total number of peers to run, set based on config file.
- */
-static unsigned long long num_peers;
-
-/**
- * Global used to count how many connections we have currently
- * been notified about (how many times has topology_callback been called
- * with success?)
- */
-static unsigned int total_connections;
-
-/**
- * Global used to count how many failed connections we have
- * been notified about (how many times has topology_callback
- * been called with failure?)
- */
-static unsigned int failed_connections;
-
-/* Task handle to use to schedule test failure */
-static GNUNET_SCHEDULER_TaskIdentifier die_task;
-
-/* Global return value (0 for success, anything else for failure) */
-static int ok;
-
-/**
- * Peer identity of the first peer started.
- */
-static struct GNUNET_PeerIdentity peer1id;
-
-/**
- * Peer identity of the second peer started.
- */
-static struct GNUNET_PeerIdentity peer2id;
-
-/**
- * Handle to the first peers DHT service (via the API)
- */
-static struct GNUNET_DHT_Handle *peer1dht;
-
-/**
- * Handle to the second peers DHT service (via the API)
- */
-static struct GNUNET_DHT_Handle *peer2dht;
-
-/**
- * Handle for our PUT operation.
- */
-static struct GNUNET_DHT_PutHandle *put_op;
-
-
-/**
- * Check whether peers successfully shut down.
- */
-static void
-shutdown_callback (void *cls, const char *emsg)
-{
-  if (emsg != NULL)
-  {
-    if (ok == 0)
-      ok = 2;
-  }
-}
-
-/**
- * Function scheduled to be run on the successful completion of this
- * testcase.  Specifically, called when our get request completes.
- */
-static void
-finish_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  GNUNET_assert (pg != NULL);
-  GNUNET_assert (peer1dht != NULL);
-  GNUNET_assert (peer2dht != NULL);
-  GNUNET_DHT_disconnect (peer1dht);
-  GNUNET_DHT_disconnect (peer2dht);
-  GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
-  ok = 0;
-}
-
-/**
- * Continuation for the GNUNET_DHT_get_stop call, so that we don't shut
- * down the peers without freeing memory associated with GET request.
- */
-static void
-end_badly_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  if (NULL != put_op)
-  {
-    GNUNET_DHT_put_cancel (put_op);
-    put_op = NULL;
-  }
-  if (peer1dht != NULL)
-    GNUNET_DHT_disconnect (peer1dht);
-
-  if (peer2dht != NULL)
-    GNUNET_DHT_disconnect (peer2dht);
-
-  if (pg != NULL)
-    GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
-}
-
-
-/**
- * Check if the get_handle is being used, if so stop the request.  Either
- * way, schedule the end_badly_cont function which actually shuts down the
- * test.
- */
-static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failing test with error: `%s'!\n",
-              (char *) cls);
-  if (global_get_handle != NULL)
-  {
-    GNUNET_DHT_get_stop (global_get_handle);
-    global_get_handle = NULL;
-  }
-  GNUNET_SCHEDULER_add_now (&end_badly_cont, NULL);
-  ok = 1;
-}
-
-/**
- * Iterator called if the GET request initiated returns a response.
- *
- * @param cls closure
- * @param exp when will this value expire
- * @param key key of the result
- * @param type type of the result
- * @param size number of bytes in data
- * @param data pointer to the result data
- */
-static void
-get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
-                     const struct GNUNET_HashCode * key,
-                     const struct GNUNET_PeerIdentity *get_path,
-                     unsigned int get_path_size,
-                     const struct GNUNET_PeerIdentity *put_path,
-                     unsigned int put_path_size, enum GNUNET_BLOCK_Type type,
-                     size_t size, const void *result_data)
-{
-  struct GNUNET_HashCode original_key; /* Key data was stored data under */
-  char original_data[4];        /* Made up data that was stored */
-
-  memset (&original_key, 42, sizeof (struct GNUNET_HashCode)); /* Set the key 
to what it was set to previously */
-  memset (original_data, 43, sizeof (original_data));
-
-  if ((sizeof (original_data) != size) ||
-      (0 != memcmp (&original_key, key, sizeof (struct GNUNET_HashCode))) ||
-      (0 != memcmp (original_data, result_data, sizeof (original_data))))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Key or data is not the same as was inserted!\n");
-    GNUNET_SCHEDULER_cancel (die_task);
-    GNUNET_SCHEDULER_add_now (&end_badly,
-                              "key or data mismatch in get response!\n");
-    return;
-  }
-
-  GNUNET_SCHEDULER_cancel (die_task);
-  GNUNET_DHT_get_stop (global_get_handle);
-  global_get_handle = NULL;
-  GNUNET_SCHEDULER_add_now (&finish_testing, NULL);
-}
-
-
-/**
- * Called when the PUT request has been transmitted to the DHT service.
- * Schedule the GET request for some time in the future.
- */
-static void
-put_finished (void *cls, int success)
-{
-  struct GNUNET_HashCode key;          /* Key for data lookup */
-
-  put_op = NULL;
-  GNUNET_SCHEDULER_cancel (die_task);
-  die_task =
-      GNUNET_SCHEDULER_add_delayed (GET_TIMEOUT, &end_badly,
-                                    "waiting for get response (data not 
found)");
-
-  memset (&key, 42, sizeof (struct GNUNET_HashCode));  /* Set the key to the 
same thing as when data was inserted */
-  global_get_handle =
-      GNUNET_DHT_get_start (peer2dht, 
-                            GNUNET_BLOCK_TYPE_TEST, &key, 1, 
GNUNET_DHT_RO_NONE,
-                            NULL, 0, &get_result_iterator, NULL);
-}
-
-
-/**
- * Set up some data, and call API PUT function
- */
-static void
-do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  struct GNUNET_HashCode key;          /* Made up key to store data under */
-  char data[4];                 /* Made up data to store */
-
-  memset (&key, 42, sizeof (struct GNUNET_HashCode));  /* Set the key to 
something simple so we can issue GET request */
-  memset (data, 43, sizeof (data));
-
-  /* Insert the data at the first peer */
-  put_op = GNUNET_DHT_put (peer1dht, &key, 1, GNUNET_DHT_RO_NONE, 
GNUNET_BLOCK_TYPE_TEST,
-                          sizeof (data), data, GNUNET_TIME_UNIT_FOREVER_ABS,
-                          GNUNET_TIME_UNIT_FOREVER_REL, &put_finished, NULL);
-}
-
-
-/**
- * This function is called whenever a connection attempt is finished between 
two of
- * the started peers (started with GNUNET_TESTING_daemons_start).  The total
- * number of times this function is called should equal the number returned
- * from the GNUNET_TESTING_connect_topology call.
- *
- * The emsg variable is NULL on success (peers connected), and non-NULL on
- * failure (peers failed to connect).
- */
-static void
-topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
-                   const struct GNUNET_PeerIdentity *second, uint32_t distance,
-                   const struct GNUNET_CONFIGURATION_Handle *first_cfg,
-                   const struct GNUNET_CONFIGURATION_Handle *second_cfg,
-                   struct GNUNET_TESTING_Daemon *first_daemon,
-                   struct GNUNET_TESTING_Daemon *second_daemon,
-                   const char *emsg)
-{
-  if (emsg == NULL)
-  {
-    total_connections++;
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "connected peer %s to peer %s, distance %u\n",
-                first_daemon->shortname, second_daemon->shortname, distance);
-  }
-  else
-  {
-    failed_connections++;
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Failed to connect peer %s to peer %s with error :\n%s\n",
-                first_daemon->shortname, second_daemon->shortname, emsg);
-  }
-
-  if (total_connections == expected_connections)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Created %d total connections, which is our target number!  
Starting next phase of testing.\n",
-                total_connections);
-    GNUNET_SCHEDULER_cancel (die_task);
-    die_task =
-        GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, "from test gets");
-
-    GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_put, NULL);
-  }
-  else if (total_connections + failed_connections == expected_connections)
-  {
-    GNUNET_SCHEDULER_cancel (die_task);
-    die_task =
-        GNUNET_SCHEDULER_add_now (&end_badly,
-                                  "from topology_callback (too many failed 
connections)");
-  }
-}
-
-
-/**
- * Callback which is called whenever a peer is started (as a result of the
- * GNUNET_TESTING_daemons_start call.
- *
- * @param cls closure argument given to GNUNET_TESTING_daemons_start
- * @param id the GNUNET_PeerIdentity of the started peer
- * @param cfg the configuration for this specific peer (needed to connect
- *            to the DHT)
- * @param d the handle to the daemon started
- * @param emsg NULL if peer started, non-NULL on error
- */
-static void
-peers_started_callback (void *cls, const struct GNUNET_PeerIdentity *id,
-                        const struct GNUNET_CONFIGURATION_Handle *cfg,
-                        struct GNUNET_TESTING_Daemon *d, const char *emsg)
-{
-  if (emsg != NULL)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Failed to start daemon with error: `%s'\n", emsg);
-    return;
-  }
-  GNUNET_assert (id != NULL);
-
-  /* This is the first peer started */
-  if (peers_left == num_peers)
-  {
-    memcpy (&peer1id, id, sizeof (struct GNUNET_PeerIdentity)); /* Save the 
peer id */
-    peer1dht = GNUNET_DHT_connect (cfg, 100);   /* Connect to the first peers 
DHT service */
-    if (peer1dht == NULL)       /* If DHT connect failed */
-    {
-      GNUNET_SCHEDULER_cancel (die_task);
-      GNUNET_SCHEDULER_add_now (&end_badly, "Failed to get dht handle!\n");
-    }
-  }
-  else                          /* This is the second peer started */
-  {
-    memcpy (&peer2id, id, sizeof (struct GNUNET_PeerIdentity)); /* Same as for 
first peer... */
-    peer2dht = GNUNET_DHT_connect (cfg, 100);
-    if (peer2dht == NULL)
-    {
-      GNUNET_SCHEDULER_cancel (die_task);
-      GNUNET_SCHEDULER_add_now (&end_badly, "Failed to get dht handle!\n");
-    }
-  }
-
-  /* Decrement number of peers left to start */
-  peers_left--;
-
-  if (peers_left == 0)          /* Indicates all peers started */
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "All %d daemons started, now connecting peers!\n", num_peers);
-    expected_connections = -1;
-    if ((pg != NULL))           /* Sanity check */
-    {
-      /* Connect peers in a "straight line" topology, return the number of 
expected connections */
-      expected_connections =
-          GNUNET_TESTING_connect_topology (pg, GNUNET_TESTING_TOPOLOGY_LINE,
-                                           GNUNET_TESTING_TOPOLOGY_OPTION_ALL,
-                                           0.0, TIMEOUT, 12, NULL, NULL);
-    }
-
-    /* Cancel current timeout fail task */
-    GNUNET_SCHEDULER_cancel (die_task);
-    if (expected_connections == GNUNET_SYSERR)  /* Some error happened */
-      die_task =
-          GNUNET_SCHEDULER_add_now (&end_badly,
-                                    "from connect topology (bad return)");
-
-    /* Schedule timeout on failure task */
-    die_task =
-        GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
-                                      "from connect topology (timeout)");
-    ok = 0;
-  }
-}
-
-static void
-run (void *cls, char *const *args, const char *cfgfile,
-     const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-
-  /* Get path from configuration file */
-  if (GNUNET_YES !=
-      GNUNET_CONFIGURATION_get_value_string (cfg, "paths", "servicehome",
-                                             &test_directory))
-  {
-    ok = 404;
-    return;
-  }
-
-  /* Get number of peers to start from configuration (should be two) */
-  if (GNUNET_SYSERR ==
-      GNUNET_CONFIGURATION_get_value_number (cfg, "testing_old", "num_peers",
-                                             &num_peers))
-    num_peers = DEFAULT_NUM_PEERS;
-
-  /* Set peers_left so we know when all peers started */
-  peers_left = num_peers;
-
-  /* Set up a task to end testing if peer start fails */
-  die_task =
-      GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
-                                    "didn't start all daemons in reasonable 
amount of time!!!");
-
-  /* Start num_peers peers, call peers_started_callback on peer start, 
topology_callback on peer connect */
-  /* Read the API documentation for other parameters! */
-  pg = GNUNET_TESTING_daemons_start (cfg, num_peers, 2, 2, TIMEOUT, NULL, NULL,
-                                     &peers_started_callback, NULL,
-                                     &topology_callback, NULL, NULL);
-
-}
-
-static int
-check ()
-{
-  int ret;
-
-  /* Arguments for GNUNET_PROGRAM_run */
-  char *const argv[] = { "test-dht-twopeer-put-get",    /* Name to give 
running binary */
-    "-c",
-    "test_dht_twopeer_data.conf",       /* Config file to use */
-    NULL
-  };
-  struct GNUNET_GETOPT_CommandLineOption options[] = {
-    GNUNET_GETOPT_OPTION_END
-  };
-  /* Run the run function as a new program */
-  ret =
-      GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
-                          "test-dht-twopeer-put-get", "nohelp", options, &run,
-                          &ok);
-  if (ret != GNUNET_OK)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "`test-dht-twopeer': Failed with error code %d\n", ret);
-  }
-  return ok;
-}
-
-int
-main (int argc, char *argv[])
-{
-  int ret;
-
-  GNUNET_log_setup ("test-dht-twopeer",
-                    "WARNING",
-                    NULL);
-  ret = check ();
-  /**
-   * Need to remove base directory, subdirectories taken care
-   * of by the testing framework.
-   */
-  if (GNUNET_DISK_directory_remove (test_directory) != GNUNET_OK)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Failed to remove testing directory %s\n", test_directory);
-  }
-  return ret;
-}
-
-/* end of test_dht_twopeer_put_get.c */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]