gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r17058 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r17058 - gnunet/src/transport
Date: Tue, 27 Sep 2011 16:03:08 +0200

Author: wachs
Date: 2011-09-27 16:03:08 +0200 (Tue, 27 Sep 2011)
New Revision: 17058

Added:
   gnunet/src/transport/test_transport_api_timeout.c
   gnunet/src/transport/test_transport_api_timeout_http_peer1.conf
   gnunet/src/transport/test_transport_api_timeout_http_peer2.conf
   gnunet/src/transport/test_transport_api_timeout_https_peer1.conf
   gnunet/src/transport/test_transport_api_timeout_https_peer2.conf
   gnunet/src/transport/test_transport_api_timeout_tcp_peer1.conf
   gnunet/src/transport/test_transport_api_timeout_tcp_peer2.conf
Removed:
   gnunet/src/transport/test_transport_api_multiaddress.c
   gnunet/src/transport/test_transport_api_multiaddress_tcp_peer1.conf
   gnunet/src/transport/test_transport_api_multiaddress_tcp_peer2.conf
Modified:
   gnunet/src/transport/Makefile.am
   gnunet/src/transport/test_transport_api_http_peer1.conf
   gnunet/src/transport/test_transport_api_http_peer2.conf
   gnunet/src/transport/test_transport_api_unreliability.c
Log:
- renaming test_transport_api_multiaddress to test_transport_api_timeout  
- adding new timeout tests for http and https



Modified: gnunet/src/transport/Makefile.am
===================================================================
--- gnunet/src/transport/Makefile.am    2011-09-27 13:46:03 UTC (rev 17057)
+++ gnunet/src/transport/Makefile.am    2011-09-27 14:03:08 UTC (rev 17058)
@@ -7,14 +7,14 @@
 if HAVE_EXPERIMENTAL
  GN_LIBMHD = -lmicrohttpd
  HTTP_PLUGIN_LA = libgnunet_plugin_transport_http.la
-# HTTP_PLUGIN_TEST = test_plugin_transport_http
  HTTP_API_TEST = test_transport_api_http
+ HTTP_API_TIMEOUT_TEST = test_transport_api_timeout_http
  HTTP_REL_TEST = test_transport_api_reliability_http
  HTTP_QUOTA_TEST = test_quota_compliance_http \
                   test_quota_compliance_http_asymmetric_recv_constant
  HTTPS_PLUGIN_LA = libgnunet_plugin_transport_https.la
-# HTTPS_PLUGIN_TEST = test_plugin_transport_https
  HTTPS_API_TEST = test_transport_api_https
+ HTTPS_API_TIMEOUT_TEST = test_transport_api_timeout_https
  HTTPS_REL_TEST = test_transport_api_reliability_https
  HTTPS_QUOTA_TEST = test_quota_compliance_https \
                test_quota_compliance_https_asymmetric_recv_constant
@@ -253,17 +253,17 @@
  test_transport_testing \
  test_transport_startonly \
  test_transport_api_disconnect \
- test_transport_api_multiaddress_tcp \
  test_transport_api_tcp \
+ test_transport_api_timeout_tcp \
  test_transport_api_limited_sockets_tcp \
  test_transport_api_tcp_nat \
  test_transport_api_udp \
  $(UNIX_PLUGIN_TEST) \
  test_transport_api_udp_nat \
- $(HTTP_PLUGIN_TEST) \
  $(HTTP_API_TEST) \
- $(HTTPS_PLUGIN_TEST) \
+ $(HTTP_API_TIMEOUT_TEST) \
  $(HTTPS_API_TEST) \
+ $(HTTPS_API_TIMEOUT_TEST) \
  test_transport_api_multi \
  test_transport_api_reliability_tcp \
  test_transport_api_reliability_tcp_nat \
@@ -288,17 +288,17 @@
  test_transport_testing \
  test_transport_startonly \
  test_transport_api_disconnect \
- test_transport_api_multiaddress_tcp \
  test_transport_api_tcp \
+ test_transport_api_timeout_tcp \
  test_transport_api_limited_sockets_tcp \
  test_transport_api_tcp_nat \
  test_transport_api_udp \
  $(UNIX_PLUGIN_TEST) \
  test_transport_api_udp_nat \
- $(HTTP_PLUGIN_TEST) \
  $(HTTP_API_TEST) \
- $(HTTPS_PLUGIN_TEST) \
+ $(HTTP_API_TIMEOUT_TEST) \
  $(HTTPS_API_TEST) \
+ $(HTTPS_API_TIMEOUT_TEST) \
  test_transport_api_multi \
  test_transport_api_reliability_tcp \
  test_transport_api_reliability_tcp_nat \
@@ -384,14 +384,30 @@
  $(top_builddir)/src/util/libgnunetutil.la \
  $(top_builddir)/src/transport/libgnunettransporttesting.la 
 
-test_transport_api_multiaddress_tcp_SOURCES = \
- test_transport_api_multiaddress.c
-test_transport_api_multiaddress_tcp_LDADD = \
+test_transport_api_timeout_tcp_SOURCES = \
+ test_transport_api_timeout.c
+test_transport_api_timeout_tcp_LDADD = \
  $(top_builddir)/src/transport/libgnunettransport.la \
  $(top_builddir)/src/hello/libgnunethello.la \
  $(top_builddir)/src/util/libgnunetutil.la \
  $(top_builddir)/src/transport/libgnunettransporttesting.la 
 
+test_transport_api_timeout_http_SOURCES = \
+ test_transport_api_timeout.c
+test_transport_api_timeout_http_LDADD = \
+ $(top_builddir)/src/transport/libgnunettransport.la \
+ $(top_builddir)/src/hello/libgnunethello.la \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/transport/libgnunettransporttesting.la 
+ 
+test_transport_api_timeout_https_SOURCES = \
+ test_transport_api_timeout.c
+test_transport_api_timeout_https_LDADD = \
+ $(top_builddir)/src/transport/libgnunettransport.la \
+ $(top_builddir)/src/hello/libgnunethello.la \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/transport/libgnunettransporttesting.la 
+ 
 test_transport_api_reliability_tcp_nat_SOURCES = \
  test_transport_api_reliability.c
 test_transport_api_reliability_tcp_nat_LDADD = \
@@ -464,14 +480,6 @@
  $(top_builddir)/src/util/libgnunetutil.la \
  $(top_builddir)/src/transport/libgnunettransporttesting.la 
 
-#test_plugin_transport_https_SOURCES = \
-# test_plugin_transport_https.c
-#test_plugin_transport_https_LDADD = \
-# $(top_builddir)/src/statistics/libgnunetstatistics.la \
-# @LIBCURL@ \
-# $(top_builddir)/src/hello/libgnunethello.la \
-# $(top_builddir)/src/util/libgnunetutil.la  
-
 test_transport_api_https_SOURCES = \
  test_transport_api.c
 test_transport_api_https_LDADD = \
@@ -597,12 +605,6 @@
  $(top_builddir)/src/hello/libgnunethello.la \
  $(top_builddir)/src/util/libgnunetutil.la
 
-#test_quota_compliance_udp_asymmetric_send_constant_SOURCES = \
-# test_quota_compliance.c
-#test_quota_compliance_udp_asymmetric_send_constant_LDADD = \
-# $(top_builddir)/src/transport/libgnunettransport.la \
-# $(top_builddir)/src/util/libgnunetutil.la 
-
 test_quota_compliance_unix_SOURCES = \
  test_quota_compliance.c
 test_quota_compliance_unix_LDADD = \
@@ -617,7 +619,6 @@
  $(top_builddir)/src/hello/libgnunethello.la \
  $(top_builddir)/src/util/libgnunetutil.la
 
-
 test_transport_api_multi_SOURCES = \
  test_transport_api.c
 test_transport_api_multi_LDADD = \
@@ -652,8 +653,8 @@
 test_transport_api_https_peer2.conf\
 test_transport_api_limited_sockets_tcp_peer1.conf\
 test_transport_api_limited_sockets_tcp_peer2.conf\
-test_transport_api_multiaddress_tcp_peer1.conf\
-test_transport_api_multiaddress_tcp_peer2.conf\
+test_transport_api_timeout_tcp_peer1.conf\
+test_transport_api_timeout_tcp_peer2.conf\
 test_transport_api_multi_peer1.conf\
 test_transport_api_multi_peer2.conf\
 test_transport_api_reliability_http_peer1.conf\

Modified: gnunet/src/transport/test_transport_api_http_peer1.conf
===================================================================
--- gnunet/src/transport/test_transport_api_http_peer1.conf     2011-09-27 
13:46:03 UTC (rev 17057)
+++ gnunet/src/transport/test_transport_api_http_peer1.conf     2011-09-27 
14:03:08 UTC (rev 17058)
@@ -8,7 +8,7 @@
 
 [transport-http]
 PORT = 12080
-USE_IPv6 = NO
+USE_IPv6 = YES
 USE_IPv4 = YES
 DISABLEV6 = NO
 #BINDTO = 127.0.0.1
@@ -32,7 +32,7 @@
 UNIXPATH = /tmp/gnunet-p1-service-peerinfo.sock
 
 [transport]
-DEBUG = YES
+#DEBUG = YES
 PORT = 12081
 PLUGINS = http
 #BINARY = .libs/gnunet-service-transport

Modified: gnunet/src/transport/test_transport_api_http_peer2.conf
===================================================================
--- gnunet/src/transport/test_transport_api_http_peer2.conf     2011-09-27 
13:46:03 UTC (rev 17057)
+++ gnunet/src/transport/test_transport_api_http_peer2.conf     2011-09-27 
14:03:08 UTC (rev 17058)
@@ -11,7 +11,7 @@
 USE_IPv6 = YES
 USE_IPv4 = YES
 DISABLEV6 = NO
-BINDTO = 127.0.0.1
+#BINDTO = 127.0.0.1
 
 [arm]
 PORT = 12095

Deleted: gnunet/src/transport/test_transport_api_multiaddress.c
===================================================================
--- gnunet/src/transport/test_transport_api_multiaddress.c      2011-09-27 
13:46:03 UTC (rev 17057)
+++ gnunet/src/transport/test_transport_api_multiaddress.c      2011-09-27 
14:03:08 UTC (rev 17058)
@@ -1,349 +0,0 @@
-/*
-     This file is part of GNUnet.
-     (C) 2009, 2010 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 transport/test_transport_api.c
- * @brief base test case for transport implementations
- *
- * This test case serves as a base for tcp, udp, and udp-nat
- * transport test cases.  Based on the executable being run
- * the correct test case will be performed.  Conservation of
- * C code apparently.
- */
-
-#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_getopt_lib.h"
-#include "gnunet_os_lib.h"
-#include "gnunet_program_lib.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_transport_service.h"
-#include "transport.h"
-#include "transport-testing.h"
-
-#define VERBOSE GNUNET_NO
-
-#define VERBOSE_ARM GNUNET_NO
-
-#define START_ARM GNUNET_YES
-
-/**
- * How long until we give up on transmitting the message?
- */
-#define WAIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
-
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 90)
-
-#define MTYPE 12345
-
-static char *test_source;
-
-static char *test_plugin;
-
-static char *test_name;
-
-static int ok;
-
-static GNUNET_SCHEDULER_TaskIdentifier die_task;
-
-static GNUNET_SCHEDULER_TaskIdentifier timer_task;
-
-struct PeerContext *p1;
-
-struct PeerContext *p2;
-
-static GNUNET_TRANSPORT_TESTING_ConnectRequest cc;
-
-struct GNUNET_TRANSPORT_TransmitHandle *th;
-
-char *cfg_file_p1;
-
-char *cfg_file_p2;
-
-static struct GNUNET_TIME_Relative time_running;
-
-static int shutdown_flag;
-
-static int disconnects;
-
-
-#if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, 
__FILE__, __LINE__); } while (0)
-#else
-#define OKPP do { ok++; } while (0)
-#endif
-
-
-static void
-end ()
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n");
-
-  if (timer_task != GNUNET_SCHEDULER_NO_TASK)
-  {
-    GNUNET_SCHEDULER_cancel (timer_task);
-    timer_task = GNUNET_SCHEDULER_NO_TASK;
-  }
-
-  if (die_task != GNUNET_SCHEDULER_NO_TASK)
-  {
-    GNUNET_SCHEDULER_cancel (die_task);
-    die_task = GNUNET_SCHEDULER_NO_TASK;
-  }
-
-  if (th != NULL)
-    GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
-  th = NULL;
-
-
-  GNUNET_TRANSPORT_TESTING_stop_peer (p1);
-  GNUNET_TRANSPORT_TESTING_stop_peer (p2);
-
-  if (disconnects == 0)
-    ok = 0;
-  else
-  {
-    ok = disconnects;
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Fail! Had %u disconnects while waiting %llu seconds \n",
-                disconnects, WAIT.rel_value);
-  }
-}
-
-static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  die_task = GNUNET_SCHEDULER_NO_TASK;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n");
-
-  if (timer_task != GNUNET_SCHEDULER_NO_TASK)
-  {
-    GNUNET_SCHEDULER_cancel (timer_task);
-    timer_task = GNUNET_SCHEDULER_NO_TASK;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "1\n");
-  if (cc != NULL)
-    GNUNET_TRANSPORT_TESTING_connect_peers_cancel (cc);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "2\n");
-  if (th != NULL)
-    GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
-  th = NULL;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "3\n");
-  if (p1 != NULL)
-    GNUNET_TRANSPORT_TESTING_stop_peer (p1);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "4\n");
-  if (p2 != NULL)
-    GNUNET_TRANSPORT_TESTING_stop_peer (p2);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "5\n");
-  ok = GNUNET_SYSERR;
-}
-
-
-static void
-notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
-                const struct GNUNET_MessageHeader *message,
-                const struct GNUNET_TRANSPORT_ATS_Information *ats,
-                uint32_t ats_count)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received message of type %d from peer %s!\n",
-              ntohs (message->type), GNUNET_i2s (peer));
-}
-
-static void
-notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
-                const struct GNUNET_TRANSPORT_ATS_Information *ats,
-                uint32_t ats_count)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%4s' connected to us (%p)!\n",
-              GNUNET_i2s (peer), cls);
-}
-
-
-static void
-notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
-{
-  if (shutdown_flag != GNUNET_YES)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "FAIL! Peer `%4s' disconnected during waiting period!\n",
-                GNUNET_i2s (peer));
-    disconnects++;
-  }
-}
-
-static void
-timer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  static int percentage;
-
-  timer_task = GNUNET_SCHEDULER_NO_TASK;
-
-  if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
-    return;
-
-  percentage += 10;
-  time_running =
-      GNUNET_TIME_relative_add (time_running,
-                                GNUNET_TIME_relative_divide (WAIT, 10));
-
-  if (time_running.rel_value ==
-      GNUNET_TIME_relative_max (time_running, WAIT).rel_value)
-  {
-    fprintf (stderr, "100%%\n");
-    shutdown_flag = GNUNET_YES;
-    GNUNET_SCHEDULER_add_now (&end, NULL);
-  }
-  else
-  {
-    fprintf (stderr, "%u%%..", percentage);
-    timer_task =
-        GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_divide (WAIT, 10),
-                                      &timer, NULL);
-  }
-}
-
-static void
-testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls)
-{
-  cc = NULL;
-  char *p1_c = strdup (GNUNET_i2s (&p1->id));
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers connected: %s <-> %s\n", p1_c,
-              GNUNET_i2s (&p2->id));
-  GNUNET_free (p1_c);
-
-  shutdown_flag = GNUNET_NO;
-
-  // FIXME: THIS IS REQUIRED! SEEMS TO BE A BUG!
-  timer_task =
-      GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_divide (WAIT, 10),
-                                    &timer, NULL);
-}
-
-static void
-run (void *cls, char *const *args, const char *cfgfile,
-     const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
-
-  p1 = GNUNET_TRANSPORT_TESTING_start_peer (cfg_file_p1, &notify_receive,
-                                            &notify_connect, 
&notify_disconnect,
-                                            NULL);
-  p2 = GNUNET_TRANSPORT_TESTING_start_peer (cfg_file_p2, &notify_receive,
-                                            &notify_connect, 
&notify_disconnect,
-                                            NULL);
-
-  if ((p1 == NULL) || (p2 == NULL))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not start peers!\n");
-    if (die_task != GNUNET_SCHEDULER_NO_TASK)
-      GNUNET_SCHEDULER_cancel (die_task);
-    die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL);
-    return;
-  }
-
-  cc = GNUNET_TRANSPORT_TESTING_connect_peers (p1, p2, &testing_connect_cb,
-                                               NULL);
-}
-
-static int
-check ()
-{
-  static char *const argv[] = { "test-transport-api-multiaddress",
-    "-c",
-    "test_transport_api_data.conf",
-#if VERBOSE
-    "-L", "DEBUG",
-#endif
-    NULL
-  };
-  static struct GNUNET_GETOPT_CommandLineOption options[] = {
-    GNUNET_GETOPT_OPTION_END
-  };
-
-#if WRITECONFIG
-  setTransportOptions ("test_transport_api_data.conf");
-#endif
-  timer_task = GNUNET_SCHEDULER_NO_TASK;
-
-  ok = 1;
-  GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
-                      "test-transport-api-multiaddress", "nohelp", options,
-                      &run, &ok);
-
-  return ok;
-}
-
-int
-main (int argc, char *argv[])
-{
-  int ret;
-  int nat_res;
-
-  GNUNET_TRANSPORT_TESTING_get_test_source_name (__FILE__, &test_source);
-  GNUNET_TRANSPORT_TESTING_get_test_plugin_name (argv[0], test_source,
-                                                 &test_plugin);
-  GNUNET_TRANSPORT_TESTING_get_test_name (argv[0], &test_name);
-
-  GNUNET_log_setup (test_name,
-#if VERBOSE
-                    "DEBUG",
-#else
-                    "WARNING",
-#endif
-                    NULL);
-
-  if ((strcmp (test_plugin, "tcp_nat") == 0) ||
-      (strcmp (test_plugin, "udp_nat") == 0))
-  {
-    nat_res = GNUNET_OS_check_helper_binary ("gnunet-nat-server");
-    if (GNUNET_NO == nat_res)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Cannot run NAT test: `%s' %s \n",
-                  "gnunet-nat-server", "SUID not set");
-      return 0;
-    }
-    if (GNUNET_SYSERR == nat_res)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Cannot run NAT test: `%s' %s \n",
-                  "gnunet-nat-server", "file not found");
-      return 0;
-    }
-  }
-
-  GNUNET_TRANSPORT_TESTING_get_config_name (argv[0], &cfg_file_p1, 1);
-  GNUNET_TRANSPORT_TESTING_get_config_name (argv[0], &cfg_file_p2, 2);
-
-  ret = check ();
-
-  GNUNET_free (cfg_file_p1);
-  GNUNET_free (cfg_file_p2);
-
-  GNUNET_free (test_source);
-  GNUNET_free (test_plugin);
-  GNUNET_free (test_name);
-
-
-  return ret;
-}
-
-/* end of test_transport_api.c */

Deleted: gnunet/src/transport/test_transport_api_multiaddress_tcp_peer1.conf
===================================================================
--- gnunet/src/transport/test_transport_api_multiaddress_tcp_peer1.conf 
2011-09-27 13:46:03 UTC (rev 17057)
+++ gnunet/src/transport/test_transport_api_multiaddress_tcp_peer1.conf 
2011-09-27 14:03:08 UTC (rev 17058)
@@ -1,33 +0,0 @@
address@hidden@ test_transport_defaults.conf
-[PATHS]
-SERVICEHOME = /tmp/test-transport/api-tcp-p1/
-DEFAULTCONFIG = template_cfg_peer1.conf
-
-[transport-tcp]
-PORT = 12000
-TIMEOUT = 5000
-BINDTO = 127.0.0.1
-
-[arm]
-PORT = 12005
-DEFAULTSERVICES = transport
-UNIXPATH = /tmp/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12004
-UNIXPATH = /tmp/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12003
-UNIXPATH = /tmp/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12002
-UNIXPATH = /tmp/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12001
-UNIXPATH = /tmp/gnunet-p1-service-transport.sock
-DEBUG = NO
-
-

Deleted: gnunet/src/transport/test_transport_api_multiaddress_tcp_peer2.conf
===================================================================
--- gnunet/src/transport/test_transport_api_multiaddress_tcp_peer2.conf 
2011-09-27 13:46:03 UTC (rev 17057)
+++ gnunet/src/transport/test_transport_api_multiaddress_tcp_peer2.conf 
2011-09-27 14:03:08 UTC (rev 17058)
@@ -1,36 +0,0 @@
address@hidden@ test_transport_defaults.conf
-[PATHS]
-SERVICEHOME = /tmp/test-transport/api-tcp-p2/
-DEFAULTCONFIG = template_cfg_peer2.conf
-
-[nat]
-ALLOW_NAT = NO
-
-[transport-tcp]
-PORT = 0
-TIMEOUT = 5000
-BINDTO = 127.0.0.1
-
-[arm]
-PORT = 12014
-DEFAULTSERVICES = transport
-UNIXPATH = /tmp/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12013
-UNIXPATH = /tmp/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12012
-UNIXPATH = /tmp/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12011
-UNIXPATH = /tmp/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12010
-UNIXPATH = /tmp/gnunet-p2-service-transport.sock
-DEBUG = NO
-
-

Copied: gnunet/src/transport/test_transport_api_timeout.c (from rev 17030, 
gnunet/src/transport/test_transport_api_multiaddress.c)
===================================================================
--- gnunet/src/transport/test_transport_api_timeout.c                           
(rev 0)
+++ gnunet/src/transport/test_transport_api_timeout.c   2011-09-27 14:03:08 UTC 
(rev 17058)
@@ -0,0 +1,349 @@
+/*
+     This file is part of GNUnet.
+     (C) 2009, 2010 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 transport/test_transport_api_timeout.c
+ * @brief test case for transport plugin implementations complying timeout
+ * settings
+ *
+ *
+ * This test case serves ensures that no peer disconnect events occurs
+ * while plugins are idle
+ */
+
+#include "platform.h"
+#include "gnunet_common.h"
+#include "gnunet_hello_lib.h"
+#include "gnunet_getopt_lib.h"
+#include "gnunet_os_lib.h"
+#include "gnunet_program_lib.h"
+#include "gnunet_scheduler_lib.h"
+#include "gnunet_transport_service.h"
+#include "transport.h"
+#include "transport-testing.h"
+
+#define VERBOSE GNUNET_NO
+
+#define VERBOSE_ARM GNUNET_NO
+
+#define START_ARM GNUNET_YES
+
+/**
+ * How long until we give up on transmitting the message?
+ */
+#define WAIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
+
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 90)
+
+#define MTYPE 12345
+
+static char *test_source;
+
+static char *test_plugin;
+
+static char *test_name;
+
+static int ok;
+
+static GNUNET_SCHEDULER_TaskIdentifier die_task;
+
+static GNUNET_SCHEDULER_TaskIdentifier timer_task;
+
+struct PeerContext *p1;
+
+struct PeerContext *p2;
+
+static GNUNET_TRANSPORT_TESTING_ConnectRequest cc;
+
+struct GNUNET_TRANSPORT_TransmitHandle *th;
+
+char *cfg_file_p1;
+
+char *cfg_file_p2;
+
+static struct GNUNET_TIME_Relative time_running;
+
+static int shutdown_flag;
+
+static int disconnects;
+
+
+#if VERBOSE
+#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, 
__FILE__, __LINE__); } while (0)
+#else
+#define OKPP do { ok++; } while (0)
+#endif
+
+
+static void
+end ()
+{
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n");
+
+  if (timer_task != GNUNET_SCHEDULER_NO_TASK)
+  {
+    GNUNET_SCHEDULER_cancel (timer_task);
+    timer_task = GNUNET_SCHEDULER_NO_TASK;
+  }
+
+  if (die_task != GNUNET_SCHEDULER_NO_TASK)
+  {
+    GNUNET_SCHEDULER_cancel (die_task);
+    die_task = GNUNET_SCHEDULER_NO_TASK;
+  }
+
+  if (th != NULL)
+    GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
+  th = NULL;
+
+
+  GNUNET_TRANSPORT_TESTING_stop_peer (p1);
+  GNUNET_TRANSPORT_TESTING_stop_peer (p2);
+
+  if (disconnects == 0)
+    ok = 0;
+  else
+  {
+    ok = disconnects;
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Fail! Had %u disconnects while waiting %llu seconds \n",
+                disconnects, WAIT.rel_value);
+  }
+}
+
+static void
+end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+  die_task = GNUNET_SCHEDULER_NO_TASK;
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n");
+
+  if (timer_task != GNUNET_SCHEDULER_NO_TASK)
+  {
+    GNUNET_SCHEDULER_cancel (timer_task);
+    timer_task = GNUNET_SCHEDULER_NO_TASK;
+  }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "1\n");
+  if (cc != NULL)
+    GNUNET_TRANSPORT_TESTING_connect_peers_cancel (cc);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "2\n");
+  if (th != NULL)
+    GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
+  th = NULL;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "3\n");
+  if (p1 != NULL)
+    GNUNET_TRANSPORT_TESTING_stop_peer (p1);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "4\n");
+  if (p2 != NULL)
+    GNUNET_TRANSPORT_TESTING_stop_peer (p2);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "5\n");
+  ok = GNUNET_SYSERR;
+}
+
+
+static void
+notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
+                const struct GNUNET_MessageHeader *message,
+                const struct GNUNET_TRANSPORT_ATS_Information *ats,
+                uint32_t ats_count)
+{
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Received message of type %d from peer %s!\n",
+              ntohs (message->type), GNUNET_i2s (peer));
+}
+
+static void
+notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
+                const struct GNUNET_TRANSPORT_ATS_Information *ats,
+                uint32_t ats_count)
+{
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%4s' connected to us (%p)!\n",
+              GNUNET_i2s (peer), cls);
+}
+
+
+static void
+notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
+{
+  if (shutdown_flag != GNUNET_YES)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "FAIL! Peer `%4s' disconnected during waiting period!\n",
+                GNUNET_i2s (peer));
+    disconnects++;
+  }
+}
+
+static void
+timer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+  static int percentage;
+
+  timer_task = GNUNET_SCHEDULER_NO_TASK;
+
+  if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
+    return;
+
+  percentage += 10;
+  time_running =
+      GNUNET_TIME_relative_add (time_running,
+                                GNUNET_TIME_relative_divide (WAIT, 10));
+
+  if (time_running.rel_value ==
+      GNUNET_TIME_relative_max (time_running, WAIT).rel_value)
+  {
+    fprintf (stderr, "100%%\n");
+    shutdown_flag = GNUNET_YES;
+    GNUNET_SCHEDULER_add_now (&end, NULL);
+  }
+  else
+  {
+    fprintf (stderr, "%u%%..", percentage);
+    timer_task =
+        GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_divide (WAIT, 10),
+                                      &timer, NULL);
+  }
+}
+
+static void
+testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls)
+{
+  cc = NULL;
+  char *p1_c = strdup (GNUNET_i2s (&p1->id));
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers connected: %s <-> %s\n", p1_c,
+              GNUNET_i2s (&p2->id));
+  GNUNET_free (p1_c);
+
+  shutdown_flag = GNUNET_NO;
+
+  // FIXME: THIS IS REQUIRED! SEEMS TO BE A BUG!
+  timer_task =
+      GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_divide (WAIT, 10),
+                                    &timer, NULL);
+}
+
+static void
+run (void *cls, char *const *args, const char *cfgfile,
+     const struct GNUNET_CONFIGURATION_Handle *cfg)
+{
+  die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
+
+  p1 = GNUNET_TRANSPORT_TESTING_start_peer (cfg_file_p1, &notify_receive,
+                                            &notify_connect, 
&notify_disconnect,
+                                            NULL);
+  p2 = GNUNET_TRANSPORT_TESTING_start_peer (cfg_file_p2, &notify_receive,
+                                            &notify_connect, 
&notify_disconnect,
+                                            NULL);
+
+  if ((p1 == NULL) || (p2 == NULL))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not start peers!\n");
+    if (die_task != GNUNET_SCHEDULER_NO_TASK)
+      GNUNET_SCHEDULER_cancel (die_task);
+    die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL);
+    return;
+  }
+
+  cc = GNUNET_TRANSPORT_TESTING_connect_peers (p1, p2, &testing_connect_cb,
+                                               NULL);
+}
+
+static int
+check ()
+{
+  static char *const argv[] = { "test-transport-api-multiaddress",
+    "-c",
+    "test_transport_api_data.conf",
+#if VERBOSE
+    "-L", "DEBUG",
+#endif
+    NULL
+  };
+  static struct GNUNET_GETOPT_CommandLineOption options[] = {
+    GNUNET_GETOPT_OPTION_END
+  };
+
+#if WRITECONFIG
+  setTransportOptions ("test_transport_api_data.conf");
+#endif
+  timer_task = GNUNET_SCHEDULER_NO_TASK;
+
+  ok = 1;
+  GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
+                      "test-transport-api-multiaddress", "nohelp", options,
+                      &run, &ok);
+
+  return ok;
+}
+
+int
+main (int argc, char *argv[])
+{
+  int ret;
+  int nat_res;
+
+  GNUNET_TRANSPORT_TESTING_get_test_source_name (__FILE__, &test_source);
+  GNUNET_TRANSPORT_TESTING_get_test_plugin_name (argv[0], test_source,
+                                                 &test_plugin);
+  GNUNET_TRANSPORT_TESTING_get_test_name (argv[0], &test_name);
+
+  GNUNET_log_setup (test_name,
+#if VERBOSE
+                    "DEBUG",
+#else
+                    "WARNING",
+#endif
+                    NULL);
+
+  if ((strcmp (test_plugin, "tcp_nat") == 0) ||
+      (strcmp (test_plugin, "udp_nat") == 0))
+  {
+    nat_res = GNUNET_OS_check_helper_binary ("gnunet-nat-server");
+    if (GNUNET_NO == nat_res)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Cannot run NAT test: `%s' %s \n",
+                  "gnunet-nat-server", "SUID not set");
+      return 0;
+    }
+    if (GNUNET_SYSERR == nat_res)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Cannot run NAT test: `%s' %s \n",
+                  "gnunet-nat-server", "file not found");
+      return 0;
+    }
+  }
+
+  GNUNET_TRANSPORT_TESTING_get_config_name (argv[0], &cfg_file_p1, 1);
+  GNUNET_TRANSPORT_TESTING_get_config_name (argv[0], &cfg_file_p2, 2);
+
+  ret = check ();
+
+  GNUNET_free (cfg_file_p1);
+  GNUNET_free (cfg_file_p2);
+
+  GNUNET_free (test_source);
+  GNUNET_free (test_plugin);
+  GNUNET_free (test_name);
+
+
+  return ret;
+}
+
+/* end of test_transport_api_timeout.c*/

Added: gnunet/src/transport/test_transport_api_timeout_http_peer1.conf
===================================================================
--- gnunet/src/transport/test_transport_api_timeout_http_peer1.conf             
                (rev 0)
+++ gnunet/src/transport/test_transport_api_timeout_http_peer1.conf     
2011-09-27 14:03:08 UTC (rev 17058)
@@ -0,0 +1,42 @@
address@hidden@ test_transport_defaults.conf
+[PATHS]
+SERVICEHOME = /tmp/test-transport/api-http-p1/
+DEFAULTCONFIG = test_transport_api_http_peer1.conf
+
+[nat]
+DISABLEV6 = NO
+
+[transport-http]
+PORT = 12080
+USE_IPv6 = YES
+USE_IPv4 = YES
+DISABLEV6 = NO
+#BINDTO = 127.0.0.1
+#BINDTO6 = ::1
+
+[arm]
+PORT = 12085
+DEFAULTSERVICES = transport
+UNIXPATH = /tmp/gnunet-p1-service-arm.sock
+
+[statistics]
+PORT = 12084
+UNIXPATH = /tmp/gnunet-p1-service-statistics.sock
+
+[resolver]
+PORT = 12083
+UNIXPATH = /tmp/gnunet-p1-service-resolver.sock
+
+[peerinfo]
+PORT = 12082
+UNIXPATH = /tmp/gnunet-p1-service-peerinfo.sock
+
+[transport]
+#DEBUG = YES
+PORT = 12081
+PLUGINS = http
+#BINARY = .libs/gnunet-service-transport
+UNIXPATH = /tmp/gnunet-p1-service-transport.sock
+#PREFIX = valgrind --leak-check=full
+#PREFIX = xterm -geometry 100x85 -T peer1 -e gdb --args
+

Added: gnunet/src/transport/test_transport_api_timeout_http_peer2.conf
===================================================================
--- gnunet/src/transport/test_transport_api_timeout_http_peer2.conf             
                (rev 0)
+++ gnunet/src/transport/test_transport_api_timeout_http_peer2.conf     
2011-09-27 14:03:08 UTC (rev 17058)
@@ -0,0 +1,38 @@
address@hidden@ test_transport_defaults.conf
+[PATHS]
+SERVICEHOME = /tmp/test-transport/api-http-p2/
+DEFAULTCONFIG = test_transport_api_http_peer2.conf
+
+[nat]
+DISABLEV6 = NO
+
+[transport-http]
+PORT = 12090
+USE_IPv6 = YES
+USE_IPv4 = YES
+DISABLEV6 = NO
+#BINDTO = 127.0.0.1
+
+[arm]
+PORT = 12095
+DEFAULTSERVICES = transport
+UNIXPATH = /tmp/gnunet-p2-service-arm.sock
+
+[statistics]
+PORT = 12094
+UNIXPATH = /tmp/gnunet-p2-service-statistics.sock
+
+[resolver]
+PORT = 12093
+UNIXPATH = /tmp/gnunet-p2-service-resolver.sock
+
+[peerinfo]
+PORT = 12092
+UNIXPATH = /tmp/gnunet-p2-service-peerinfo.sock
+
+[transport]
+DEBUG = YES
+PORT = 12091
+PLUGINS = http
+UNIXPATH = /tmp/gnunet-p2-service-transport.sock
+#PREFIX = valgrind --leak-check=full

Added: gnunet/src/transport/test_transport_api_timeout_https_peer1.conf
===================================================================
--- gnunet/src/transport/test_transport_api_timeout_https_peer1.conf            
                (rev 0)
+++ gnunet/src/transport/test_transport_api_timeout_https_peer1.conf    
2011-09-27 14:03:08 UTC (rev 17058)
@@ -0,0 +1,35 @@
address@hidden@ test_transport_defaults.conf
+[PATHS]
+SERVICEHOME = /tmp/test-transport/api-https-p1/
+DEFAULTCONFIG = test_transport_api_https_peer1.conf
+
+[transport-https]
+PORT = 12100
+CRYPTO_INIT = NONE:+VERS-TLS1.0:+ARCFOUR-128:+SHA1:+RSA:+COMP-NULL
+KEY_FILE = $SERVICEHOME/https_key_p1.key
+CERT_FILE = $SERVICEHOME/https_cert_p1.crt
+USE_IPv6 = YES
+USE_IPv4 = YES
+
+[arm]
+PORT = 12105
+
+[statistics]
+PORT = 12104
+UNIXPATH = /tmp/gnunet-p1-service-statistics.sock
+
+[resolver]
+PORT = 12103
+UNIXPATH = /tmp/gnunet-p1-service-resolver.sock
+
+[peerinfo]
+PORT = 12102
+UNIXPATH = /tmp/gnunet-p1-service-peerinfo.sock
+
+[transport]
+PORT = 12101
+PLUGINS = https
+UNIXPATH = /tmp/gnunet-p1-service-transport.sock
+DEBUG = NO
+
+

Added: gnunet/src/transport/test_transport_api_timeout_https_peer2.conf
===================================================================
--- gnunet/src/transport/test_transport_api_timeout_https_peer2.conf            
                (rev 0)
+++ gnunet/src/transport/test_transport_api_timeout_https_peer2.conf    
2011-09-27 14:03:08 UTC (rev 17058)
@@ -0,0 +1,36 @@
address@hidden@ test_transport_defaults.conf
+[PATHS]
+SERVICEHOME = /tmp/test-transport/api-https-p2/
+DEFAULTCONFIG = test_transport_api_https_peer2.conf
+
+[transport-https]
+PORT = 12110
+CRYPTO_INIT = NONE:+VERS-TLS1.0:+ARCFOUR-128:+SHA1:+RSA:+COMP-NULL
+KEY_FILE = $SERVICEHOME/https_key_p2.key
+CERT_FILE = $SERVICEHOME/https_cert_p2.crt
+USE_IPv6 = YES
+USE_IPv4 = YES
+
+[arm]
+PORT = 12115
+UNIXPATH = /tmp/gnunet-p2-service-arm.sock
+
+[statistics]
+PORT = 12114
+UNIXPATH = /tmp/gnunet-p2-service-statistics.sock
+
+[resolver]
+PORT = 12113
+UNIXPATH = /tmp/gnunet-p2-service-resolver.sock
+
+[peerinfo]
+PORT = 12112
+UNIXPATH = /tmp/gnunet-p2-service-peerinfo.sock
+
+[transport]
+PORT = 12111
+PLUGINS = https
+UNIXPATH = /tmp/gnunet-p2-service-transport.sock
+DEBUG = NO
+
+

Copied: gnunet/src/transport/test_transport_api_timeout_tcp_peer1.conf (from 
rev 17030, gnunet/src/transport/test_transport_api_multiaddress_tcp_peer1.conf)
===================================================================
--- gnunet/src/transport/test_transport_api_timeout_tcp_peer1.conf              
                (rev 0)
+++ gnunet/src/transport/test_transport_api_timeout_tcp_peer1.conf      
2011-09-27 14:03:08 UTC (rev 17058)
@@ -0,0 +1,33 @@
address@hidden@ test_transport_defaults.conf
+[PATHS]
+SERVICEHOME = /tmp/test-transport/api-tcp-p1/
+DEFAULTCONFIG = template_cfg_peer1.conf
+
+[transport-tcp]
+PORT = 12000
+TIMEOUT = 5000
+BINDTO = 127.0.0.1
+
+[arm]
+PORT = 12005
+DEFAULTSERVICES = transport
+UNIXPATH = /tmp/gnunet-p1-service-arm.sock
+
+[statistics]
+PORT = 12004
+UNIXPATH = /tmp/gnunet-p1-service-statistics.sock
+
+[resolver]
+PORT = 12003
+UNIXPATH = /tmp/gnunet-p1-service-resolver.sock
+
+[peerinfo]
+PORT = 12002
+UNIXPATH = /tmp/gnunet-p1-service-peerinfo.sock
+
+[transport]
+PORT = 12001
+UNIXPATH = /tmp/gnunet-p1-service-transport.sock
+DEBUG = NO
+
+

Copied: gnunet/src/transport/test_transport_api_timeout_tcp_peer2.conf (from 
rev 17030, gnunet/src/transport/test_transport_api_multiaddress_tcp_peer2.conf)
===================================================================
--- gnunet/src/transport/test_transport_api_timeout_tcp_peer2.conf              
                (rev 0)
+++ gnunet/src/transport/test_transport_api_timeout_tcp_peer2.conf      
2011-09-27 14:03:08 UTC (rev 17058)
@@ -0,0 +1,36 @@
address@hidden@ test_transport_defaults.conf
+[PATHS]
+SERVICEHOME = /tmp/test-transport/api-tcp-p2/
+DEFAULTCONFIG = template_cfg_peer2.conf
+
+[nat]
+ALLOW_NAT = NO
+
+[transport-tcp]
+PORT = 0
+TIMEOUT = 5000
+BINDTO = 127.0.0.1
+
+[arm]
+PORT = 12014
+DEFAULTSERVICES = transport
+UNIXPATH = /tmp/gnunet-p2-service-arm.sock
+
+[statistics]
+PORT = 12013
+UNIXPATH = /tmp/gnunet-p2-service-statistics.sock
+
+[resolver]
+PORT = 12012
+UNIXPATH = /tmp/gnunet-p2-service-resolver.sock
+
+[peerinfo]
+PORT = 12011
+UNIXPATH = /tmp/gnunet-p2-service-peerinfo.sock
+
+[transport]
+PORT = 12010
+UNIXPATH = /tmp/gnunet-p2-service-transport.sock
+DEBUG = NO
+
+

Modified: gnunet/src/transport/test_transport_api_unreliability.c
===================================================================
--- gnunet/src/transport/test_transport_api_unreliability.c     2011-09-27 
13:46:03 UTC (rev 17057)
+++ gnunet/src/transport/test_transport_api_unreliability.c     2011-09-27 
14:03:08 UTC (rev 17058)
@@ -39,7 +39,7 @@
 #include "transport.h"
 #include "transport-testing.h"
 
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
 
 #define VERBOSE_ARM GNUNET_NO
 




reply via email to

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