int
main (int argc, char *const *argv)
{

  if (GNUNET_SYSERR == GNUNET_OS_check_helper_binary ("gnunet-gns-proxy"))
  {
    fprintf (stderr, "Proxy binary not in PATH... skipping!\n");
    return 0;
  }

  if (GNUNET_YES != GNUNET_OS_check_helper_binary ("gnunet-helper-dns"))
  {
    fprintf (stderr, "DNS helper binary has wrong permissions... skipping!\n");
    return 0;
  }

  GNUNET_CRYPTO_rsa_setup_hostkey ("test_gns_proxy.conf");
  
  if (0 != curl_global_init (CURL_GLOBAL_WIN32))
  {
    fprintf (stderr, "failed to initialize curl\n");
    return 2;
  }
  if (0 != GNUNET_TESTING_peer_run ("test-gnunet-gns-proxy",
				    "test_gns_proxy.conf",
				    &run, NULL))
    return 1;
  GNUNET_DISK_directory_remove ("/tmp/gnunet-test-gns-proxy");
  return global_ret;
}
Exemple #2
0
int
main (int argc, char *const *argv)
{
  char *binary;

  if (GNUNET_SYSERR == GNUNET_OS_check_helper_binary ("gnunet-gns-proxy", GNUNET_NO, NULL))
  {
    fprintf (stderr, "Proxy binary not in PATH... skipping!\n");
    return 0;
  }
  binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-dns");
  if (GNUNET_YES != GNUNET_OS_check_helper_binary (binary, GNUNET_YES, NULL)) // TODO: once we have a windows-testcase, add test parameters here
  {
    fprintf (stderr, "DNS helper binary has wrong permissions... skipping!\n");
    GNUNET_free (binary);
    return 0;
  }
    GNUNET_free (binary);

  if (0 != curl_global_init (CURL_GLOBAL_WIN32))
  {
    fprintf (stderr, "failed to initialize curl\n");
    return 2;
  }
  if (0 != GNUNET_TESTING_peer_run ("test-gnunet-gns-proxy",
				    "test_gns_proxy.conf",
				    &run, NULL))
    return 1;
  GNUNET_DISK_directory_remove ("/tmp/gnunet-test-gns-proxy");
  return global_ret;
}
/**
 * Main function
 */
int main (int argc, char **argv)
{
    if (0 != GNUNET_TESTING_peer_run ("test_stream_big",
                                      "test_stream_local.conf",
                                      &run, NULL))
        return 1;
    return (GNUNET_SYSERR == result) ? 1 : 0;
}
Exemple #4
0
int
main (int argc, char *argv[])
{
  if (0 != GNUNET_TESTING_peer_run ("test-fs-start-stop",
				    "test_fs_data.conf",
				    &run, NULL))
    return 1;
  return 0;
}
/**
 * Main function
 */
int
main (int argc, char **argv)
{
  if (0 !=
      GNUNET_TESTING_peer_run ("test_lockmanager_api_servercrash",
                               "test_lockmanager_api.conf", &run, NULL))
    return 1;
  return (TEST_CLIENT2_SERVER_CRASH_SUCCESS != result) ? 1 : 0;
}
int
main (int argc, char *argv[])
{
  if (0 != GNUNET_TESTING_peer_run ("test_ats_simplistic_change_preference",
                                    "test_ats_api.conf",
                                    &run, NULL))
    return 1;
  return ret;
}
int
main (int argc, char *argv[])
{
  if (0 != GNUNET_TESTING_peer_run ("test-fs-list-indexed",
				    "test_fs_list_indexed_data.conf",
				    &run, NULL))
    return 1;
  return 0;
}
int
main (int argc, char *argv[])
{
  if (0 != GNUNET_TESTING_peer_run ("test-fs-search-persistence",
				    "test_fs_search_data.conf",
				    &run, NULL))
    return 1;
  return 0;
}
int
main (int argc, char *argv[])
{
  if (0 != GNUNET_TESTING_peer_run ("test_ats_api_scheduling_update_address",
                                    "test_ats_api.conf",
                                    &run, NULL))
    return 1;
  return ret;
}
int
main (int argc, char *argv[])
{
  if (0 != GNUNET_TESTING_peer_run ("test_conversation_api",
				    "test_conversation.conf",
				    &run, NULL))
    return 1;
  return ok;
}
Exemple #11
0
int
main (int argc, char *argv1[])
{
  if (0 != GNUNET_TESTING_peer_run ("test-core-api-mq",
                                    "test_core_api_peer1.conf",
                                    &run, NULL))
    return 2;
  return (result == GNUNET_OK) ? 0 : 1;
}
int
main (int argc, char *argv[])
{
  if (0 != GNUNET_TESTING_peer_run ("test-fs-publish-persistence",
				    "test_fs_publish_data.conf",
				    &run, NULL))
    return 1;
  return err;
}
Exemple #13
0
int
main (int argc, char *argv[])
{
  if (0 != GNUNET_TESTING_peer_run ("test-fs-search-with-and",
				    "test_fs_search_data.conf",
				    &run, NULL))
    return 1;
  return err;
}
int
main (int argc, char *argv[])
{
  char *sep;
  char *src_filename = GNUNET_strdup (__FILE__);
  char *test_filename = GNUNET_strdup (argv[0]);
  char *config_file;
  char *solver;

  ret = 0;

  if (NULL == (sep  = (strstr (src_filename,".c"))))
  {
    GNUNET_break (0);
    return -1;
  }
  sep[0] = '\0';

  if (NULL != (sep = strstr (test_filename, ".exe")))
    sep[0] = '\0';

  if (NULL == (solver = strstr (test_filename, src_filename)))
  {
    GNUNET_break (0);
    return -1;
  }
  solver += strlen (src_filename) +1;

  if (0 == strcmp(solver, "proportional"))
  {
    config_file = "test_ats_solver_proportional.conf";
  }
  else if (0 == strcmp(solver, "mlp"))
  {
    config_file = "test_ats_solver_mlp.conf";
  }
  else if ((0 == strcmp(solver, "ril")))
  {
    config_file = "test_ats_solver_ril.conf";
  }
  else
  {
    GNUNET_break (0);
    GNUNET_free (src_filename);
    GNUNET_free (test_filename);
    return 1;
  }

  GNUNET_free (src_filename);
  GNUNET_free (test_filename);

  if (0 != GNUNET_TESTING_peer_run ("test-ats-solver",
      config_file, &run, NULL ))
    return GNUNET_SYSERR;

  return ret;
}
Exemple #15
0
int
main (int argc, char *argv[])
{
  if (0 != GNUNET_TESTING_peer_run ("test-fs-namespace",
				    "test_fs_namespace_data.conf",
				    &run, NULL))
    return 1;
  return err;
}
int
main (int argc, char **argv)
{
  if (0 != GNUNET_TESTING_peer_run ("test_set_api",
                                    "test_set.conf",
                                    &run, NULL))
    return 1;
  return ret;
}
int
main (int argc, char *argv[])
{
  if (0 != GNUNET_TESTING_peer_run ("test_ats_api_performance",
				    "test_ats_api.conf",
				    &run, NULL))
    return 1;
  return ret;
}
/**
 * The main function to test sending a message to the local peer via core
 *
 * @param argc number of arguments from the command line
 * @param argv command line arguments
 * @return 0 ok, 1 on error
 */
int
main (int argc, char *argv[])
{
  if (0 != GNUNET_TESTING_peer_run ("test-core-api-send-to-self",
				    "test_core_api_peer1.conf",
				    &run, NULL))
    return 1;
  return ret;
}
Exemple #19
0
int
main (int argc, char *argv[])
{
  if (0 != GNUNET_TESTING_peer_run ("test-dht-api",
				    "test_dht_api_data.conf",
				    &run, NULL))
    return 1;
  return ok;
}
/**
 * Main function
 */
int
main (int argc, char **argv)
{

  if (0 !=
      GNUNET_TESTING_peer_run ("test_lockmanager_api",
                               "test_lockmanager_api.conf", &run, NULL))
    return 1;
  return (TEST_FAIL == result) ? 1 : 0;
}
int
main (int argc, char *argv[])
{
    if (0 != GNUNET_TESTING_peer_run ("test-fs-namespace-list-updateable",
                                      "test_fs_namespace_data.conf",
                                      &run, NULL))
        return 1;
    do_shutdown ();
    return err;
}
int
main (int argc, char *argv[])
{
  ret = 0;
  if (0 != GNUNET_TESTING_peer_run ("test-ats-api",
                                    "test_ats_api.conf",
                                    &run, NULL))
    return 1;
  return ret;
}
int
main (int argc, char *argv[])
{
  ok = 1;
  GNUNET_log_setup ("test-gns-simple-mx-lookup",
                    "WARNING",
                    NULL);
  GNUNET_TESTING_peer_run ("test-gns-simple-mx-lookup", "test_gns_simple_lookup.conf", &do_check, NULL);
  return ok;
}
int
main (int argc, char *argv[])
{

  if (0 != GNUNET_TESTING_peer_run ("test_conversation_api_twocalls",
				    "test_conversation.conf",
				    &run, NULL))
    return 1;
  if (call1_finished && call2_finished)
    return 0;
  return 1;
}
Exemple #25
0
/**
 * Main
 */
int
main (int argc, char *argv[])
{
  if (0 != GNUNET_TESTING_peer_run ("test-cadet-local",
                                    "test_cadet.conf",
                                &run, NULL))
  {
    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "run failed\n");
    return 2;
  }
  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Final result: %d\n", result);
  return (result == GNUNET_OK) ? 0 : 1;
}
int
main (int argc, char **argv)
{
  empty = 1;
  if (0 != GNUNET_TESTING_peer_run ("test_set_api",
                                    "test_set.conf",
                                    &run, NULL))
  {
    return 1;
  }
  GNUNET_assert (0 == count_set1);
  GNUNET_assert (0 == count_set2);
  empty = 0;
  if (0 != GNUNET_TESTING_peer_run ("test_set_api",
                                    "test_set.conf",
                                    &run, NULL))
  {
    return 1;
  }
  GNUNET_break (2 == count_set1);
  GNUNET_break (1 == count_set2);
  return ret;
}
int
main (int argc, char *argv[])
{
  char cfg_name[128];

  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
  GNUNET_snprintf (cfg_name, sizeof (cfg_name),
                   "test_datastore_api_data_%s.conf", plugin_name);
  if (0 !=
      GNUNET_TESTING_peer_run ("perf-gnunet-datastore",
			       cfg_name,
			       &run,
			       NULL))
    return 1;
  FPRINTF (stderr, "%s", "\n");
  return ok;
}
int
main (int argc, char *argv[])
{
  res = 1;
  if (0 !=
      GNUNET_TESTING_peer_run ("test-namestore-api-zone-iteration",
                               "test_namestore_api.conf",
                               &run,
                               NULL))
  {
    res = 1;
  }
  if (NULL != directory)
  {
      GNUNET_DISK_directory_remove (directory);
      GNUNET_free (directory);
  }
  return res;
}
/**
 * Main function
 */
int main (int argc, char **argv)
{
  char *test_name = "perf_stream_api";
  char *cfg_file = "test_stream_local.conf";
  uint64_t event_mask;
  unsigned int count;
  int ret;

  meter = create_meter ((sizeof (data) / 4), "Generating random data\n", GNUNET_YES);
  for (count=0; count < (sizeof (data) / 4); count++)
  {
    data[count] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
                                            UINT32_MAX);
    update_meter (meter);
  }
  reset_meter (meter);
  free_meter (meter);
  meter = NULL;
  test_step = TEST_STEP_1_HOP;
  for (payload_size_index = 0;
       payload_size_index < (sizeof (payload_size) / sizeof (uint16_t));
       payload_size_index++)
  {
    PRINTF ("\nTesting over loopback with payload size %hu\n",
  	    payload_size[payload_size_index]);
    (void) memset (peer_data, 0, sizeof (peer_data));
    result = INIT;
    reset_read = GNUNET_NO;
    ret = GNUNET_TESTING_peer_run (test_name, cfg_file, &run, NULL);
    if ((0 != ret) || (DOWNLINK_OK != result))
      goto return_fail;
  }
  test_step = TEST_STEP_2_HOP;
  num_peers = 2;
  event_mask = 0;
  event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT);
  event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
  for (payload_size_index = 0;
       payload_size_index < (sizeof (payload_size) / sizeof (uint16_t));
       payload_size_index++)
  {
    PRINTF ("\nTesting over 1 hop with payload size %hu\n",
            payload_size[payload_size_index]);
    (void) memset (peer_data, 0, sizeof (peer_data));
    result = INIT;
    reset_read = GNUNET_NO;
    GNUNET_TESTBED_test_run (test_name, cfg_file, num_peers, event_mask,
    			     &controller_event_cb, NULL, &test_master, NULL);
    if (DOWNLINK_OK != result)
      goto return_fail;
  }
  test_step = TEST_STEP_3_HOP;
  for (payload_size_index = 0; 
       payload_size_index < (sizeof (payload_size) / sizeof (uint16_t));
       payload_size_index++)
  {
    /* Initialize testbed here */
  }
  return 0;

 return_fail:
  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Test failed\n");
  return 1;
}
Exemple #30
0
int
main (int argc, char *const *argv)
{
    char *sbin_iptables;
    char *bin_vpn;
    char *bin_exit;
    char *bin_dns;
    char *srv_dns;
    struct stat s;
    gid_t my_gid;
    char *const iptables_args[] =
    {
        "iptables", "-t", "mangle", "-L", "-v", NULL
    };

    if (0 == access ("/sbin/iptables", X_OK))
        sbin_iptables = "/sbin/iptables";
    else if (0 == access ("/usr/sbin/iptables", X_OK))
        sbin_iptables = "/usr/sbin/iptables";
    else
    {
        fprintf (stderr,
                 "Executable iptables not found in approved directories: %s, skipping\n",
                 strerror (errno));
        return 0;
    }

    if (0 != fork_and_exec (sbin_iptables, iptables_args))
    {
        fprintf (stderr,
                 "Failed to run `iptables -t mangle -L -v'. Skipping test.\n");
        return 0;
    }

    if (0 != ACCESS ("/dev/net/tun", R_OK))
    {
        GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
                                  "access",
                                  "/dev/net/tun");
        fprintf (stderr,
                 "WARNING: System unable to run test, skipping.\n");
        return 0;
    }

    bin_vpn = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-vpn");
    bin_exit = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-exit");
    bin_dns = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-dns");
    srv_dns = GNUNET_OS_get_libexec_binary_path ("gnunet-service-dns");
    if ( (0 != geteuid ()) &&
            ( (GNUNET_YES !=
               GNUNET_OS_check_helper_binary (bin_vpn, GNUNET_YES, "-d gnunet-vpn - - 169.1.3.3.7 255.255.255.0")) || //ipv4 only please!
              (GNUNET_YES !=
               GNUNET_OS_check_helper_binary (bin_exit, GNUNET_YES, "-d gnunet-vpn - - - 169.1.3.3.7 255.255.255.0")) || //no nat, ipv4 only
              (GNUNET_YES !=
               GNUNET_OS_check_helper_binary (bin_dns, GNUNET_YES, NULL))) ) // TODO: once we have a windows-testcase, add test parameters here
    {
        fprintf (stderr,
                 "WARNING: gnunet-helper-{exit,vpn,dns} binaries in $PATH are not SUID, refusing to run test (as it would have to fail).\n");
        fprintf (stderr,
                 "Change $PATH ('.' in $PATH before $GNUNET_PREFIX/bin is problematic) or permissions (run 'make install' as root) to fix this!\n");
        GNUNET_free (bin_vpn);
        GNUNET_free (bin_exit);
        GNUNET_free (bin_dns);
        GNUNET_free (srv_dns);
        return 0;
    }
    GNUNET_free (bin_vpn);
    GNUNET_free (bin_exit);
    my_gid = getgid ();
    if ( (0 != stat (bin_dns, &s)) ||
            (my_gid == s.st_gid) ||
            ( (0 == (S_ISUID & s.st_mode)) && (0 != getuid()) ) )
    {
        fprintf (stderr,
                 "WARNING: %s has wrong permissions (%d, %d, %d), refusing to run test (as it would have to fail).\n",
                 bin_dns,
                 (0 != stat (bin_dns, &s)),
                 (my_gid == s.st_gid),
                 (0 == (S_ISUID & s.st_mode)) || (0 != getuid()) );
        GNUNET_free (bin_dns);
        GNUNET_free (srv_dns);
        return 0;
    }
    if ( (0 != stat (srv_dns, &s)) ||
            (my_gid == s.st_gid) ||
            (0 == (S_ISGID & s.st_mode)) )
    {
        fprintf (stderr,
                 "WARNING: %s has wrong permissions (%d, %d, %d), refusing to run test (as it would have to fail).\n",
                 srv_dns,
                 (0 != stat (bin_dns, &s)),
                 (my_gid == s.st_gid),
                 (0 == (S_ISGID & s.st_mode)) );
        GNUNET_free (bin_dns);
        GNUNET_free (srv_dns);
        return 0;
    }
    GNUNET_free (bin_dns);
    GNUNET_free (srv_dns);

    dest_ip = "169.254.86.1";
    dest_af = AF_INET;
    src_af = AF_INET;

    if (GNUNET_OK == GNUNET_NETWORK_test_pf (PF_INET6))
        use_v6 = GNUNET_YES;
    else
        use_v6 = GNUNET_NO;

    if ( (GNUNET_OK != GNUNET_NETWORK_test_pf (src_af)) ||
            (GNUNET_OK != GNUNET_NETWORK_test_pf (dest_af)) )
    {
        fprintf (stderr,
                 "Required address families not supported by this system, skipping test.\n");
        return 0;
    }
    if (0 != curl_global_init (CURL_GLOBAL_WIN32))
    {
        fprintf (stderr, "failed to initialize curl\n");
        return 2;
    }


    if (0 != GNUNET_TESTING_peer_run ("test-gnunet-vpn",
                                      "test_gns_vpn.conf",
                                      &run, NULL))
        return 1;
    GNUNET_DISK_directory_remove ("/tmp/gnunet-test-vpn");
    return global_ret;
}