/** * Run a test using the given name, configuration file and number of * peers. * All mesh callbacks will receive the peer number as the closure. * * @param testname Name of the test (for logging). * @param cfgname Name of the configuration file. * @param num_peers Number of peers to start. * @param tmain Main function to run once the testbed is ready. * @param tmain_cls Closure for 'tmain'. * @param new_tunnel Handler for incoming tunnels. * @param cleaner Cleaner for destroyed incoming tunnels. * @param handlers Message handlers. * @param stypes Application types. */ void GNUNET_MESH_TEST_run (const char *testname, const char *cfgname, unsigned int num_peers, GNUNET_MESH_TEST_AppMain tmain, void *tmain_cls, GNUNET_MESH_InboundTunnelNotificationHandler new_tunnel, GNUNET_MESH_TunnelEndHandler cleaner, struct GNUNET_MESH_MessageHandler* handlers, const GNUNET_MESH_ApplicationType* stypes) { struct GNUNET_MESH_TEST_Context *ctx; ctx = GNUNET_malloc (sizeof (struct GNUNET_MESH_TEST_Context)); ctx->num_peers = num_peers; ctx->ops = GNUNET_malloc (num_peers * sizeof (struct GNUNET_TESTBED_Operation *)); ctx->meshes = GNUNET_malloc (num_peers * sizeof (struct GNUNET_MESH_Handle *)); ctx->app_main = tmain; ctx->app_main_cls = tmain_cls; ctx->new_tunnel = new_tunnel; ctx->cleaner = cleaner; ctx->handlers = handlers; ctx->stypes = stypes; GNUNET_TESTBED_test_run (testname, cfgname, num_peers, 0LL, NULL, NULL, &mesh_test_run, ctx); }
/** * Main function */ int main (int argc, char **argv) { struct GNUNET_CONFIGURATION_Handle *cfg; char pwd[PATH_MAX]; char *binary; uint64_t event_mask; result = GNUNET_SYSERR; event_mask = 0; cfg = GNUNET_CONFIGURATION_create (); GNUNET_assert (GNUNET_YES == GNUNET_CONFIGURATION_parse (cfg, "test_testbed_api_barriers.conf.in")); if (NULL == getcwd (pwd, PATH_MAX)) return 1; GNUNET_assert (0 < GNUNET_asprintf (&binary, "%s/%s", pwd, "gnunet-service-test-barriers")); GNUNET_CONFIGURATION_set_value_string (cfg, "test-barriers","BINARY", binary); GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_write (cfg, "test_testbed_api_barriers.conf")); GNUNET_CONFIGURATION_destroy (cfg); cfg = NULL; GNUNET_free (binary); binary = NULL; (void) GNUNET_TESTBED_test_run ("test_testbed_api_barriers", "test_testbed_api_barriers.conf", NUM_PEERS, event_mask, NULL, NULL, &test_master, NULL); (void) unlink ("test_testbed_api_barriers.conf"); if (GNUNET_OK != result) return 1; return 0; }
int main (int argc, char *argv[]) { GNUNET_log_setup (testname, "INFO", NULL); if (GNUNET_OK == GNUNET_TESTBED_test_run (testname, cfg_filename, NUM_PEERS, 0, NULL, NULL, &test_master, NULL)) return ok; return 1; }
int main (int argc, char *argv[]) { GNUNET_TESTBED_test_run ("test-gnunet-daemon-topology", "test_gnunet_daemon_topology_data.conf", NUM_PEERS, 0, NULL, NULL, &do_connect, NULL); GNUNET_DISK_directory_remove ("/tmp/test-gnunet-topology"); return ok; }
/** * Entry point for the testcase, sets up the testbed. * * @param argc unused * @param argv unused * @return 0 on success */ int main (int argc, char *argv[]) { ok = 1; (void) GNUNET_TESTBED_test_run ("test-nse-multipeer", "test_nse.conf", NUM_PEERS, 0, NULL, NULL, &run, NULL); return ok; }
/** * Main function that initializes the testbed. * * @param argc ignored * @param argv ignored * @return 0 on success */ int main (int argc, char *argv[]) { GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/"); (void) GNUNET_TESTBED_test_run ("test_fs_test_lib", "fs_test_lib_data.conf", NUM_DAEMONS, 0, NULL, NULL, &run, NULL); GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/"); return ret; }
int main (int argc, char *argv[]) { ok = 1; /* Connecting initial topology */ (void) GNUNET_TESTBED_test_run ("test-transport-dv", "test_transport_dv_data.conf", 4, 0, NULL, NULL, &test_connection, NULL); return ok; }
int main (int argc, char *argv[]) { (void) GNUNET_TESTBED_test_run ("test-gnunet-service-fs-migration", "fs_test_lib_data.conf", 2, 0, NULL, NULL, &do_publish, NULL); GNUNET_DISK_directory_remove ("/tmp/test-gnunet-service-fs-migration/"); return ok; }
int main (int argc, char *argv[]) { progname = argv[0]; (void) GNUNET_TESTBED_test_run ("perf-gnunet-service-fs-p2p-respect", "perf_gnunet_service_fs_p2p.conf", NUM_DAEMONS, 0, NULL, NULL, &do_connect, NULL); GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/"); return ok; }
static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) { static char *session_str = "gnunet-consensus/test"; char *topology; int topology_cmp_result; if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "testbed", "OVERLAY_TOPOLOGY", &topology)) { fprintf (stderr, "'OVERLAY_TOPOLOGY' not found in 'testbed' config section, " "seems like you passed the wrong configuration file\n"); return; } topology_cmp_result = strcasecmp (topology, "NONE"); GNUNET_free (topology); if (0 == topology_cmp_result) { fprintf (stderr, "'OVERLAY_TOPOLOGY' set to 'NONE', " "seems like you passed the wrong configuration file\n"); return; } if (num_peers < replication) { fprintf (stderr, "k must be <=n\n"); return; } start = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), consensus_delay); deadline = GNUNET_TIME_absolute_add (start, conclude_timeout); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "running gnunet-consensus\n"); GNUNET_CRYPTO_hash (session_str, strlen(session_str), &session_id); (void) GNUNET_TESTBED_test_run ("gnunet-consensus", cfgfile, num_peers, 0, controller_cb, NULL, test_master, NULL); }
/** * Main function */ int main (int argc, char **argv) { uint64_t event_mask; result = GNUNET_SYSERR; event_mask = 0; event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT); event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED); GNUNET_TESTBED_test_run ("test_testbed_api_test", "test_testbed_api.conf", NUM_PEERS, event_mask, &controller_event_cb, NULL, &test_master, NULL); if (GNUNET_OK != result) return 1; return 0; }
int main (int argc, char *argv[]) { uint64_t event_mask; ok = 0; event_mask = 0; event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT); event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED); (void) GNUNET_TESTBED_test_run ("test_gns_dht_three_peers", "test_gns_dht_default.conf", 3, event_mask, &testbed_controller_cb, NULL, &testbed_master, NULL); if (GNUNET_SYSERR == ok) return 1; return 0; }
int main (int argc, char **argv) { int ret; result = GNUNET_SYSERR; ret = GNUNET_TESTBED_test_run("test mqtt unsubscribe operation", /* test case name */ "template_single_peer.conf", /* template configuration */ 1, /* number of peers to start */ 0LL, /* Event mask -set to 0 for no event notifications */ NULL, /* Controller event callback */ NULL, /* Closure for controller event callback */ &test_master, /* continuation callback to be called when testbed setup is complete */ NULL); /* Closure for the test_master callback */ if ( (GNUNET_OK != ret) || (GNUNET_OK != result) ) return 1; return 0; }
int main (int argc, char **argv) { int ret; result = GNUNET_SYSERR; system("perl -p -i -e 's/\\$\\{([^}]+)\\}/defined $ENV{$1} ? $ENV{$1} : $&/eg' < " CONFIG_FILE " > " CONFIG_FILE_PARSED " 2> /dev/null\n"); ret = GNUNET_TESTBED_test_run("test mqtt regex", /* test case name */ CONFIG_FILE_PARSED, /* template configuration */ 2, /* number of peers to start */ 0LL, /* Event mask -set to 0 for no event notifications */ NULL, /* Controller event callback */ NULL, /* Closure for controller event callback */ &test_master, /* continuation callback to be called when testbed setup is complete */ NULL); /* Closure for the test_master callback */ if ( (GNUNET_OK != ret) || (GNUNET_OK != result) ) return 1; return 0; }
int main (int argc, char *argv[]) { int ret; result = GNUNET_SYSERR; ret = GNUNET_TESTBED_test_run ("test-multicast-multipeer", /* test case name */ "test_multicast.conf", /* template configuration */ NUM_PEERS, /* number of peers to start */ 0LL, /* Event mask - set to 0 for no event notifications */ NULL, /* Controller event callback */ NULL, /* Closure for controller event callback */ run, /* continuation callback to be called when testbed setup is complete */ NULL); /* Closure for the test_master callback */ if ( (GNUNET_OK != ret) || (GNUNET_OK != result) ) return 1; return 0; }
/** * Run a test using the given name, configuration file and number of * peers. * * @param testname name of the test (for logging) * @param cfgname name of the configuration file * @param num_peers number of peers to start * @param tmain main function to run once the testbed is ready * @param tmain_cls closure for 'tmain' */ void GNUNET_DHT_TEST_run (const char *testname, const char *cfgname, unsigned int num_peers, GNUNET_DHT_TEST_AppMain tmain, void *tmain_cls) { struct GNUNET_DHT_TEST_Context *ctx; ctx = GNUNET_malloc (sizeof (struct GNUNET_DHT_TEST_Context)); ctx->num_peers = num_peers; ctx->ops = GNUNET_malloc (num_peers * sizeof (struct GNUNET_TESTBED_Operation *)); ctx->dhts = GNUNET_malloc (num_peers * sizeof (struct GNUNET_DHT_Handle *)); ctx->app_main = tmain; ctx->app_main_cls = tmain_cls; (void) GNUNET_TESTBED_test_run (testname, cfgname, num_peers, 0LL, NULL, NULL, &dht_test_run, ctx); }
/** * 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; }