#include "gnunet_core_service.h"
#include "gnunet_os_lib.h"
-#define VERBOSE GNUNET_NO
#define PROGRESS_BARS GNUNET_YES
{
if (emsg != NULL)
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown of peers failed!\n");
-#endif
if (ok == 0)
ok = 666;
}
else
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All peers successfully shut down!\n");
-#endif
}
}
struct TestMessageContext *pos;
struct TestMessageContext *free_pos;
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Called finish testing, stopping daemons.\n");
-#endif
-
pos = test_messages;
while (pos != NULL)
{
}
GNUNET_free (free_pos);
}
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Transmit_ready's scheduled %d, failed %d, transmit_ready's called %d\n",
transmit_ready_scheduled, transmit_ready_failed,
transmit_ready_called);
-#endif
-
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Calling daemons_stop\n");
-#endif
GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
if (dotOutFile != NULL)
struct TestMessageContext *pos = cls;
/* Disconnect from the respective cores */
-#if VERBOSE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from peer 1 `%4s'\n",
GNUNET_i2s (&pos->peer1->id));
-#endif
if (pos->peer1handle != NULL)
GNUNET_CORE_disconnect (pos->peer1handle);
-#if VERBOSE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from peer 2 `%4s'\n",
GNUNET_i2s (&pos->peer2->id));
-#endif
if (pos->peer2handle != NULL)
GNUNET_CORE_disconnect (pos->peer2handle);
/* Set handles to NULL so test case can be ended properly */
total_messages_received++;
-#if VERBOSE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received message from `%4s', type %d.\n", GNUNET_i2s (peer),
ntohs (message->type));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Total messages received %d, expected %d.\n",
total_messages_received, expected_messages);
-#endif
if (total_messages_received == expected_messages)
{
GNUNET_free (free_pos);
}
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Transmit_ready's scheduled %d, failed %d, transmit_ready's called %d\n",
transmit_ready_scheduled, transmit_ready_failed,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Total messages received %d, expected %d.\n",
total_messages_received, expected_messages);
-#endif
if (pg != NULL)
{
m->header.size = htons (sizeof (struct GNUNET_TestMessage));
m->uid = htonl (pos->uid);
transmit_ready_called++;
-#if VERBOSE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"transmit ready for peer %s\ntransmit_ready's scheduled %d, transmit_ready's called %d\n",
GNUNET_i2s (&pos->peer1->id), transmit_ready_scheduled,
transmit_ready_called);
-#endif
return sizeof (struct GNUNET_TestMessage);
}
pos->peer2connected = GNUNET_YES;
if (pos->peer1notified == GNUNET_YES) /* Peer 1 has been notified of connection to peer 2 */
{
-#if VERBOSE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Scheduling message send to peer `%s' from peer `%s' (init_notify_peer2)\n",
GNUNET_i2s (my_identity),
GNUNET_h2s (&pos->peer1->id.hashPubKey));
-#endif
if (NULL ==
GNUNET_CORE_notify_transmit_ready (pos->peer1handle, GNUNET_YES, 0,
TIMEOUT, &pos->peer2->id,
if (0 == memcmp (peer, &pos->peer2->id, sizeof (struct GNUNET_PeerIdentity)))
{
pos->peer1notified = GNUNET_YES;
-#if VERBOSE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Peer `%s' notified of connection to peer `%s'\n",
GNUNET_i2s (&pos->peer1->id), GNUNET_h2s (&peer->hashPubKey));
-#endif
}
else
return;
if (pos->peer2connected == GNUNET_YES) /* Already connected and notified of connection, send message! */
{
-#if VERBOSE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Scheduling message send to peer `%s' from peer `%s' (init_notify_peer2)\n",
GNUNET_i2s (&pos->peer2->id),
GNUNET_h2s (&pos->peer1->id.hashPubKey));
-#endif
if (NULL ==
GNUNET_CORE_notify_transmit_ready (pos->peer1handle, GNUNET_YES, 0,
TIMEOUT, &pos->peer2->id,
total_server_connections++;
-#if VERBOSE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Core connection to `%4s' established, setting up handles\n",
GNUNET_i2s (my_identity));
-#endif
-
/*
* Connect to the receiving peer
*/
fflush (stdout);
#endif
total_connections++;
-#if VERBOSE > 1
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "connected peer %s to peer %s\n",
first_daemon->shortname, second_daemon->shortname);
-#endif
temp_context = GNUNET_malloc (sizeof (struct TestMessageContext));
temp_context->peer1 = first_daemon;
temp_context->peer2 = second_daemon;
FPRINTF (dotOutFile, "\tn%s -- n%s;\n", first_daemon->shortname,
second_daemon->shortname);
}
-#if VERBOSE
else
{
failed_connections++;
"Failed to connect peer %s to peer %s with error :\n%s\n",
first_daemon->shortname, second_daemon->shortname, emsg);
}
-#endif
if (total_connections == expected_connections)
{
#if PROGRESS_BARS
FPRINTF (stdout, "%s", "100%%]\n");
#endif
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Created %d total connections, which is our target number! Calling send messages.\n",
total_connections);
-#endif
modnum = expected_messages / 4;
dotnum = (expected_messages / 50) + 1;
if (modnum == 0)
}
else
{
-#if VERBOSE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Have %d total connections, %d failed connections, Want %d (at least %d)\n",
total_connections, failed_connections, expected_connections,
expected_connections -
(unsigned int) (fail_percentage * expected_connections));
-#endif
}
}
static void
topology_creation_finished (void *cls, const char *emsg)
{
-#if VERBOSE
if (emsg == NULL)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"All topology connections created successfully!\n");
-#endif
}
static void
return;
}
GNUNET_assert (id != NULL);
-#if VERBOSE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Started daemon %llu out of %llu\n",
(num_peers - peers_left) + 1, num_peers);
-#endif
#if PROGRESS_BARS
if ((num_peers - peers_left) % modnum == 0)
{
#if PROGRESS_BARS
FPRINTF (stdout, "%s", "100%%]\n");
#endif
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"All %d daemons started, now connecting peers!\n", num_peers);
-#endif
GNUNET_SCHEDULER_cancel (die_task);
/* Set up task in case topology creation doesn't finish
* within a reasonable amount of time */
"Hostkey callback received error: %s\n", emsg);
}
-#if VERBOSE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Hostkey (%d/%d) created for peer `%s'\n", num_peers - peers_left,
num_peers, GNUNET_i2s (id));
-#endif
-
#if PROGRESS_BARS
if ((num_peers - peers_left) % modnum == 0)
{
FPRINTF (dotOutFile, "%s", "strict graph G {\n");
}
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting daemons based on config file %s\n", cfgfile);
-#endif
-
if (GNUNET_YES !=
GNUNET_CONFIGURATION_get_value_string (cfg, "paths", "servicehome",
&test_directory))
char *const argv[] = { binary_name,
"-c",
config_file_name,
-#if VERBOSE
- "-L", "DEBUG",
-#endif
NULL
};
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_asprintf (&dotOutFileName, "topology_%s.dot", topology_string);
GNUNET_log_setup (our_binary_name,
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
ret = check ();
GNUNET_free (topology_string);
#include "gnunet_testing_lib.h"
#include "gnunet_core_service.h"
-#define VERBOSE GNUNET_YES
/**
* How long until we fail the whole testcase?
{
if (emsg != NULL)
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown of peers failed!\n");
-#endif
if (ok == 0)
ok = 666;
}
else
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All peers successfully shut down!\n");
-#endif
}
}
if (die_task != GNUNET_SCHEDULER_NO_TASK)
GNUNET_SCHEDULER_cancel (die_task);
-
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Called finish testing, stopping daemons.\n");
-#endif
-
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Calling daemons_stop\n");
-#endif
GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "daemons_stop finished\n");
-#endif
-
ok = 0;
}
return;
}
GNUNET_assert (id != NULL);
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Started daemon %llu out of %llu\n",
(num_peers - peers_left) + 1, num_peers);
-#endif
peers_left--;
if (peers_left == 0)
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"All %d daemons started, now testing churn!\n", num_peers);
-#endif
GNUNET_SCHEDULER_cancel (die_task);
/* Set up task in case topology creation doesn't finish
* within a reasonable amount of time */
{
ok = 1;
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting daemons based on config file %s\n", cfgfile);
-#endif
-
if (GNUNET_YES !=
GNUNET_CONFIGURATION_get_value_string (cfg, "paths", "servicehome",
&test_directory))
char *const argv[] = { "test-testing-topology-churn",
"-c",
"test_testing_data_topology_churn.conf",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
NULL
};
struct GNUNET_GETOPT_CommandLineOption options[] = {
int ret;
GNUNET_log_setup ("test_testing_topology_churn",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
ret = check ();
if (NULL == d->hostname)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Starting `%s', with command `%s %s %s %s %s %s'.\n",
- "gnunet-arm", "gnunet-arm", "-c", d->cfgfile, "-L", "DEBUG",
+ "Starting `%s', with command `%s %s %s %s'.\n",
+ "gnunet-arm", "gnunet-arm", "-c", d->cfgfile,
"-s");
d->proc_arm_start =
GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm", "gnunet-arm", "-c",
d->cfgfile,
- "-L", "DEBUG",
"-s", "-q", "-T",
GNUNET_TIME_relative_to_string
(GNUNET_TIME_absolute_get_remaining
dst = GNUNET_strdup (d->hostname);
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Starting `%s', with command `%s %s %s %s %s %s %s %s'.\n",
+ "Starting `%s', with command `%s %s %s %s %s %s %s'.\n",
"gnunet-arm", "ssh", dst, "gnunet-arm", "-c", d->cfgfile,
- "-L", "DEBUG", "-s", "-q");
+ "-s", "-q");
if (d->ssh_port_str == NULL)
{
d->proc_arm_start = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh",