From 9e825dbbe49d3e856a0a79fc8b75b7da65c993e9 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 28 Mar 2013 12:21:29 +0000 Subject: -adding blacklist test to check that as well --- src/dv/Makefile.am | 20 ++++++--- src/dv/test_transport_api_dv.c | 65 ----------------------------- src/dv/test_transport_blacklist.c | 63 ++++++++++++++++++++++++++++ src/dv/test_transport_blacklist_data.conf | 68 +++++++++++++++++++++++++++++++ src/dv/test_transport_dv.c | 65 +++++++++++++++++++++++++++++ src/dv/test_transport_dv_data.conf | 1 - 6 files changed, 211 insertions(+), 71 deletions(-) delete mode 100644 src/dv/test_transport_api_dv.c create mode 100644 src/dv/test_transport_blacklist.c create mode 100644 src/dv/test_transport_blacklist_data.conf create mode 100644 src/dv/test_transport_dv.c (limited to 'src') diff --git a/src/dv/Makefile.am b/src/dv/Makefile.am index 52872f574..fecff08a7 100644 --- a/src/dv/Makefile.am +++ b/src/dv/Makefile.am @@ -66,21 +66,31 @@ libgnunet_plugin_transport_dv_la_DEPENDENCIES = \ libgnunetdv.la check_PROGRAMS = \ - test_transport_api_dv + test_transport_blacklist \ + test_transport_dv if ENABLE_TEST_RUN TESTS = $(check_PROGRAMS) endif -test_transport_api_dv_SOURCES = \ - test_transport_api_dv.c -test_transport_api_dv_LDADD = \ +test_transport_dv_SOURCES = \ + test_transport_dv.c +test_transport_dv_LDADD = \ + $(top_builddir)/src/testbed/libgnunettestbed.la \ + $(top_builddir)/src/core/libgnunetcore.la \ + $(top_builddir)/src/transport/libgnunettransport.la \ + $(top_builddir)/src/util/libgnunetutil.la + +test_transport_blacklist_SOURCES = \ + test_transport_blacklist.c +test_transport_blacklist_LDADD = \ $(top_builddir)/src/testbed/libgnunettestbed.la \ $(top_builddir)/src/core/libgnunetcore.la \ $(top_builddir)/src/transport/libgnunettransport.la \ $(top_builddir)/src/util/libgnunetutil.la EXTRA_DIST = \ - test_transport_dv_data.conf + test_transport_dv_data.conf \ + test_transport_blacklist_data.conf diff --git a/src/dv/test_transport_api_dv.c b/src/dv/test_transport_api_dv.c deleted file mode 100644 index 260b663f5..000000000 --- a/src/dv/test_transport_api_dv.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - This file is part of GNUnet. - (C) 2009 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 dv/test_transport_api_dv.c - * @brief base testcase for testing distance vector transport - */ -#include "platform.h" -#include "gnunet_core_service.h" -#include "gnunet_testbed_service.h" - -/** - * Return value from main, set to 0 on success. - */ -static int ok; - - -static void -test_connection (void *cls, - unsigned int num_peers, - struct GNUNET_TESTBED_Peer **peers) -{ - if (4 != num_peers) - { - fprintf (stderr, "Testbed failed to connect peers\n"); - GNUNET_SCHEDULER_shutdown (); - return; - } - ok = 0; - if (0) - GNUNET_SCHEDULER_shutdown (); - else - fprintf (stderr, "Test passed, press CTRL-C to shut down\n"); -} - - -int -main (int argc, char *argv[]) -{ - ok = 1; - (void) GNUNET_TESTBED_test_run ("test-transport-api-dv", - "test_transport_dv_data.conf", - 4, - 0, NULL, NULL, - &test_connection, NULL); - return ok; -} - -/* end of test_transport_api_dv.c */ diff --git a/src/dv/test_transport_blacklist.c b/src/dv/test_transport_blacklist.c new file mode 100644 index 000000000..1eaf95f05 --- /dev/null +++ b/src/dv/test_transport_blacklist.c @@ -0,0 +1,63 @@ +/* + This file is part of GNUnet. + (C) 2009, 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 dv/test_transport_blacklist.c + * @brief base testcase for testing blacklist + */ +#include "platform.h" +#include "gnunet_core_service.h" +#include "gnunet_testbed_service.h" + +/** + * Return value from main, set to 0 on success. + */ +static int ok; + + +static void +test_connection (void *cls, + unsigned int num_peers, + struct GNUNET_TESTBED_Peer **peers) +{ + if (4 != num_peers) + { + ok = 0; + } + else + { + fprintf (stderr, "Testbed connect peers despite blacklist!\n"); + } + GNUNET_SCHEDULER_shutdown (); +} + + +int +main (int argc, char *argv[]) +{ + ok = 1; + (void) GNUNET_TESTBED_test_run ("test-transport-blacklist", + "test_transport_blacklist_data.conf", + 4, + 0, NULL, NULL, + &test_connection, NULL); + return ok; +} + +/* end of test_transport_blacklist.c */ diff --git a/src/dv/test_transport_blacklist_data.conf b/src/dv/test_transport_blacklist_data.conf new file mode 100644 index 000000000..2c7829b67 --- /dev/null +++ b/src/dv/test_transport_blacklist_data.conf @@ -0,0 +1,68 @@ +[PATHS] +SERVICEHOME = /tmp/test-gnunet-dv-testing/ + +[transport] +PORT = 2565 +PLUGINS = tcp + +[arm] +DEFAULTSERVICES = core + +[dv] +AUTOSTART = YES +#PREFIX = valgrind + +[consensus] +PREFIX = valgrind + +[testbed] +OVERLAY_TOPOLOGY = CLIQUE + +[fs] +AUTOSTART = NO + +[datastore] +AUTOSTART = NO + +[dns] +AUTOSTART = NO + +[nse] +AUTOSTART = NO + +[chat] +AUTOSTART = NO + +[gns] +AUTOSTART = NO + +[vpn] +AUTOSTART = NO + +[namestore] +AUTOSTART = NO + +[lockmanager] +AUTOSTART = NO + +# Topology: +# 5M-HT +# HT-P5 +# HT-AG +# 5M-P5 +# 5M-AG +# Disallowed: P5-AG => needs DV! + +[transport-blacklist-HT3HI3HOVEI05OQANEDN3OELVO8LPS6DDGVI612TKMH0TA1R06NGB197LS0HGSIA4BQVBA93S6PCU4M70NN6GSLLML6ADI2CV5KIIE0] + +[transport-blacklist-P565723JO1C2HSN6J29TAQ22MN6CI8HTMUU55T0FUQG4CMDGGEQ8UCNBKUMB94GC8R9G4FB2SF9LDOBAJ6AMINBP4JHHDD6L7VD801G] +# forbid P565 to talk to AG2P via TCP to force DV @ distance 2 +AG2PHES1BARB9IJCPAMJTFPVJ5V3A72S3F2A8SBUB8DAQ2V0O3V8G6G2JU56FHGFOHMQVKBSQFV98TCGTC3RJ1NINP82G0RC00N1520 = tcp + +[transport-blacklist-AG2PHES1BARB9IJCPAMJTFPVJ5V3A72S3F2A8SBUB8DAQ2V0O3V8G6G2JU56FHGFOHMQVKBSQFV98TCGTC3RJ1NINP82G0RC00N1520] + +# forbid P565 to talk to AG2P via TCP to force DV @ distance 2 (again, just to be sure) +P565723JO1C2HSN6J29TAQ22MN6CI8HTMUU55T0FUQG4CMDGGEQ8UCNBKUMB94GC8R9G4FB2SF9LDOBAJ6AMINBP4JHHDD6L7VD801G = tcp + +[transport-blacklist-5MBMI6V7A8UFH0BD965HNNAQEDBIQRCC4LDNT9Q7KMEAQU00VEJFEQKDU4KCL9E64ACCRO0PJ1C689K765NCAHFUVSV99Q15KPK1RRO] + diff --git a/src/dv/test_transport_dv.c b/src/dv/test_transport_dv.c new file mode 100644 index 000000000..b36831693 --- /dev/null +++ b/src/dv/test_transport_dv.c @@ -0,0 +1,65 @@ +/* + This file is part of GNUnet. + (C) 2009, 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 dv/test_transport_dv.c + * @brief base testcase for testing distance vector transport + */ +#include "platform.h" +#include "gnunet_core_service.h" +#include "gnunet_testbed_service.h" + +/** + * Return value from main, set to 0 on success. + */ +static int ok; + + +static void +test_connection (void *cls, + unsigned int num_peers, + struct GNUNET_TESTBED_Peer **peers) +{ + if (4 != num_peers) + { + fprintf (stderr, "Testbed failed to connect peers\n"); + GNUNET_SCHEDULER_shutdown (); + return; + } + ok = 0; + if (0) + GNUNET_SCHEDULER_shutdown (); + else + fprintf (stderr, "Test passed, press CTRL-C to shut down\n"); +} + + +int +main (int argc, char *argv[]) +{ + ok = 1; + (void) GNUNET_TESTBED_test_run ("test-transport-api-dv", + "test_transport_dv_data.conf", + 4, + 0, NULL, NULL, + &test_connection, NULL); + return ok; +} + +/* end of test_transport_api_dv.c */ diff --git a/src/dv/test_transport_dv_data.conf b/src/dv/test_transport_dv_data.conf index c8efa9b43..59243ba06 100644 --- a/src/dv/test_transport_dv_data.conf +++ b/src/dv/test_transport_dv_data.conf @@ -4,7 +4,6 @@ SERVICEHOME = /tmp/test-gnunet-dv-testing/ [transport] PORT = 2565 PLUGINS = tcp dv -BLACKLIST_FILE = $SERVICEHOME/blacklist [arm] DEFAULTSERVICES = core -- cgit v1.2.3