Exemplo n.º 1
0
int
main (int argc, char *argv[])
{
  char *test_source;
  int ret;

  static char *const argv_new[] = {
    "test-transport-api-reliability",
    "-c",
    "test_transport_api_data.conf",
    NULL
  };
  static struct GNUNET_GETOPT_CommandLineOption options[] = {
    GNUNET_GETOPT_OPTION_END
  };

  GNUNET_TRANSPORT_TESTING_get_test_name (argv[0],
                                          &test_name);
  GNUNET_log_setup (test_name,
                    "WARNING",
                    NULL);
  GNUNET_TRANSPORT_TESTING_get_test_source_name (__FILE__,
                                                 &test_source);
  GNUNET_TRANSPORT_TESTING_get_test_plugin_name (argv[0],
                                                 test_source,
                                                 &test_plugin);

  tth = GNUNET_TRANSPORT_TESTING_init ();

  GNUNET_TRANSPORT_TESTING_get_config_name (argv[0], &cfg_file_p1, 1);
  GNUNET_TRANSPORT_TESTING_get_config_name (argv[0], &cfg_file_p2, 2);

#if WRITECONFIG
  setTransportOptions ("test_transport_api_data.conf");
#endif
  ok = GNUNET_SYSERR;

  ret = GNUNET_PROGRAM_run ((sizeof (argv_new) / sizeof (char *)) - 1,
                            argv_new, test_name,
                            "nohelp", options,
                            &run, &ok);
  if (GNUNET_SYSERR == ret)
  {
    fprintf (stderr,
             "Test failed: %d\n",
             ok);
    ok = -1;
  }
  GNUNET_free (cfg_file_p1);
  GNUNET_free (cfg_file_p2);
  GNUNET_free (test_source);
  GNUNET_free (test_plugin);
  GNUNET_free (test_name);

  return ok;
}
static int
check ()
{
  static char *const argv[] = { "test-transport-api-unreliability",
    "-c",
    "test_transport_api_data.conf",
    NULL
  };
  static struct GNUNET_GETOPT_CommandLineOption options[] = {
    GNUNET_GETOPT_OPTION_END
  };

#if WRITECONFIG
  setTransportOptions ("test_transport_api_data.conf");
#endif
  ok = GNUNET_SYSERR;

  GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, test_name,
                      "nohelp", options, &run, &ok);

  return ok;
}
static int
check ()
{
  static char *const argv[] = { "test-transport-api-timeout",
    "-c",
    "test_transport_api_data.conf",
    NULL
  };
  static struct GNUNET_GETOPT_CommandLineOption options[] = {
    GNUNET_GETOPT_OPTION_END
  };

#if WRITECONFIG
  setTransportOptions ("test_transport_api_data.conf");
#endif
  timer_task = GNUNET_SCHEDULER_NO_TASK;

  ok = 1;
  GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
                      "test-transport-api-timeout", "nohelp", options, &run,
                      &ok);

  return ok;
}