[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r17643 - gnunet/src/dht
From: |
gnunet |
Subject: |
[GNUnet-SVN] r17643 - gnunet/src/dht |
Date: |
Thu, 20 Oct 2011 19:35:19 +0200 |
Author: bartpolot
Date: 2011-10-20 19:35:19 +0200 (Thu, 20 Oct 2011)
New Revision: 17643
Modified:
gnunet/src/dht/
gnunet/src/dht/Makefile.am
gnunet/src/dht/test_dht_2dtorus.c
Log:
Added testcase for opposite peers in a small 2d grid
Property changes on: gnunet/src/dht
___________________________________________________________________
Modified: svn:ignore
- 2dtorus_topo_initial
test_dht_twopeer_path_tracking
test_dhtlog
test_dht_multipeer
gnunet-dht-driver
test_dht_twopeer_put_get
test_dht_twopeer_get_put
test_dht_twopeer
test_dht_2dtorus
test_dht_api
Makefile.in
Makefile
gnunet-service-dht
gnunet-dht-put
gnunet-dht-get-peer
gnunet-dht-get
.deps
+ 2dtorus_topo_initial
test_dht_twopeer_path_tracking
test_dhtlog
test_dht_multipeer
gnunet-dht-driver
test_dht_twopeer_put_get
test_dht_twopeer_get_put
test_dht_twopeer
test_dht_2dtorus
test_dht_2dtorus_far
test_dht_api
Makefile.in
Makefile
gnunet-service-dht
gnunet-dht-put
gnunet-dht-get-peer
gnunet-dht-get
.deps
Modified: gnunet/src/dht/Makefile.am
===================================================================
--- gnunet/src/dht/Makefile.am 2011-10-20 17:29:04 UTC (rev 17642)
+++ gnunet/src/dht/Makefile.am 2011-10-20 17:35:19 UTC (rev 17643)
@@ -78,7 +78,8 @@
test_dht_twopeer_get_put \
test_dht_twopeer_path_tracking \
test_dht_multipeer \
- test_dht_2dtorus
+ test_dht_2dtorus \
+ test_dht_2dtorus_far
if ENABLE_TEST_RUN
TESTS = test_dht_api $(check_SCRIPTS) \
@@ -87,7 +88,8 @@
test_dht_twopeer_get_put \
test_dht_twopeer_path_tracking \
test_dht_multipeer \
- test_dht_2dtorus
+ test_dht_2dtorus \
+ test_dht_2dtorus_far
endif
test_dht_api_SOURCES = \
@@ -148,7 +150,16 @@
test_dht_2dtorus_DEPENDENCIES = \
libgnunetdht.la
+test_dht_2dtorus_far_SOURCES = \
+ test_dht_2dtorus.c
+test_dht_2dtorus_far_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/dht/libgnunetdht.la
+test_dht_2dtorus_far_DEPENDENCIES = \
+ libgnunetdht.la
+
EXTRA_DIST = \
$(check_SCRIPTS) \
test_dht_api_data.conf \
Modified: gnunet/src/dht/test_dht_2dtorus.c
===================================================================
--- gnunet/src/dht/test_dht_2dtorus.c 2011-10-20 17:29:04 UTC (rev 17642)
+++ gnunet/src/dht/test_dht_2dtorus.c 2011-10-20 17:35:19 UTC (rev 17643)
@@ -41,6 +41,8 @@
static int ok;
+static int far;
+
/**
* Be verbose
*/
@@ -204,15 +206,38 @@
{
struct GNUNET_TESTING_Daemon *d;
struct GNUNET_TESTING_Daemon *o;
+ struct GNUNET_TESTING_Daemon *aux;
+ const char *id_aux;
+ const char *id_origin = "FC74";
+ const char *id_near = "9P6V";
+ const char *id_far = "KPST";
+ unsigned int i;
- d = GNUNET_TESTING_daemon_get (pg, 2);
- o = GNUNET_TESTING_daemon_get (pg, 0);
+ d = o = NULL;
+ for (i = 0; i < num_peers; i++)
+ {
+ aux = GNUNET_TESTING_daemon_get (pg, i);
+ id_aux = GNUNET_i2s (&aux->id);
+ if (strcmp (id_aux, id_origin) == 0)
+ o = aux;
+ if (far == GNUNET_YES && strcmp (id_aux, id_far) == 0)
+ d = aux;
+ if (far == GNUNET_NO && strcmp (id_aux, id_near) == 0)
+ d = aux;
+ }
+ if (NULL == o || NULL == d)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "test: Peers not found (hostkey file changed?)\n");
+ GNUNET_SCHEDULER_cancel (disconnect_task);
+ disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_peers, NULL);
+ }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: test_task\n");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: looking for [2] %s\n",
+ "test: looking for %s\n",
GNUNET_h2s_full (&d->id.hashPubKey));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: from [0] %s\n",
+ "test: from %s\n",
GNUNET_h2s_full (&o->id.hashPubKey));
get_h = GNUNET_DHT_get_start (hs[0],
GNUNET_TIME_UNIT_FOREVER_REL, /* timeout */
@@ -353,23 +378,12 @@
struct GNUNET_TESTING_Daemon *first_daemon,
struct GNUNET_TESTING_Daemon *second_daemon, const char *emsg)
{
-// GNUNET_PEER_Id f;
-// GNUNET_PEER_Id s;
if (emsg == NULL)
{
total_connections++;
- /*f = */GNUNET_PEER_intern(first);
- /*s = */GNUNET_PEER_intern(second);
-// GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: New connection!\n");
-// GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-// "test: %s (%u)\n",
-// GNUNET_h2s(&first->hashPubKey),
-// f);
-// GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-// "test: %s (%u)\n",
-// GNUNET_h2s(&second->hashPubKey),
-// s);
+ GNUNET_PEER_intern(first);
+ GNUNET_PEER_intern(second);
}
else
{
@@ -508,6 +522,15 @@
#endif
NULL
};
+
+ if (strstr (xargv[0], "2dtorus_far") != NULL)
+ {
+ far = GNUNET_YES;
+ }
+ else
+ {
+ far = GNUNET_NO;
+ }
GNUNET_PROGRAM_run (sizeof(argv)/sizeof(char*) - 1, argv, "test_dht_2dtorus",
gettext_noop ("Test dht in a small 2D torus."), options,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r17643 - gnunet/src/dht,
gnunet <=