gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] 01/02: drop 'new' suffix from tests


From: gnunet
Subject: [GNUnet-SVN] [gnunet] 01/02: drop 'new' suffix from tests
Date: Sat, 11 Mar 2017 13:15:29 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

commit c1ca3b26ef3dc26bb853505a87b49f9a9d654caf
Author: Christian Grothoff <address@hidden>
AuthorDate: Sat Mar 11 13:01:24 2017 +0100

    drop 'new' suffix from tests
---
 src/cadet/Makefile.am      | 119 +++++++++---------
 src/cadet/cadet_test_lib.c | 303 ---------------------------------------------
 src/cadet/cadet_test_lib.h | 106 ----------------
 3 files changed, 56 insertions(+), 472 deletions(-)

diff --git a/src/cadet/Makefile.am b/src/cadet/Makefile.am
index c33a653b0..d7208d601 100644
--- a/src/cadet/Makefile.am
+++ b/src/cadet/Makefile.am
@@ -86,37 +86,30 @@ endif
 
 
 if HAVE_TESTING
- noinst_LTLIBRARIES = libgnunetcadettest.la libgnunetcadettestnew.la 
$(noinst_LIB_EXP)
+ noinst_LTLIBRARIES = libgnunetcadettest.la $(noinst_LIB_EXP)
  noinst_PROGRAMS = gnunet-cadet-profiler
 endif
 
-libgnunetcadettest_la_SOURCES = \
-  cadet_test_lib.c cadet_test_lib.h
-libgnunetcadettest_la_LIBADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/testbed/libgnunettestbed.la \
- libgnunetcadet.la
-
 if HAVE_TESTING
 check_PROGRAMS = \
   test_cadet_local_mq \
-  test_cadet_2_forward_new \
-  test_cadet_2_forward_new \
-  test_cadet_2_signal_new \
-  test_cadet_2_keepalive_new \
-  test_cadet_2_speed_new \
-  test_cadet_2_speed_ack_new \
-  test_cadet_2_speed_backwards_new \
-  test_cadet_2_speed_reliable_new \
-  test_cadet_2_speed_reliable_backwards_new \
-  test_cadet_5_forward_new \
-  test_cadet_5_signal_new \
-  test_cadet_5_keepalive_new \
-  test_cadet_5_speed_new \
-  test_cadet_5_speed_ack_new \
-  test_cadet_5_speed_reliable_new \
-  test_cadet_5_speed_reliable_backwards_new \
-  test_cadet_5_speed_backwards_new
+  test_cadet_2_forward \
+  test_cadet_2_forward \
+  test_cadet_2_signal \
+  test_cadet_2_keepalive \
+  test_cadet_2_speed \
+  test_cadet_2_speed_ack \
+  test_cadet_2_speed_backwards \
+  test_cadet_2_speed_reliable \
+  test_cadet_2_speed_reliable_backwards \
+  test_cadet_5_forward \
+  test_cadet_5_signal \
+  test_cadet_5_keepalive \
+  test_cadet_5_speed \
+  test_cadet_5_speed_ack \
+  test_cadet_5_speed_reliable \
+  test_cadet_5_speed_reliable_backwards \
+  test_cadet_5_speed_backwards
 endif
 
 ld_cadet_test_lib = \
@@ -146,89 +139,89 @@ test_cadet_local_mq_LDADD = \
   $(top_builddir)/src/util/libgnunetutil.la
 
 
-libgnunetcadettestnew_la_SOURCES = \
+libgnunetcadettest_la_SOURCES = \
   cadet_test_lib_new.c cadet_test_lib_new.h
-libgnunetcadettestnew_la_LIBADD = \
+libgnunetcadettest_la_LIBADD = \
  $(top_builddir)/src/util/libgnunetutil.la \
  $(top_builddir)/src/testbed/libgnunettestbed.la \
  libgnunetcadetnew.la
 
-ld_cadet_test_lib_new = \
+ld_cadet_test_lib = \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
   libgnunetcadetnew.la \
-  libgnunetcadettestnew.la \
+  libgnunetcadettest.la \
   $(top_builddir)/src/testbed/libgnunettestbed.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la
-dep_cadet_test_lib_new = \
+dep_cadet_test_lib = \
   libgnunetcadetnew.la \
-  libgnunetcadettestnew.la \
+  libgnunetcadettest.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la
 
-test_cadet_2_forward_new_SOURCES = \
+test_cadet_2_forward_SOURCES = \
   test_cadet_new.c
-test_cadet_2_forward_new_LDADD = $(ld_cadet_test_lib_new)
+test_cadet_2_forward_LDADD = $(ld_cadet_test_lib)
 
-test_cadet_2_signal_new_SOURCES = \
+test_cadet_2_signal_SOURCES = \
   test_cadet_new.c
-test_cadet_2_signal_new_LDADD = $(ld_cadet_test_lib_new)
+test_cadet_2_signal_LDADD = $(ld_cadet_test_lib)
 
-test_cadet_2_keepalive_new_SOURCES = \
+test_cadet_2_keepalive_SOURCES = \
   test_cadet_new.c
-test_cadet_2_keepalive_new_LDADD = $(ld_cadet_test_lib_new)
+test_cadet_2_keepalive_LDADD = $(ld_cadet_test_lib)
 
-test_cadet_2_speed_new_SOURCES = \
+test_cadet_2_speed_SOURCES = \
   test_cadet_new.c
-test_cadet_2_speed_new_LDADD = $(ld_cadet_test_lib_new)
+test_cadet_2_speed_LDADD = $(ld_cadet_test_lib)
 
-test_cadet_2_speed_ack_new_SOURCES = \
+test_cadet_2_speed_ack_SOURCES = \
   test_cadet_new.c
-test_cadet_2_speed_ack_new_LDADD = $(ld_cadet_test_lib_new)
+test_cadet_2_speed_ack_LDADD = $(ld_cadet_test_lib)
 
-test_cadet_2_speed_backwards_new_SOURCES = \
+test_cadet_2_speed_backwards_SOURCES = \
   test_cadet_new.c
-test_cadet_2_speed_backwards_new_LDADD = $(ld_cadet_test_lib_new)
+test_cadet_2_speed_backwards_LDADD = $(ld_cadet_test_lib)
 
-test_cadet_2_speed_reliable_new_SOURCES = \
+test_cadet_2_speed_reliable_SOURCES = \
   test_cadet_new.c
-test_cadet_2_speed_reliable_new_LDADD = $(ld_cadet_test_lib_new)
+test_cadet_2_speed_reliable_LDADD = $(ld_cadet_test_lib)
 
-test_cadet_2_speed_reliable_backwards_new_SOURCES = \
+test_cadet_2_speed_reliable_backwards_SOURCES = \
   test_cadet_new.c
-test_cadet_2_speed_reliable_backwards_new_LDADD = $(ld_cadet_test_lib_new)
+test_cadet_2_speed_reliable_backwards_LDADD = $(ld_cadet_test_lib)
 
 
-test_cadet_5_forward_new_SOURCES = \
+test_cadet_5_forward_SOURCES = \
   test_cadet_new.c
-test_cadet_5_forward_new_LDADD = $(ld_cadet_test_lib_new)
+test_cadet_5_forward_LDADD = $(ld_cadet_test_lib)
 
-test_cadet_5_signal_new_SOURCES = \
+test_cadet_5_signal_SOURCES = \
   test_cadet_new.c
-test_cadet_5_signal_new_LDADD = $(ld_cadet_test_lib_new)
+test_cadet_5_signal_LDADD = $(ld_cadet_test_lib)
 
-test_cadet_5_keepalive_new_SOURCES = \
+test_cadet_5_keepalive_SOURCES = \
   test_cadet_new.c
-test_cadet_5_keepalive_new_LDADD = $(ld_cadet_test_lib_new)
+test_cadet_5_keepalive_LDADD = $(ld_cadet_test_lib)
 
-test_cadet_5_speed_new_SOURCES = \
+test_cadet_5_speed_SOURCES = \
   test_cadet_new.c
-test_cadet_5_speed_new_LDADD = $(ld_cadet_test_lib_new)
+test_cadet_5_speed_LDADD = $(ld_cadet_test_lib)
 
-test_cadet_5_speed_ack_new_SOURCES = \
+test_cadet_5_speed_ack_SOURCES = \
   test_cadet_new.c
-test_cadet_5_speed_ack_new_LDADD = $(ld_cadet_test_lib_new)
+test_cadet_5_speed_ack_LDADD = $(ld_cadet_test_lib)
 
-test_cadet_5_speed_backwards_new_SOURCES = \
+test_cadet_5_speed_backwards_SOURCES = \
   test_cadet_new.c
-test_cadet_5_speed_backwards_new_LDADD = $(ld_cadet_test_lib_new)
+test_cadet_5_speed_backwards_LDADD = $(ld_cadet_test_lib)
 
-test_cadet_5_speed_reliable_new_SOURCES = \
+test_cadet_5_speed_reliable_SOURCES = \
   test_cadet_new.c
-test_cadet_5_speed_reliable_new_LDADD = $(ld_cadet_test_lib_new)
+test_cadet_5_speed_reliable_LDADD = $(ld_cadet_test_lib)
 
-test_cadet_5_speed_reliable_backwards_new_SOURCES = \
+test_cadet_5_speed_reliable_backwards_SOURCES = \
   test_cadet_new.c
-test_cadet_5_speed_reliable_backwards_new_LDADD = $(ld_cadet_test_lib_new)
+test_cadet_5_speed_reliable_backwards_LDADD = $(ld_cadet_test_lib)
 
 
 if ENABLE_TEST_RUN
diff --git a/src/cadet/cadet_test_lib.c b/src/cadet/cadet_test_lib.c
deleted file mode 100644
index 9a70dad49..000000000
--- a/src/cadet/cadet_test_lib.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2012 GNUnet e.V.
-
-     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., 51 Franklin Street, Fifth Floor,
-     Boston, MA 02110-1301, USA.
-*/
-/**
- * @file cadet/cadet_test_lib.c
- * @author Bartlomiej Polot
- * @brief library for writing CADET tests
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "cadet_test_lib.h"
-#include "gnunet_cadet_service.h"
-
-/**
- * Test context for a CADET Test.
- */
-struct GNUNET_CADET_TEST_Context
-{
-  /**
-   * Array of running peers.
-   */
-  struct GNUNET_TESTBED_Peer **peers;
-
-  /**
-   * Array of handles to the CADET for each peer.
-   */
-  struct GNUNET_CADET_Handle **cadetes;
-
-  /**
-   * Operation associated with the connection to the CADET.
-   */
-  struct GNUNET_TESTBED_Operation **ops;
-
-  /**
-   * Main function of the test to run once all CADETs are available.
-   */
-  GNUNET_CADET_TEST_AppMain app_main;
-
-  /**
-   * Closure for 'app_main'.
-   */
-  void *app_main_cls;
-
-  /**
-   * Number of peers running, size of the arrays above.
-   */
-  unsigned int num_peers;
-
-  /**
-   * Handler for incoming tunnels.
-   */
-  GNUNET_CADET_InboundChannelNotificationHandler *new_channel;
-
-  /**
-   * Cleaner for destroyed incoming tunnels.
-   */
-  GNUNET_CADET_ChannelEndHandler *cleaner;
-
-  /**
-   * Message handlers.
-   */
-  struct GNUNET_CADET_MessageHandler* handlers;
-
-  /**
-   * Application ports.
-   */
-  const struct GNUNET_HashCode **ports;
-
-};
-
-
-/**
- * Context for a cadet adapter callback.
- */
-struct GNUNET_CADET_TEST_AdapterContext
-{
-  /**
-   * Peer number for the particular peer.
-   */
-  unsigned int peer;
- 
-  /**
-   * General context.
-   */
-  struct GNUNET_CADET_TEST_Context *ctx;
-};
-
-
-/**
- * Adapter function called to establish a connection to
- * the CADET service.
- *
- * @param cls closure
- * @param cfg configuration of the peer to connect to; will be available until
- *          GNUNET_TESTBED_operation_done() is called on the operation returned
- *          from GNUNET_TESTBED_service_connect()
- * @return service handle to return in 'op_result', NULL on error
- */
-static void *
-cadet_connect_adapter (void *cls,
-                      const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  struct GNUNET_CADET_TEST_AdapterContext *actx = cls;
-  struct GNUNET_CADET_TEST_Context *ctx = actx->ctx;
-  struct GNUNET_CADET_Handle *h;
-
-  h = GNUNET_CADET_connect (cfg,
-                           (void *) (long) actx->peer,
-                           ctx->cleaner,
-                           ctx->handlers);
-  if (NULL == ctx->ports)
-    return h;
-
-  for (int i = 0; NULL != ctx->ports[i]; i++)
-  {
-    (void ) GNUNET_CADET_open_port (h, ctx->ports[i],
-                                    ctx->new_channel,
-                                    (void *) (long) actx->peer);
-  }
-
-  return h;
-}
-
-
-/**
- * Adapter function called to destroy a connection to
- * the CADET service.
- *
- * @param cls closure
- * @param op_result service handle returned from the connect adapter
- */
-static void
-cadet_disconnect_adapter (void *cls,
-                         void *op_result)
-{
-  struct GNUNET_CADET_Handle *cadet = op_result;
-  struct GNUNET_CADET_TEST_AdapterContext *actx = cls;
-
-  GNUNET_free (actx);
-  GNUNET_CADET_disconnect (cadet);
-}
-
-
-/**
- * Callback to be called when a service connect operation is completed.
- *
- * @param cls The callback closure from functions generating an operation.
- * @param op The operation that has been finished.
- * @param ca_result The service handle returned from
- *                  GNUNET_TESTBED_ConnectAdapter() (cadet handle).
- * @param emsg Error message in case the operation has failed.
- *             NULL if operation has executed successfully.
- */
-static void
-cadet_connect_cb (void *cls,
-                 struct GNUNET_TESTBED_Operation *op,
-                 void *ca_result,
-                 const char *emsg)
-{
-  struct GNUNET_CADET_TEST_Context *ctx = cls;
-  unsigned int i;
-
-  if (NULL != emsg)
-  {
-    fprintf (stderr, "Failed to connect to CADET service: %s\n",
-             emsg);
-    GNUNET_SCHEDULER_shutdown ();
-    return;
-  }
-  for (i = 0; i < ctx->num_peers; i++)
-    if (op == ctx->ops[i])
-    {
-      ctx->cadetes[i] = ca_result;
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO, "...cadet %u connected\n", i);
-    }
-  for (i = 0; i < ctx->num_peers; i++)
-    if (NULL == ctx->cadetes[i])
-      return; /* still some CADET connections missing */
-  /* all CADET connections ready! */
-  ctx->app_main (ctx->app_main_cls,
-                 ctx,
-                 ctx->num_peers,
-                 ctx->peers,
-                 ctx->cadetes);
-}
-
-
-void
-GNUNET_CADET_TEST_cleanup (struct GNUNET_CADET_TEST_Context *ctx)
-{
-  unsigned int i;
-
-  for (i = 0; i < ctx->num_peers; i++)
-  {
-    GNUNET_assert (NULL != ctx->ops[i]);
-    GNUNET_TESTBED_operation_done (ctx->ops[i]);
-    ctx->ops[i] = NULL;
-  }
-  GNUNET_free (ctx->ops);
-  GNUNET_free (ctx->cadetes);
-  GNUNET_free (ctx);
-  GNUNET_SCHEDULER_shutdown ();
-}
-
-
-/**
- * Callback run when the testbed is ready (peers running and connected to
- * each other)
- *
- * @param cls Closure (context).
- * @param h the run handle
- * @param num_peers Number of peers that are running.
- * @param peers Handles to each one of the @c num_peers peers.
- * @param links_succeeded the number of overlay link connection attempts that
- *          succeeded
- * @param links_failed the number of overlay link connection attempts that
- *          failed
- */
-static void
-cadet_test_run (void *cls,
-               struct GNUNET_TESTBED_RunHandle *h,
-               unsigned int num_peers,
-               struct GNUNET_TESTBED_Peer **peers,
-               unsigned int links_succeeded,
-               unsigned int links_failed)
-{
-  struct GNUNET_CADET_TEST_Context *ctx = cls;
-  unsigned int i;
-
-  if  (num_peers != ctx->num_peers)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peers started %u/%u, ending\n",
-                num_peers, ctx->num_peers);
-    exit (1);
-  }
-  ctx->peers = peers;
-  for (i = 0; i < num_peers; i++)
-  {
-    struct GNUNET_CADET_TEST_AdapterContext *newctx;
-    newctx = GNUNET_new (struct GNUNET_CADET_TEST_AdapterContext);
-    newctx->peer = i;
-    newctx->ctx = ctx;
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Connecting to cadet %u\n", i);
-    ctx->ops[i] = GNUNET_TESTBED_service_connect (ctx,
-                                                  peers[i],
-                                                  "cadet",
-                                                  &cadet_connect_cb,
-                                                  ctx,
-                                                  &cadet_connect_adapter,
-                                                  &cadet_disconnect_adapter,
-                                                  newctx);
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "op handle %p\n", ctx->ops[i]);
-  }
-}
-
-
-void
-GNUNET_CADET_TEST_run (const char *testname,
-                      const char *cfgname,
-                      unsigned int num_peers,
-                      GNUNET_CADET_TEST_AppMain tmain,
-                      void *tmain_cls,
-                      GNUNET_CADET_InboundChannelNotificationHandler 
new_channel,
-                      GNUNET_CADET_ChannelEndHandler cleaner,
-                      struct GNUNET_CADET_MessageHandler* handlers,
-                      const struct GNUNET_HashCode **ports)
-{
-  struct GNUNET_CADET_TEST_Context *ctx;
-
-  ctx = GNUNET_new (struct GNUNET_CADET_TEST_Context);
-  ctx->num_peers = num_peers;
-  ctx->ops = GNUNET_malloc (num_peers * sizeof (struct 
GNUNET_TESTBED_Operation *));
-  ctx->cadetes = GNUNET_malloc (num_peers * sizeof (struct GNUNET_CADET_Handle 
*));
-  ctx->app_main = tmain;
-  ctx->app_main_cls = tmain_cls;
-  ctx->new_channel = new_channel;
-  ctx->cleaner = cleaner;
-  ctx->handlers = handlers;
-  ctx->ports = ports;
-  GNUNET_TESTBED_test_run (testname,
-                           cfgname,
-                           num_peers,
-                           0LL, NULL, NULL,
-                           &cadet_test_run, ctx);
-}
-
-/* end of cadet_test_lib.c */
diff --git a/src/cadet/cadet_test_lib.h b/src/cadet/cadet_test_lib.h
deleted file mode 100644
index 464977d42..000000000
--- a/src/cadet/cadet_test_lib.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2012 GNUnet e.V.
-
-     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., 51 Franklin Street, Fifth Floor,
-     Boston, MA 02110-1301, USA.
-*/
-/**
- * @file cadet/cadet_test_lib.h
- * @author Bartlomiej Polot
- * @brief library for writing CADET tests
- */
-#ifndef CADET_TEST_LIB_H
-#define CADET_TEST_LIB_H
-
-#ifdef __cplusplus
-extern "C"
-{
-#if 0                           /* keep Emacsens' auto-indent happy */
-}
-#endif
-#endif
-
-#include "gnunet_testbed_service.h"
-#include "gnunet_cadet_service.h"
-
-/**
- * Test context for a CADET Test.
- */
-struct GNUNET_CADET_TEST_Context;
-
-
-/**
- * Main function of a CADET test.
- *
- * @param cls Closure.
- * @param ctx Argument to give to GNUNET_CADET_TEST_cleanup on test end.
- * @param num_peers Number of peers that are running.
- * @param peers Array of peers.
- * @param cadetes Handle to each of the CADETs of the peers.
- */
-typedef void (*GNUNET_CADET_TEST_AppMain) (void *cls,
-                                          struct GNUNET_CADET_TEST_Context 
*ctx,
-                                          unsigned int num_peers,
-                                          struct GNUNET_TESTBED_Peer **peers,
-                                          struct GNUNET_CADET_Handle 
**cadetes);
-
-
-/**
- * Run a test using the given name, configuration file and number of
- * peers.
- * All cadet callbacks will receive the peer number as the closure.
- *
- * @param testname Name of the test (for logging).
- * @param cfgname Name of the configuration file.
- * @param num_peers Number of peers to start.
- * @param tmain Main function to run once the testbed is ready.
- * @param tmain_cls Closure for 'tmain'.
- * @param new_channel Handler for incoming tunnels.
- * @param cleaner Cleaner for destroyed incoming tunnels.
- * @param handlers Message handlers.
- * @param ports Ports the peers offer, NULL-terminated.
- */
-void
-GNUNET_CADET_TEST_run (const char *testname,
-                      const char *cfgname,
-                      unsigned int num_peers,
-                      GNUNET_CADET_TEST_AppMain tmain,
-                      void *tmain_cls,
-                      GNUNET_CADET_InboundChannelNotificationHandler 
new_channel,
-                      GNUNET_CADET_ChannelEndHandler cleaner,
-                      struct GNUNET_CADET_MessageHandler* handlers,
-                      const struct GNUNET_HashCode **ports);
-
-
-/**
- * Clean up the testbed.
- *
- * @param ctx handle for the testbed
- */
-void
-GNUNET_CADET_TEST_cleanup (struct GNUNET_CADET_TEST_Context *ctx);
-
-
-#if 0                           /* keep Emacsens' auto-indent happy */
-{
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-
-/* ifndef CADET_TEST_LIB_H */
-#endif

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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