gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r8799 - in gnunet/src: . testing


From: gnunet
Subject: [GNUnet-SVN] r8799 - in gnunet/src: . testing
Date: Mon, 27 Jul 2009 11:29:33 -0600

Author: grothoff
Date: 2009-07-27 11:29:33 -0600 (Mon, 27 Jul 2009)
New Revision: 8799

Added:
   gnunet/src/testing/testing_group.c
Modified:
   gnunet/src/Makefile.am
   gnunet/src/testing/Makefile.am
   gnunet/src/testing/testing.c
   gnunet/src/testing/testing_testbed.c
Log:
testing-update

Modified: gnunet/src/Makefile.am
===================================================================
--- gnunet/src/Makefile.am      2009-07-26 22:34:50 UTC (rev 8798)
+++ gnunet/src/Makefile.am      2009-07-27 17:29:33 UTC (rev 8799)
@@ -18,6 +18,7 @@
   statistics \
   datacache \
   datastore \
+  testing \
   template \
   transport \
   core \

Modified: gnunet/src/testing/Makefile.am
===================================================================
--- gnunet/src/testing/Makefile.am      2009-07-26 22:34:50 UTC (rev 8798)
+++ gnunet/src/testing/Makefile.am      2009-07-27 17:29:33 UTC (rev 8799)
@@ -13,6 +13,7 @@
 
 libgnunettesting_la_SOURCES = \
   testing.c  \
+  testing_group.c \
   testing_testbed.c 
 libgnunettesting_la_LIBADD = \
  $(top_builddir)/src/util/libgnunetutil.la $(XLIB)

Modified: gnunet/src/testing/testing.c
===================================================================
--- gnunet/src/testing/testing.c        2009-07-26 22:34:50 UTC (rev 8798)
+++ gnunet/src/testing/testing.c        2009-07-27 17:29:33 UTC (rev 8799)
@@ -43,28 +43,27 @@
 
 
 /**
- * Starts a GNUnet daemon.
+ * Starts a GNUnet daemon.  GNUnet must be installed on the target
+ * system and available in the PATH.  The machine must furthermore be
+ * reachable via "ssh" (unless the hostname is "NULL") without the
+ * need to enter a password.
  *
- * @param service_home directory to use as the service home directory
- * @param transports transport services that should be loaded
- * @param applications application services and daemons that should be started
- * @param port_offset offset to add to all ports for all services
+ * @param sched scheduler to use 
+ * @param cfg configuration to use
  * @param hostname name of the machine where to run GNUnet
  *        (use NULL for localhost).
  * @param cb function to call with the result
  * @param cb_cls closure for cb
+ * @return handle to the daemon (actual start will be completed asynchronously)
  */
-void
+struct GNUNET_TESTING_Daemon *
 GNUNET_TESTING_daemon_start (struct GNUNET_SCHEDULER_Handle *sched,
                             struct GNUNET_CONFIGURATION_Handle *cfg,
-                            const char *service_home,
-                            const char *transports,
-                            const char *applications,
-                            uint16_t port_offset,
                             const char *hostname,
                             GNUNET_TESTING_NotifyDaemonRunning cb,
                             void *cb_cls)
 {
+  return NULL;
 }
 
 
@@ -83,93 +82,45 @@
 
 
 /**
+ * Changes the configuration of a GNUnet daemon.
+ *
+ * @param d the daemon that should be modified
+ * @param cfg the new configuration for the daemon
+ * @param cb function called once the configuration was changed
+ * @param cb_cls closure for cb
+ */
+void GNUNET_TESTING_daemon_reconfigure (struct GNUNET_TESTING_Daemon *d,
+                                       const struct 
GNUNET_CONFIGURATION_Handle *cfg,
+                                       GNUNET_TESTING_NotifyCompletion cb,
+                                       void * cb_cls)
+{
+}
+
+
+/**
  * Establish a connection between two GNUnet daemons.
  *
  * @param d1 handle for the first daemon
  * @param d2 handle for the second daemon
+ * @param timeout how long is the connection attempt
+ *        allowed to take?
  * @param cb function to call at the end
  * @param cb_cls closure for cb
  */
 void GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1,
                                     struct GNUNET_TESTING_Daemon *d2,
+                                    struct GNUNET_TIME_Relative timeout,
                                     GNUNET_TESTING_NotifyCompletion cb,
                                     void *cb_cls)
 {
 }
 
 
-/**
- * Start count gnunetd processes with the same set of
- * transports and applications.  The port numbers will
- * be computed by adding delta each time (zero
- * times for the first peer).
- *
- * @param total number of daemons to start
- * @param service_home_prefix path to use as the prefix for the home of the 
services
- * @param transports which transports should all peers use
- * @param applications which applications should be used?
- * @param timeout how long is this allowed to take?
- * @param cb function to call on each daemon that was started
- * @param cb_cls closure for cb
- * @param cbe function to call at the end
- * @param cbe_cls closure for cbe
- * @param hostname where to run the peers; can be NULL (to run
- *        everything on localhost).
- * @param va Additional hosts can be specified using a NULL-terminated list of
- *        varargs, hosts will then be used round-robin from that
- *        list; va only contains anything if hostname != NULL.
- */
-void
-GNUNET_TESTING_daemons_start_va (struct GNUNET_SCHEDULER_Handle *sched,
-                                struct GNUNET_CONFIGURATION_Handle *cfg,
-                                unsigned int total,
-                                const char *service_home_prefix,
-                                const char *transports,
-                                const char *applications,
-                                GNUNET_TESTING_NotifyDaemonRunning cb,
-                                void *cb_cls,
-                                GNUNET_TESTING_NotifyCompletion cbe,
-                                void *cbe_cls,
-                                const char *hostname,
-                                va_list va)
-{
-}
 
 
-/**
- * Start count gnunetd processes with the same set of
- * transports and applications.  The port numbers will
- * be computed by adding delta each time (zero
- * times for the first peer).
- *
- * @param total number of daemons to start
- * @param service_home_prefix path to use as the prefix for the home of the 
services
- * @param transports which transports should all peers use
- * @param applications which applications should be used?
- * @param timeout how long is this allowed to take?
- * @param cb function to call on each daemon that was started
- * @param cb_cls closure for cb
- * @param cbe function to call at the end
- * @param cbe_cls closure for cbe
- * @param hostname where to run the peers; can be NULL (to run
- *        everything on localhost). Additional
- *        hosts can be specified using a NULL-terminated list of
- *        varargs, hosts will then be used round-robin from that
- *        list.
- */
-void
-GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched,
-                             struct GNUNET_CONFIGURATION_Handle *cfg,
-                             unsigned int total,
-                             const char *service_home_prefix,
-                             const char *transports,
-                             const char *applications,
-                             GNUNET_TESTING_NotifyDaemonRunning cb,
-                             void *cb_cls,
-                             GNUNET_TESTING_NotifyCompletion cbe,
-                             void *cbe_cls,
-                             const char *hostname,
-                             ...)
+
+/* end of testing.c */
+
 {
   va_list va;
   
@@ -181,5 +132,3 @@
                                   va);
   va_end (va);
 }
-
-/* end of testing.c */

Added: gnunet/src/testing/testing_group.c
===================================================================
--- gnunet/src/testing/testing_group.c                          (rev 0)
+++ gnunet/src/testing/testing_group.c  2009-07-27 17:29:33 UTC (rev 8799)
@@ -0,0 +1,124 @@
+/*
+      This file is part of GNUnet
+      (C) 2008, 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 2, 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 testing/testing_group.c
+ * @brief convenience API for writing testcases for GNUnet
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "gnunet_arm_service.h"
+#include "gnunet_testing_lib.h"
+
+
+/**
+ * Handle to a group of GNUnet peers.
+ */
+struct GNUNET_TESTING_PeerGroup
+{
+};
+
+
+/**
+ * Start count gnunetd processes with the same set of transports and
+ * applications.  The port numbers (any option called "PORT") will be
+ * adjusted to ensure that no two peers running on the same system
+ * have the same port(s) in their respective configurations.
+ *
+ * @param sched scheduler to use 
+ * @param cfg configuration template to use
+ * @param total number of daemons to start
+ * @param cb function to call on each daemon that was started
+ * @param cb_cls closure for cb
+ * @param hostname where to run the peers; can be NULL (to run
+ *        everything on localhost).
+ * @param va Additional hosts can be specified using a NULL-terminated list of
+ *        varargs, hosts will then be used round-robin from that
+ *        list; va only contains anything if hostname != NULL.
+ * @return NULL on error, otherwise handle to control peer group
+ */
+struct GNUNET_TESTING_PeerGroup *
+GNUNET_TESTING_daemons_start_va (struct GNUNET_SCHEDULER_Handle *sched,
+                                const struct GNUNET_CONFIGURATION_Handle *cfg,
+                                unsigned int total,
+                                GNUNET_TESTING_NotifyDaemonRunning cb,
+                                void *cb_cls,
+                                const char *hostname,
+                                va_list va)
+{
+  return NULL;
+}
+
+
+/**
+ * Start count gnunetd processes with the same set of
+ * transports and applications.  The port numbers will
+ * be computed by adding delta each time (zero
+ * times for the first peer).
+ *
+ * @param sched scheduler to use 
+ * @param cfg configuration template to use
+ * @param total number of daemons to start
+ * @param timeout how long is this allowed to take?
+ * @param cb function to call on each daemon that was started
+ * @param cb_cls closure for cb
+ * @param hostname where to run the peers; can be NULL (to run
+ *        everything on localhost). Additional
+ *        hosts can be specified using a NULL-terminated list of
+ *        varargs, hosts will then be used round-robin from that
+ *        list.
+ * @return NULL on error, otherwise handle to control peer group
+ */
+struct GNUNET_TESTING_PeerGroup *
+GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched,
+                             struct GNUNET_CONFIGURATION_Handle *cfg,
+                             unsigned int total,
+                             GNUNET_TESTING_NotifyDaemonRunning cb,
+                             void *cb_cls,
+                             const char *hostname,
+                             ...)
+
+{
+  va_list va;
+  
+  va_start (va, hostname);
+  GNUNET_TESTING_daemons_start_va (sched, cfg,
+                                  total, service_home_prefix,
+                                  transports, applications,
+                                  cb, cb_cls, cbe, cbe_cls, hostname,
+                                  va);
+  va_end (va);
+}
+
+
+
+/**
+ * Shutdown all peers started in the given group.
+ * 
+ * @param pg handle to the peer group
+ */
+void
+GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg)
+
+{
+}
+
+
+/* end of testing_group.c */

Modified: gnunet/src/testing/testing_testbed.c
===================================================================
--- gnunet/src/testing/testing_testbed.c        2009-07-26 22:34:50 UTC (rev 
8798)
+++ gnunet/src/testing/testing_testbed.c        2009-07-27 17:29:33 UTC (rev 
8799)
@@ -42,40 +42,32 @@
 
 
 /**
- * Start count GNUnet daemons with a particular
- * topology.
+ * Start "count" GNUnet daemons with a particular topology.
  *
- * @param size number of peers the testbed should have
+ * @param sched scheduler to use 
+ * @param cfg configuration template to use
+ * @param count number of peers the testbed should have
  * @param topology desired topology (enforced via F2F)
- * @param service_home_prefix path to use as the prefix for the home of the 
services
- * @param transports which transports should all peers use
- * @param applications which applications should be used?
- * @param timeout how long is this allowed to take?
  * @param cb function to call on each daemon that was started
  * @param cb_cls closure for cb
- * @param cte function to call at the end
- * @param cte_cls closure for cbe
  * @param hostname where to run the peers; can be NULL (to run
  *        everything on localhost). Additional
  *        hosts can be specified using a NULL-terminated list of
  *        varargs, hosts will then be used round-robin from that
  *        list.
+ * @return handle to control the testbed
  */
-void
+struct GNUNET_TESTING_Testbed *
 GNUNET_TESTING_testbed_start (struct GNUNET_SCHEDULER_Handle *sched,
-                             struct GNUNET_CONFIGURATION_Handle *cfg,
-                             unsigned int size,
+                             const struct GNUNET_CONFIGURATION_Handle *cfg,
+                             unsigned int count,
                              enum GNUNET_TESTING_Topology topology,
-                             const char *service_home_prefix,
-                             const char *transports,
-                             const char *applications,
                              GNUNET_TESTING_NotifyDaemonRunning cb,
                              void *cb_cls,
-                             GNUNET_TESTING_NotifyTestbedRunning cte,
-                             void *cte_cls,
                              const char *hostname,
                              ...)
 {
+  return NULL;
 }
 
 
@@ -83,13 +75,13 @@
  * Stop all of the daemons started with the start function.
  *
  * @param tb handle for the testbed
- * @param cb function to call at the end
+ * @param cb function to call when done
  * @param cb_cls closure for cb
  */
 void
 GNUNET_TESTING_testbed_stop (struct GNUNET_TESTING_Testbed *tb,
                             GNUNET_TESTING_NotifyCompletion cb,
-                            void *cb_cls )
+                            void *cb_cls)
 {
 }
 
@@ -122,3 +114,6 @@
                              void *cb_cls)
 {
 }
+
+
+/* end of testing_testbed.c */





reply via email to

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