static void end () { unsigned long long delta; char *value_name; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value; FPRINTF (stderr, "\nThroughput was %llu kb/s\n", total_bytes * 1000 / 1024 / delta); GNUNET_asprintf (&value_name, "reliable_%s", test_plugin); GAUGER ("TRANSPORT", value_name, (int) (total_bytes * 1000 / 1024 / delta), "kb/s"); GNUNET_free (value_name); if (die_task != GNUNET_SCHEDULER_NO_TASK) GNUNET_SCHEDULER_cancel (die_task); if (th != NULL) GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); th = NULL; if (cc != NULL) GNUNET_TRANSPORT_TESTING_connect_peers_cancel (tth, cc); GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); GNUNET_TRANSPORT_TESTING_done (tth); }
int main (int argc, char *argv[]) { int ret; GNUNET_TRANSPORT_TESTING_get_test_name (argv[0], &test_name); GNUNET_TRANSPORT_TESTING_get_test_source_name (__FILE__, &test_source); GNUNET_TRANSPORT_TESTING_get_test_plugin_name (argv[0], test_source, &test_plugin); GNUNET_log_setup (test_name, "WARNING", NULL); 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); ret = check (); GNUNET_free (cfg_file_p1); GNUNET_free (cfg_file_p2); GNUNET_free (test_source); GNUNET_free (test_plugin); GNUNET_free (test_name); GNUNET_TRANSPORT_TESTING_done (tth); return ret; }
static void end_badly () { die_task = GNUNET_SCHEDULER_NO_TASK; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); if (test_connected == GNUNET_YES) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peers got connected\n"); else GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peers got NOT connected\n"); if (th != NULL) GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); th = NULL; if (cc != NULL) GNUNET_TRANSPORT_TESTING_connect_peers_cancel (tth, cc); if (p1 != NULL) GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); if (p2 != NULL) GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); GNUNET_TRANSPORT_TESTING_done (tth); ok = GNUNET_SYSERR; }
static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { die_task = GNUNET_SCHEDULER_NO_TASK; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); if (timer_task != GNUNET_SCHEDULER_NO_TASK) { GNUNET_SCHEDULER_cancel (timer_task); timer_task = GNUNET_SCHEDULER_NO_TASK; } if (cc != NULL) GNUNET_TRANSPORT_TESTING_connect_peers_cancel (tth, cc); if (th != NULL) GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); th = NULL; if (p1 != NULL) GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); if (p2 != NULL) GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); ok = GNUNET_SYSERR; GNUNET_TRANSPORT_TESTING_done (tth); }
int main (int argc, char *argv0[]) { ok = 1; GNUNET_TRANSPORT_TESTING_get_test_name (argv0[0], &test_name); GNUNET_log_setup ("test-transport-api-blacklisting", "WARNING", NULL); static char *const argv[] = { "date", "-c", "test_transport_api_data.conf", NULL }; static struct GNUNET_GETOPT_CommandLineOption options[] = { GNUNET_GETOPT_OPTION_END }; tth = GNUNET_TRANSPORT_TESTING_init (); GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, "test-transport-api-blacklisting", "nohelp", options, &run, NULL); GNUNET_TRANSPORT_TESTING_done (tth); return ok; }
static void end () { unsigned long long delta; unsigned long long rate; char *value_name; unsigned int i; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); /* Calculcate statistics */ delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us; rate = (1000LL* 1000ll * total_bytes) / (1024 * delta); FPRINTF (stderr, "\nThroughput was %llu KiBytes/s\n", rate); GNUNET_asprintf (&value_name, "unreliable_%s", test_plugin); GAUGER ("TRANSPORT", value_name, (int) rate, "kb/s"); GNUNET_free (value_name); if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); if (th != NULL) { GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); th = NULL; } if (cc != NULL) { GNUNET_TRANSPORT_TESTING_connect_peers_cancel (tth, cc); cc = NULL; } GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); GNUNET_TRANSPORT_TESTING_done (tth); ok = 0; for (i = 0; i < TOTAL_MSGS; i++) { if (get_bit (bitmap, i) == 0) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Did not receive message %d\n", i); ok = -1; } } }
static void end () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); if (timeout_task != GNUNET_SCHEDULER_NO_TASK) GNUNET_SCHEDULER_cancel (timeout_task); GNUNET_TRANSPORT_TESTING_stop_peer (tth, p); GNUNET_TRANSPORT_TESTING_done (tth); }
static void end () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); if (NULL != timeout_task) GNUNET_SCHEDULER_cancel (timeout_task); if (NULL != p) GNUNET_TRANSPORT_TESTING_stop_peer (p); if (NULL != tth) GNUNET_TRANSPORT_TESTING_done (tth); }
static void end_badly () { timeout_task = GNUNET_SCHEDULER_NO_TASK; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); if (NULL != p) GNUNET_TRANSPORT_TESTING_stop_peer (tth, p); if (NULL != tth) GNUNET_TRANSPORT_TESTING_done (tth); ret = GNUNET_SYSERR; }
static void end_badly () { die_task = GNUNET_SCHEDULER_NO_TASK; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); if (test_connected == GNUNET_YES) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peers got connected\n"); else GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peers got NOT connected\n"); if (test_sending == GNUNET_NO) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Testcase did not send any messages before timeout\n"); else GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Reliability failed: Last message sent %u, Next message scheduled %u, Last message received %u, Message expected %u\n", msg_sent, msg_scheduled, msg_recv, msg_recv_expected); if (test_send_timeout == GNUNET_YES) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Test had timeout while waiting to send data\n"); int i; for (i = 0; i < TOTAL_MSGS; i++) { if (get_bit (bitmap, i) == 0) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Did not receive message %d\n", i); ok = -1; } } if (th != NULL) GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); th = NULL; if (cc != NULL) GNUNET_TRANSPORT_TESTING_connect_peers_cancel (tth, cc); cc = NULL; if (p1 != NULL) GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); if (p2 != NULL) GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); GNUNET_TRANSPORT_TESTING_done (tth); ok = GNUNET_SYSERR; }
static void end_badly () { unsigned int i; die_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Stopping peers\n"); if (test_connected == GNUNET_YES) GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Peers got connected\n"); else GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peers got NOT connected\n"); if (test_sending == GNUNET_NO) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Testcase did not send any messages before timeout\n"); if (test_send_timeout == GNUNET_YES) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Test had timeout while waiting to send data\n"); for (i = 0; i < TOTAL_MSGS; i++) { if (get_bit (bitmap, i) == 0) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Did not receive message %u\n", i); ok = -1; } } if (th != NULL) { GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); th = NULL; } if (cc != NULL) { GNUNET_TRANSPORT_TESTING_connect_peers_cancel (tth, cc); cc = NULL; } if (p1 != NULL) GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); if (p2 != NULL) GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); GNUNET_TRANSPORT_TESTING_done (tth); ok = GNUNET_SYSERR; }
int main (int argc, char *argv[]) { int ret; GNUNET_log_setup ("test-transport-api-blacklisting", "WARNING", NULL); tth = GNUNET_TRANSPORT_TESTING_init (); ret = check (); GNUNET_TRANSPORT_TESTING_done (tth); return ret; }
int main (int argc, char *argv[]) { 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); check (); GNUNET_free (cfg_file_p1); GNUNET_free (cfg_file_p2); if (GNUNET_YES == GNUNET_DISK_file_test (gen_cfg_p1)) { GNUNET_DISK_directory_remove (gen_cfg_p1); GNUNET_free (gen_cfg_p1); } if (GNUNET_YES == GNUNET_DISK_file_test (gen_cfg_p2)) { GNUNET_DISK_directory_remove (gen_cfg_p2); GNUNET_free (gen_cfg_p2); } GNUNET_free (test_source); GNUNET_free (test_plugin); GNUNET_free (test_name); GNUNET_TRANSPORT_TESTING_done (tth); return test_failed; }
int main (int argc, char *argv[]) { int ret; GNUNET_TRANSPORT_TESTING_get_test_name (argv[0], &test_name); GNUNET_log_setup (test_name, "WARNING", NULL); tth = GNUNET_TRANSPORT_TESTING_init (); GNUNET_asprintf (&cfg_file_p1, "test_transport_api_tcp_peer1.conf"); GNUNET_asprintf (&cfg_file_p2, "test_transport_api_tcp_peer2.conf"); ret = check (); GNUNET_free (cfg_file_p1); GNUNET_free (cfg_file_p2); GNUNET_free (test_name); GNUNET_TRANSPORT_TESTING_done (tth); return ret; }
static void end () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); if (send_task != GNUNET_SCHEDULER_NO_TASK) GNUNET_SCHEDULER_cancel (send_task); if (die_task != GNUNET_SCHEDULER_NO_TASK) GNUNET_SCHEDULER_cancel (die_task); if (th != NULL) GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); th = NULL; GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); GNUNET_TRANSPORT_TESTING_done (tth); }
static void end () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); if (timer_task != NULL) { GNUNET_SCHEDULER_cancel (timer_task); timer_task = NULL; } if (die_task != NULL) { GNUNET_SCHEDULER_cancel (die_task); die_task = NULL; } if (th != NULL) GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); th = NULL; GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); if (disconnects == 0) ok = 0; else { ok = disconnects; GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Had %u disconnects while waiting %s\n", disconnects, GNUNET_STRINGS_relative_time_to_string (WAIT, GNUNET_YES)); } GNUNET_TRANSPORT_TESTING_done (tth); }
static void end_badly () { timeout_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout! Stopping peers\n"); if (NULL != cc) { GNUNET_TRANSPORT_TESTING_connect_peers_cancel (tth, cc); cc = NULL; } if (p1 != NULL) GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); if (p2 != NULL) GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); if (NULL != tth) GNUNET_TRANSPORT_TESTING_done (tth); ret = GNUNET_SYSERR; }
static void end () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); if (timer_task != GNUNET_SCHEDULER_NO_TASK) { GNUNET_SCHEDULER_cancel (timer_task); timer_task = GNUNET_SCHEDULER_NO_TASK; } if (die_task != GNUNET_SCHEDULER_NO_TASK) { GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_NO_TASK; } if (th != NULL) GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); th = NULL; GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); if (disconnects == 0) ok = 0; else { ok = disconnects; GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Had %u disconnects while waiting %llu seconds \n", disconnects, WAIT.rel_value); } GNUNET_TRANSPORT_TESTING_done (tth); }