[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r5863 - in GNUnet/src/applications: session testing
From: |
gnunet |
Subject: |
[GNUnet-SVN] r5863 - in GNUnet/src/applications: session testing |
Date: |
Tue, 11 Dec 2007 20:34:09 -0700 (MST) |
Author: grothoff
Date: 2007-12-11 20:34:09 -0700 (Tue, 11 Dec 2007)
New Revision: 5863
Added:
GNUnet/src/applications/testing/testingtest_loop.c
Modified:
GNUnet/src/applications/session/connect.c
GNUnet/src/applications/testing/Makefile.am
GNUnet/src/applications/testing/testing.c
Log:
extra tests
Modified: GNUnet/src/applications/session/connect.c
===================================================================
--- GNUnet/src/applications/session/connect.c 2007-12-12 03:33:20 UTC (rev
5862)
+++ GNUnet/src/applications/session/connect.c 2007-12-12 03:34:09 UTC (rev
5863)
@@ -869,13 +869,20 @@
#endif
return GNUNET_YES; /* trivial case */
}
+ if (GNUNET_YES == identity->isBlacklisted (peer, GNUNET_NO))
+ {
#if DEBUG_SESSION
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
+ "Peer `%s' blacklisted, cannot connect right now\n",
&enc);
+#endif
+ return GNUNET_NO; /* not allowed right now! */
+ }
+#if DEBUG_SESSION
GNUNET_GE_LOG (ectx,
GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
"Trying to exchange key with `%s'.\n", &enc);
#endif
- if (GNUNET_YES == identity->isBlacklisted (peer, GNUNET_NO))
- return GNUNET_NO; /* not allowed right now! */
if (GNUNET_OK == exchangeKey (peer, NULL, NULL))
return GNUNET_NO;
return GNUNET_SYSERR;
Modified: GNUnet/src/applications/testing/Makefile.am
===================================================================
--- GNUnet/src/applications/testing/Makefile.am 2007-12-12 03:33:20 UTC (rev
5862)
+++ GNUnet/src/applications/testing/Makefile.am 2007-12-12 03:34:09 UTC (rev
5863)
@@ -13,7 +13,8 @@
check_PROGRAMS = \
- testingtest
+ testingtest \
+ testingtest_loop
TESTS = $(check_PROGRAMS)
@@ -24,6 +25,13 @@
$(top_builddir)/src/applications/testing/libgnunettesting_api.la
+testingtest_loop_SOURCES = \
+ testingtest_loop.c
+testingtest_loop_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/applications/testing/libgnunettesting_api.la
+
+
pkgdata_DATA = \
gnunet-testing.conf
Modified: GNUnet/src/applications/testing/testing.c
===================================================================
--- GNUnet/src/applications/testing/testing.c 2007-12-12 03:33:20 UTC (rev
5862)
+++ GNUnet/src/applications/testing/testing.c 2007-12-12 03:34:09 UTC (rev
5863)
@@ -30,6 +30,8 @@
#include "gnunet_util.h"
#include "gnunet_testing_lib.h"
+#define VERBOSE GNUNET_NO
+
static void
updatePort (struct GNUNET_GC_Configuration *cfg,
const char *section, unsigned short offset)
@@ -208,6 +210,26 @@
return ret;
}
+#if VERBOSE
+static int printInfo(void *data,
+ const GNUNET_PeerIdentity *
+ identity,
+ const void *address,
+ unsigned int addr_len,
+ GNUNET_CronTime last_message,
+ unsigned int trust,
+ unsigned int bpmFromPeer) {
+ GNUNET_EncName oth;
+ GNUNET_hash_to_enc(&identity->hashPubKey, &oth);
+ fprintf(stderr,
+ "%s: %llu - %u\n",
+ (const char*) &oth,
+ last_message,
+ bpmFromPeer);
+ return GNUNET_OK;
+}
+#endif
+
/**
* Establish a connection between two GNUnet daemons
* (both must run on this machine).
@@ -243,7 +265,7 @@
{
sock1 = GNUNET_client_connection_create (NULL, cfg1);
sock2 = GNUNET_client_connection_create (NULL, cfg2);
- ret = -10;
+ ret = -20;
fprintf (stderr, _("Waiting for peers to connect"));
while ((ret++ < -1) && (GNUNET_shutdown_test () == GNUNET_NO))
{
@@ -277,6 +299,33 @@
GNUNET_free_non_null (h1);
GNUNET_free_non_null (h2);
}
+ if (ret != GNUNET_OK)
+ {
+#if VERBOSE
+ GNUNET_EncName e1;
+ GNUNET_EncName e2;
+ GNUNET_hash_to_enc(&h1->senderIdentity.hashPubKey,
+ &e1);
+ GNUNET_hash_to_enc(&h2->senderIdentity.hashPubKey,
+ &e2);
+ fprintf(stderr,
+ "\nFailed to connect `%s' and `%s'\n",
+ (const char*) &e1,
+ (const char*) &e2);
+ fprintf(stderr,
+ "Connections of `%s':\n",
+ (const char*) &e1);
+ GNUNET_IDENTITY_request_peer_infos(sock1,
+ &printInfo,
+ NULL);
+ fprintf(stderr,
+ "Connections of `%s':\n",
+ (const char*) &e2);
+ GNUNET_IDENTITY_request_peer_infos(sock2,
+ &printInfo,
+ NULL);
+#endif
+ }
fprintf (stderr, "%s\n", ret == GNUNET_OK ? "!" : "?");
GNUNET_client_connection_destroy (sock1);
GNUNET_client_connection_destroy (sock2);
Added: GNUnet/src/applications/testing/testingtest_loop.c
===================================================================
--- GNUnet/src/applications/testing/testingtest_loop.c
(rev 0)
+++ GNUnet/src/applications/testing/testingtest_loop.c 2007-12-12 03:34:09 UTC
(rev 5863)
@@ -0,0 +1,73 @@
+/*
+ This file is part of GNUnet.
+ (C) 2005, 2006, 2007 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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+/**
+ * @file applications/testing/testingtest_loop.c
+ * @brief GAP economy testcase, download from star topology
+ * @author Christian Grothoff
+ */
+
+#include "platform.h"
+#include "gnunet_protocols.h"
+#include "gnunet_testing_lib.h"
+#include "gnunet_identity_lib.h"
+#include "gnunet_util.h"
+
+#define LOOP_COUNT 10
+
+#define PEER_COUNT 10
+
+/**
+ * Testcase to test testing's connection establishment
+ * @return 0: ok, -1: error
+ */
+int
+main (int argc, char **argv)
+{
+ struct GNUNET_TESTING_DaemonContext *peers;
+ int j;
+ int i;
+
+ for (j=0;j<LOOP_COUNT; j++) {
+ peers = GNUNET_TESTING_start_daemons ("tcp",
+ "advertising topology stats",
+ "/tmp/gnunet-testing-test-loop",
+ 2087, 10, PEER_COUNT);
+ if (peers == NULL)
+ {
+ fprintf (stderr, "Failed to start the gnunetd daemons!\n");
+ return -1;
+ }
+ /* connect as star-topology */
+ for (i = 1; i < PEER_COUNT; i++)
+ {
+ if (GNUNET_OK != GNUNET_TESTING_connect_daemons (2087, 2087 + 10 * i))
+ {
+ GNUNET_TESTING_stop_daemons (peers);
+ fprintf (stderr, "Failed to connect the peers!\n");
+ return -1;
+ }
+ }
+ GNUNET_TESTING_stop_daemons (peers);
+ }
+ return 0;
+}
+
+/* end of testingtest_loop.c */
Property changes on: GNUnet/src/applications/testing/testingtest_loop.c
___________________________________________________________________
Name: svn:eol-style
+ native
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r5863 - in GNUnet/src/applications: session testing,
gnunet <=