#include "gnunet_testing_lib.h"
#include "gnunet_dht_service.h"
-#define VERBOSE GNUNET_YES
-
#define REMOVE_DIR GNUNET_YES
{
if (emsg != NULL)
{
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Shutdown of peers failed!\n");
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "test: Shutdown of peers failed: %s\n",
+ emsg);
ok++;
}
else
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"test: All peers successfully shut down!\n");
-#endif
}
GNUNET_CONFIGURATION_destroy (testing_cfg);
}
static void
shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Ending test.\n");
-#endif
-
if (disconnect_task != GNUNET_SCHEDULER_NO_TASK)
{
GNUNET_SCHEDULER_cancel (disconnect_task);
disconnect_task = GNUNET_SCHEDULER_NO_TASK;
}
-
if (data_file != NULL)
GNUNET_DISK_file_close (data_file);
GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
return;
}
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "************************************************************\n");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: Peer Group started successfully!\n");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Have %u connections\n",
+ "test: Peer Group started successfully with %u connections\n",
total_connections);
-#endif
-
if (data_file != NULL)
{
buf = NULL;
testing_cfg = GNUNET_CONFIGURATION_dup (cfg);
GNUNET_log_setup ("test_dht_monitor",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Starting daemons.\n");
GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing",
"use_progressbars", "YES");
-#endif
-
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (testing_cfg, "testing",
"num_peers", &num_peers))
char *const argv[] = { "test-dht-monitor",
"-c",
"test_dht_line.conf",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
NULL
};
#include "gnunet_core_service.h"
#include "gnunet_dht_service.h"
-/* DEFINES */
-#define VERBOSE GNUNET_NO
-
/* Timeout for entire testcase */
#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 30)
unsigned long long j;
struct TestGetContext *test_get;
-#if VERBOSE
- FPRINTF (stderr, "Issuing %llu GETs\n",
- (unsigned long long) (num_peers * num_peers));
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Issuing %llu GETs\n",
+ (unsigned long long) (num_peers * num_peers));
for (i = 0; i < num_peers; i++)
for (j = 0; j < num_peers; j++)
{
test_put->dht_handle = GNUNET_DHT_connect (test_put->daemon->cfg, 10);
GNUNET_assert (test_put->dht_handle != NULL);
outstanding_puts++;
-#if VERBOSE > 2
- FPRINTF (stderr, "PUT %u at `%s'\n", test_put->uid,
- GNUNET_i2s (&test_put->daemon->id));
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "PUT %u at `%s'\n", test_put->uid,
+ GNUNET_i2s (&test_put->daemon->id));
GNUNET_DHT_put (test_put->dht_handle, &key, 1, route_option,
GNUNET_BLOCK_TYPE_TEST, sizeof (data), data,
GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_UNIT_FOREVER_REL,
char *const argv[] = { "test-dht-multipeer", /* Name to give running binary */
"-c",
"test_dht_multipeer_data.conf", /* Config file to use */
-#if VERBOSE
- "-L", "DEBUG",
-#endif
NULL
};
struct GNUNET_GETOPT_CommandLineOption options[] = {
{
int ret;
-
GNUNET_log_setup ("test-dht-multipeer",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
ret = check ();
/**
#include "gnunet_testing_lib.h"
#include "gnunet_dht_service.h"
-#define VERBOSE GNUNET_NO
-
#define REMOVE_DIR GNUNET_YES
/**
GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
return;
}
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "************************************************************\n");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Peer Group started successfully!\n");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Have %u connections\n",
+ "Peer Group started successfully with %u connections\n",
total_connections);
-#endif
-
if (data_file != NULL)
{
buf = NULL;
testing_cfg = GNUNET_CONFIGURATION_dup (cfg);
GNUNET_log_setup ("test_dht_topo",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
-
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting daemons.\n");
GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing",
"use_progressbars", "YES");
-#endif
-
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (testing_cfg, "testing",
"num_peers", &num_peers))
char *const argv_torus[] = { "test-dht-2dtorus",
"-c",
"test_dht_2dtorus.conf",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
NULL
};
char *const argv_line[] = { "test-dht-line",
"-c",
"test_dht_line.conf",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
NULL
};
char *const *argv;
if (emsg == NULL)
{
total_connections++;
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"connected peer %s to peer %s, distance %u\n",
first_daemon->shortname, second_daemon->shortname, distance);
else
{
failed_connections++;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"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 VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Created %d total connections, which is our target number! Starting next phase of testing.\n",
total_connections);
-#endif
GNUNET_SCHEDULER_cancel (die_task);
die_task =
GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
if (peers_left == 0)
{
-#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 */
char *const argv[] = { "test-dht-twopeer",
"-c",
"test_dht_twopeer_data.conf",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
NULL
};
struct GNUNET_GETOPT_CommandLineOption options[] = {
int ret;
GNUNET_log_setup ("test-dht-twopeer",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
ret = check ();
/**
if (emsg == NULL)
{
total_connections++;
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"connected peer %s to peer %s, distance %u\n",
first_daemon->shortname, second_daemon->shortname, distance);
-#endif
}
-#if VERBOSE
else
{
failed_connections++;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"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 VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Created %d total connections, which is our target number! Starting next phase of testing.\n",
total_connections);
-#endif
GNUNET_SCHEDULER_cancel (die_task);
die_task =
GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, "from test gets");
if (peers_left == 0) /* Indicates all peers started */
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"All %d daemons started, now connecting peers!\n", num_peers);
-#endif
expected_connections = -1;
if ((pg != NULL)) /* Sanity check */
{
char *const argv[] = { "test-dht-twopeer-get-put", /* Name to give running binary */
"-c",
"test_dht_twopeer_data.conf", /* Config file to use */
-#if VERBOSE
- "-L", "DEBUG",
-#endif
NULL
};
struct GNUNET_GETOPT_CommandLineOption options[] = {
int ret;
GNUNET_log_setup ("test-dht-twopeer",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
ret = check ();
/**
if (emsg == NULL)
{
total_connections++;
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"connected peer %s to peer %s, distance %u\n",
first_daemon->shortname, second_daemon->shortname, distance);
-#endif
}
-#if VERBOSE
else
{
failed_connections++;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"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 VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Created %d total connections, which is our target number! Starting next phase of testing.\n",
total_connections);
-#endif
GNUNET_SCHEDULER_cancel (die_task);
die_task =
GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, "from test gets");
if (peers_left == 0) /* Indicates all peers started */
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"All %d daemons started, now connecting peers!\n", num_peers);
-#endif
expected_connections = -1;
if ((pg != NULL)) /* Sanity check */
{
char *const argv[] = { "test-dht-twopeer-put-get", /* Name to give running binary */
"-c",
"test_dht_twopeer_data.conf", /* Config file to use */
-#if VERBOSE
- "-L", "DEBUG",
-#endif
NULL
};
struct GNUNET_GETOPT_CommandLineOption options[] = {
int ret;
GNUNET_log_setup ("test-dht-twopeer",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
ret = check ();
/**