35 #define LOG(kind, ...) \
36 GNUNET_log (kind, __VA_ARGS__)
145 static int printed_already;
151 printf (
"%u links failed due to timeouts\n",
failed_links);
176 printf (
"\nAborting due to very high failure rate\n");
189 printf (
"Establishing links. Please wait\n");
217 unsigned int links_succeeded,
218 unsigned int links_failed)
221 fprintf (stdout,
"\n");
230 fprintf (stdout,
"Testbed running, waiting for keystroke to shut down\n");
233 fprintf (stdout,
"Shutting down. Please wait\n");
248 run (
void *cls,
char *
const *
args,
const char *cfgfile,
276 main (
int argc,
char *
const *argv)
288 "tolerate COUNT number of continuous timeout failures"),
293 "run profiler in non-interactive mode where upon "
294 "testbed setup the profiler does not wait for a "
295 "keystroke but continues to run until a termination "
296 "signal is received"),
302 "name of the file with the login information for the testbed"),
306 const char *binaryHelp =
"gnunet-testbed-profiler [OPTIONS]";
309 unsetenv (
"XDG_DATA_HOME");
310 unsetenv (
"XDG_CONFIG_HOME");
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
struct GNUNET_GETOPT_CommandLineOption options[]
#define gettext_noop(String)
static int ret
Return value of the commandline.
static struct GNUNET_ARM_Handle * h
Connection with ARM.
static struct CadetPeer * peers
Operation to get peer ids.
static const struct GNUNET_CONFIGURATION_Handle * config
static struct GNUNET_SCHEDULER_Task * abort_task
Abort task identifier.
static void test_run(void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, unsigned int links_succeeded, unsigned int links_failed)
Signature of a main function for a testcase.
static void controller_event_cb(void *cls, const struct GNUNET_TESTBED_EventInformation *event)
Controller event callback.
static unsigned int num_cont_fails
Number of timeout failures to tolerate.
static void do_abort(void *cls)
abort task to run on test timed out
struct GNUNET_CONFIGURATION_Handle * cfg
Handle to global configuration.
static void do_shutdown(void *cls)
Shutdown nicely.
uint64_t event_mask
Global event mask for all testbed events.
static char * hosts_file
Name of the file with the hosts to run the test over (configuration option).
static int result
Global testing status.
static int noninteractive
Are we running non interactively.
static unsigned int cont_fails
Continuous failures during overlay connect operations.
struct GNUNET_TESTBED_Operation * topology_op
Peer linking - topology operation.
static unsigned int failed_links
Links which are not successfully established.
static void print_overlay_links_summary()
Function to print summary about how many overlay links we have made and how many failed.
#define LOG(kind,...)
Generic loggins shorthand.
int main(int argc, char *const *argv)
Main function.
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *config)
Main function that will be run by the scheduler.
static unsigned int num_peers
Number of peers to be started by the profiler.
static unsigned int established_links
Links which are successfully established.
API for writing tests and creating large-scale emulation testbeds for GNUnet.
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_dup(const struct GNUNET_CONFIGURATION_Handle *cfg)
Duplicate an existing configuration object.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_uint(char shortName, const char *name, const char *argumentHelp, const char *description, unsigned int *val)
Allow user to specify an unsigned int.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_flag(char shortName, const char *name, const char *description, int *val)
Allow user to specify a flag (which internally means setting an integer to 1/GNUNET_YES/GNUNET_OK.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_string(char shortName, const char *name, const char *argumentHelp, const char *description, char **str)
Allow user to specify a string.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_ERROR
#define GNUNET_free_nz(ptr)
Wrapper around free.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration,...
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received,...
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
enum GNUNET_GenericReturnValue GNUNET_STRINGS_get_utf8_args(int argc, char *const *argv, int *u8argc, char *const **u8argv)
Returns utf-8 encoded arguments.
void GNUNET_TESTBED_run(const char *host_filename, const struct GNUNET_CONFIGURATION_Handle *cfg, unsigned int num_peers, uint64_t event_mask, GNUNET_TESTBED_ControllerCallback cc, void *cc_cls, GNUNET_TESTBED_TestMaster test_master, void *test_master_cls)
Convenience method for running a testbed with a single call.
@ GNUNET_TESTBED_ET_CONNECT
A connection between two peers was established.
@ GNUNET_TESTBED_ET_OPERATION_FINISHED
A requested testbed operation has been completed.
Definition of a command line option.
Entry in list of pending tasks.
Opaque handle to an abstract operation to be executed by the testing framework.
A peer controlled by the testing framework.
internal API to access the 'hosts' subsystem