diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2013-03-20 11:11:16 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2013-03-20 11:11:16 +0000 |
commit | 22c8a602e7ac8591652231b829cb324a13035f7c (patch) | |
tree | d54678b3b1401b8861a870e81252fd50cb3ab304 /src/testbed/gnunet-testbed-profiler.c | |
parent | 43a4120b2d2bd1f52265f0934d9eb5aded64204f (diff) | |
download | gnunet-22c8a602e7ac8591652231b829cb324a13035f7c.tar.gz gnunet-22c8a602e7ac8591652231b829cb324a13035f7c.zip |
- make hosts file optional when ENABLE_LL is not set; when it is not given use localhost only
Diffstat (limited to 'src/testbed/gnunet-testbed-profiler.c')
-rw-r--r-- | src/testbed/gnunet-testbed-profiler.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c index 686679e98..6c1c78032 100644 --- a/src/testbed/gnunet-testbed-profiler.c +++ b/src/testbed/gnunet-testbed-profiler.c | |||
@@ -48,6 +48,12 @@ struct GNUNET_CONFIGURATION_Handle *cfg; | |||
48 | struct GNUNET_TESTBED_Operation *topology_op; | 48 | struct GNUNET_TESTBED_Operation *topology_op; |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * Name of the file with the hosts to run the test over (configuration option). | ||
52 | * It will be NULL if ENABLE_LL is set | ||
53 | */ | ||
54 | static char *hosts_file; | ||
55 | |||
56 | /** | ||
51 | * Abort task identifier | 57 | * Abort task identifier |
52 | */ | 58 | */ |
53 | static GNUNET_SCHEDULER_TaskIdentifier abort_task; | 59 | static GNUNET_SCHEDULER_TaskIdentifier abort_task; |
@@ -226,27 +232,17 @@ static void | |||
226 | run (void *cls, char *const *args, const char *cfgfile, | 232 | run (void *cls, char *const *args, const char *cfgfile, |
227 | const struct GNUNET_CONFIGURATION_Handle *config) | 233 | const struct GNUNET_CONFIGURATION_Handle *config) |
228 | { | 234 | { |
229 | char *hostfile; | ||
230 | |||
231 | hostfile = NULL; | ||
232 | #if !ENABLE_LL | ||
233 | if (NULL == args[0]) | ||
234 | { | ||
235 | fprintf (stderr, _("No hosts-file specified on command line\n")); | ||
236 | return; | ||
237 | } | ||
238 | hostfile = args[0]; | ||
239 | #endif | ||
240 | if (0 == num_peers) | 235 | if (0 == num_peers) |
241 | { | 236 | { |
242 | result = GNUNET_OK; | 237 | LOG (GNUNET_ERROR_TYPE_ERROR, _("Exiting as the number of peers is %u\n"), |
238 | num_peers); | ||
243 | return; | 239 | return; |
244 | } | 240 | } |
245 | cfg = GNUNET_CONFIGURATION_dup (config); | 241 | cfg = GNUNET_CONFIGURATION_dup (config); |
246 | event_mask = 0; | 242 | event_mask = 0; |
247 | event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT); | 243 | event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT); |
248 | event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED); | 244 | event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED); |
249 | GNUNET_TESTBED_run (hostfile, cfg, num_peers, event_mask, controller_event_cb, | 245 | GNUNET_TESTBED_run (hosts_file, cfg, num_peers, event_mask, controller_event_cb, |
250 | NULL, &test_run, NULL); | 246 | NULL, &test_run, NULL); |
251 | abort_task = | 247 | abort_task = |
252 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &do_abort, | 248 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &do_abort, |
@@ -269,21 +265,21 @@ main (int argc, char *const *argv) | |||
269 | {'e', "num-errors", "COUNT", | 265 | {'e', "num-errors", "COUNT", |
270 | gettext_noop ("tolerate COUNT number of continious timeout failures"), | 266 | gettext_noop ("tolerate COUNT number of continious timeout failures"), |
271 | GNUNET_YES, &GNUNET_GETOPT_set_uint, &num_cont_fails}, | 267 | GNUNET_YES, &GNUNET_GETOPT_set_uint, &num_cont_fails}, |
268 | #if !ENABLE_LL | ||
269 | {'H', "hosts", "FILENAME", | ||
270 | gettext_noop ("name of the file with the login information for the testbed"), | ||
271 | GNUNET_YES, &GNUNET_GETOPT_set_string, &hosts_file}, | ||
272 | #endif | ||
272 | GNUNET_GETOPT_OPTION_END | 273 | GNUNET_GETOPT_OPTION_END |
273 | }; | 274 | }; |
274 | #if ENABLE_LL | ||
275 | const char *binaryHelp = "gnunet-testbed-profiler [OPTIONS]"; | 275 | const char *binaryHelp = "gnunet-testbed-profiler [OPTIONS]"; |
276 | #else | ||
277 | const char *binaryHelp = "gnunet-testbed-profiler [OPTIONS] hosts-file"; | ||
278 | #endif | ||
279 | |||
280 | int ret; | 276 | int ret; |
281 | 277 | ||
282 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 278 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) |
283 | return 2; | 279 | return 2; |
284 | result = GNUNET_SYSERR; | 280 | result = GNUNET_SYSERR; |
285 | ret = | 281 | ret = |
286 | GNUNET_PROGRAM_run (argc, argv, binaryHelp, _("Profiler for testbed"), | 282 | GNUNET_PROGRAM_run (argc, argv, "gnunet-testbed-profiler", binaryHelp, |
287 | options, &run, NULL); | 283 | options, &run, NULL); |
288 | GNUNET_free ((void *) argv); | 284 | GNUNET_free ((void *) argv); |
289 | if (GNUNET_OK != ret) | 285 | if (GNUNET_OK != ret) |