[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r31840 - gnunet/src/testbed
From: |
gnunet |
Subject: |
[GNUnet-SVN] r31840 - gnunet/src/testbed |
Date: |
Wed, 8 Jan 2014 16:02:20 +0100 |
Author: harsha
Date: 2014-01-08 16:02:20 +0100 (Wed, 08 Jan 2014)
New Revision: 31840
Added:
gnunet/src/testbed/test-underlay.sqlite
gnunet/src/testbed/test_testbed_underlay.c
gnunet/src/testbed/test_testbed_underlay.conf.in
Modified:
gnunet/src/testbed/
gnunet/src/testbed/Makefile.am
gnunet/src/testbed/testbed.conf.in
Log:
- testbed underlay testcase
Index: gnunet/src/testbed
===================================================================
--- gnunet/src/testbed 2014-01-08 14:59:17 UTC (rev 31839)
+++ gnunet/src/testbed 2014-01-08 15:02:20 UTC (rev 31840)
Property changes on: gnunet/src/testbed
___________________________________________________________________
Modified: svn:ignore
## -51,3 +51,4 ##
test_testbed_api_barriers
gnunet-daemon-testbed-underlay
generate-underlay-topology
+test_testbed_underlay
Modified: gnunet/src/testbed/Makefile.am
===================================================================
--- gnunet/src/testbed/Makefile.am 2014-01-08 14:59:17 UTC (rev 31839)
+++ gnunet/src/testbed/Makefile.am 2014-01-08 15:02:20 UTC (rev 31840)
@@ -19,6 +19,7 @@
if HAVE_SQLITE
underlay_daemon = gnunet-daemon-testbed-underlay
generate_underlay = generate-underlay-topology
+ underlay_testcases = test_testbed_underlay
endif
libexec_PROGRAMS = \
@@ -177,7 +178,8 @@
test_testbed_api_testbed_run_waitforever \
test_testbed_api_statistics \
gnunet-service-test-barriers \
- test_testbed_api_barriers
+ test_testbed_api_barriers \
+ $(underlay_testcases)
if ENABLE_TEST_RUN
TESTS = \
@@ -394,6 +396,12 @@
$(top_builddir)/src/util/libgnunetutil.la \
libgnunettestbed.la
+test_testbed_underlay_SOURCES = \
+ test_testbed_underlay.c
+test_testbed_underlay_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ libgnunettestbed.la
+
EXTRA_DIST = \
test_testbed_api.conf \
test_testbed_api_test_timeout.conf \
@@ -411,4 +419,6 @@
test_testbed_api_barriers.conf.in \
overlay_topology.txt \
sample_hosts.txt \
- sample.job
+ sample.job \
+ test_testbed_underlay.conf.in \
+ test-underlay.sqlite
Added: gnunet/src/testbed/test-underlay.sqlite
===================================================================
(Binary files differ)
Index: gnunet/src/testbed/test-underlay.sqlite
===================================================================
--- gnunet/src/testbed/test-underlay.sqlite 2014-01-08 14:59:17 UTC (rev
31839)
+++ gnunet/src/testbed/test-underlay.sqlite 2014-01-08 15:02:20 UTC (rev
31840)
Property changes on: gnunet/src/testbed/test-underlay.sqlite
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: gnunet/src/testbed/test_testbed_underlay.c
===================================================================
--- gnunet/src/testbed/test_testbed_underlay.c (rev 0)
+++ gnunet/src/testbed/test_testbed_underlay.c 2014-01-08 15:02:20 UTC (rev
31840)
@@ -0,0 +1,141 @@
+/*
+ This file is part of GNUnet
+ (C) 2008--2013 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 testbed/test_testbed_underlay.c
+ * @brief testcase binary for testing testbed underlay restrictions
+ * @author Sree Harsha Totakura <address@hidden>
+ */
+
+#include "platform.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_testbed_service.h"
+
+
+/**
+ * Number of peers we start in this test case
+ */
+#define NUM_PEERS 3
+
+/**
+ * Result of this test case
+ */
+static int result;
+
+static struct GNUNET_TESTBED_Operation *op;
+
+
+/**
+ * Callback to be called when an operation is completed
+ *
+ * @param cls the callback closure from functions generating an operation
+ * @param op the operation that has been finished
+ * @param emsg error message in case the operation has failed; will be NULL if
+ * operation has executed successfully.
+ */
+static void
+overlay_connect_status (void *cls,
+ struct GNUNET_TESTBED_Operation *op,
+ const char *emsg)
+{
+ GNUNET_TESTBED_operation_done (op);
+ op = NULL;
+ if (NULL == emsg)
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Peers 0 and 2 should not get
connected\n");
+ else
+ result = GNUNET_OK;
+ GNUNET_SCHEDULER_shutdown ();
+}
+
+
+
+/**
+ * Signature of a main function for a testcase.
+ *
+ * @param cls closure
+ * @param h the run handle
+ * @param num_peers number of peers in 'peers'
+ * @param peers_ handle to peers run in the testbed
+ * @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
+test_master (void *cls,
+ struct GNUNET_TESTBED_RunHandle *h,
+ unsigned int num_peers,
+ struct GNUNET_TESTBED_Peer **peers_,
+ unsigned int links_succeeded,
+ unsigned int links_failed)
+{
+ GNUNET_assert (NULL == cls);
+ if (NULL == peers_)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failing test due to timeout\n");
+ return;
+ }
+ GNUNET_assert (NUM_PEERS == num_peers);
+ getchar();
+ op = GNUNET_TESTBED_overlay_connect (NULL,
+ &overlay_connect_status,
+ NULL,
+ peers_[0],
+ peers_[2]);
+}
+
+
+/**
+ * Main function
+ */
+int
+main (int argc, char **argv)
+{
+ struct GNUNET_CONFIGURATION_Handle *cfg;
+ char pwd[PATH_MAX];
+ char *dbfile;
+ uint64_t event_mask;
+
+ result = GNUNET_SYSERR;
+ event_mask = 0;
+ cfg = GNUNET_CONFIGURATION_create ();
+ GNUNET_assert (GNUNET_YES ==
+ GNUNET_CONFIGURATION_parse (cfg,
+ "test_testbed_underlay.conf.in"));
+ if (NULL == getcwd (pwd, PATH_MAX))
+ return 1;
+ GNUNET_assert (0 < GNUNET_asprintf (&dbfile, "%s/%s", pwd,
+ "test-underlay.sqlite"));
+ GNUNET_CONFIGURATION_set_value_string (cfg, "TESTBED-UNDERLAY","DBFILE",
dbfile);
+ GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_write
+ (cfg, "test_testbed_underlay.conf"));
+ GNUNET_CONFIGURATION_destroy (cfg);
+ cfg = NULL;
+ GNUNET_free (dbfile);
+ dbfile = NULL;
+ (void) GNUNET_TESTBED_test_run ("test_testbed_underlay",
+ "test_testbed_underlay.conf", NUM_PEERS,
+ event_mask, NULL, NULL,
+ &test_master, NULL);
+ (void) unlink ("test_testbed_underlay.conf");
+ if (GNUNET_OK != result)
+ return 1;
+ return 0;
+}
Added: gnunet/src/testbed/test_testbed_underlay.conf.in
===================================================================
--- gnunet/src/testbed/test_testbed_underlay.conf.in
(rev 0)
+++ gnunet/src/testbed/test_testbed_underlay.conf.in 2014-01-08 15:02:20 UTC
(rev 31840)
@@ -0,0 +1,14 @@
address@hidden@ test_testbed_api_template.conf
+
+[testbed]
+OVERLAY_TOPOLOGY = LINE
+
+[testbed-underlay]
+AUTOSTART = NO
+DBFILE = /will/be/overwritten/by/testcase
+
+[dv]
+AUTOSTART = NO
+
+[arm]
+DEFAULTSERVICES = core transport testbed-underlay
Modified: gnunet/src/testbed/testbed.conf.in
===================================================================
--- gnunet/src/testbed/testbed.conf.in 2014-01-08 14:59:17 UTC (rev 31839)
+++ gnunet/src/testbed/testbed.conf.in 2014-01-08 15:02:20 UTC (rev 31840)
@@ -100,3 +100,13 @@
UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-testbed-barrier.sock
UNIX_MATCH_UID = YES
UNIX_MATCH_GID = YES
+
+
+# This section is related to configuring underlay restrictions to simulate
+# connectivity restrictions of NAT boxes
+[testbed-underlay]
+AUTOSTART = NO
+BINARY = gnunet-daemon-testbed-underlay
+# The sqlite3 database file containing information about what underlay
+# restrictions to apply
+# DBFILE =
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r31840 - gnunet/src/testbed,
gnunet <=