/*
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_testing_lib.h"
#include "gnunet_core_service.h"
#define VERBOSE 1
#define TEST_ALL GNUNET_NO
/**
* How long until we fail the whole testcase?
*/
#define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600)
/**
* How long until we give up on starting the peers?
*/
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 500)
#define DEFAULT_NUM_PEERS 4
#define DEFAULT_ADDITIONAL_MESSAGES 2
#define MAX_OUTSTANDING_CONNECTIONS 100
static float fail_percentage = 0.00;
static int ok;
static unsigned long long num_additional_messages;
static unsigned long long num_peers;
static unsigned int total_connections;
static unsigned int failed_connections;
static unsigned int total_server_connections;
static unsigned int total_messages_received;
static unsigned int total_other_expected_messages;
static unsigned int temp_total_other_messages;
static unsigned int total_other_messages;
static unsigned int expected_messages;
static unsigned int expected_connections;
static unsigned long long peers_left;
static struct GNUNET_TESTING_PeerGroup *pg;
const struct GNUNET_CONFIGURATION_Handle *main_cfg;
static GNUNET_SCHEDULER_TaskIdentifier die_task;
static char *dotOutFileName = "topology.dot";
static FILE *dotOutFile;
static char *blacklist_transports;
static int transmit_ready_scheduled;
static int transmit_ready_failed;
static int transmit_ready_called;
static enum GNUNET_TESTING_Topology topology;
static enum GNUNET_TESTING_Topology blacklist_topology = GNUNET_TESTING_TOPOLOGY_NONE; /* Don't do any blacklisting */
static enum GNUNET_TESTING_Topology connection_topology = GNUNET_TESTING_TOPOLOGY_NONE; /* NONE actually means connect all allowed peers */
static enum GNUNET_TESTING_TopologyOption connect_topology_option =
GNUNET_TESTING_TOPOLOGY_OPTION_ALL;
static double connect_topology_option_modifier = 0.0;
static char *test_directory;
struct GNUNET_CONTAINER_MultiHashMap *peer_daemon_hash;
#define MTYPE 12345
GNUNET_NETWORK_STRUCT_BEGIN
struct GNUNET_TestMessage
{
/**
* Header of the message
*/
struct GNUNET_MessageHeader header;
/**
* Unique identifier for this message.
*/
uint32_t uid;
};
GNUNET_NETWORK_STRUCT_END
struct PeerContext
{
/* This is a linked list */
struct PeerContext *next;
/**
* Handle to the daemon
*/
struct GNUNET_TESTING_Daemon *daemon;
/* Handle to the peer core */
struct GNUNET_CORE_Handle *peer_handle;
};
static struct PeerContext *all_peers;
struct TestMessageContext
{
/* This is a linked list */
struct TestMessageContext *next;
/* Handle to the sending peer core */
struct GNUNET_CORE_Handle *peer1handle;
/* Handle to the receiving peer core */
struct GNUNET_CORE_Handle *peer2handle;
/* Handle to the sending peer daemon */
struct GNUNET_TESTING_Daemon *peer1;
/* Handle to the receiving peer daemon */
struct GNUNET_TESTING_Daemon