Copyright (C) 2008--2013 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
Copyright (C) 2008--2013 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
by the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
by the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
-#define FAIL_TEST(cond) do { \
- if (!(cond)) { \
- GNUNET_break(0); \
- if (NULL != abort_task) \
- GNUNET_SCHEDULER_cancel (abort_task); \
- abort_task = NULL; \
- GNUNET_SCHEDULER_shutdown (); \
- return; \
- } \
+#define FAIL_TEST(cond) \
+ do \
+ { \
+ if (! (cond)) \
+ { \
+ GNUNET_break (0); \
+ if (NULL != abort_task) \
+ GNUNET_SCHEDULER_cancel (abort_task); \
+ abort_task = NULL; \
+ GNUNET_SCHEDULER_shutdown (); \
+ return; \
+ } \
- LOG (GNUNET_ERROR_TYPE_WARNING,
- "Aborting in stage %d\n",
- result);
+ LOG (GNUNET_ERROR_TYPE_WARNING, "Aborting in stage %d\n", result);
op = GNUNET_TESTBED_peer_stop (NULL, slave1_peer, NULL, NULL);
FAIL_TEST (NULL != op);
break;
op = GNUNET_TESTBED_peer_stop (NULL, slave1_peer, NULL, NULL);
FAIL_TEST (NULL != op);
break;
case MASTER_SLAVE2_PEERS_CONNECTED:
slave3 = GNUNET_TESTBED_host_create_with_id (3, "127.0.0.1", NULL, cfg, 0);
rh = GNUNET_TESTBED_register_host (mc, slave3, ®istration_cont, NULL);
break;
case MASTER_SLAVE2_PEERS_CONNECTED:
slave3 = GNUNET_TESTBED_host_create_with_id (3, "127.0.0.1", NULL, cfg, 0);
rh = GNUNET_TESTBED_register_host (mc, slave3, ®istration_cont, NULL);
break;
case SLAVE2_SLAVE3_PEERS_CONNECTED:
op = GNUNET_TESTBED_peer_stop (NULL, slave2_peer, NULL, NULL);
FAIL_TEST (NULL != op);
break;
case SLAVE2_SLAVE3_PEERS_CONNECTED:
op = GNUNET_TESTBED_peer_stop (NULL, slave2_peer, NULL, NULL);
FAIL_TEST (NULL != op);
break;
-peer_create_cb (void *cls,
- struct GNUNET_TESTBED_Peer *peer,
- const char *emsg)
+peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
GNUNET_TESTBED_operation_done (op);
op = GNUNET_TESTBED_peer_start (NULL, master_peer, NULL, NULL);
break;
GNUNET_TESTBED_operation_done (op);
op = GNUNET_TESTBED_peer_start (NULL, master_peer, NULL, NULL);
break;
case SLAVE1_LINK_SUCCESS:
result = SLAVE1_PEER_CREATE_SUCCESS;
slave1_peer = peer;
GNUNET_TESTBED_operation_done (op);
op = GNUNET_TESTBED_peer_start (NULL, slave1_peer, NULL, NULL);
break;
case SLAVE1_LINK_SUCCESS:
result = SLAVE1_PEER_CREATE_SUCCESS;
slave1_peer = peer;
GNUNET_TESTBED_operation_done (op);
op = GNUNET_TESTBED_peer_start (NULL, slave1_peer, NULL, NULL);
break;
case SLAVE2_LINK_SUCCESS:
result = SLAVE2_PEER_CREATE_SUCCESS;
slave2_peer = peer;
GNUNET_TESTBED_operation_done (op);
op = NULL;
case SLAVE2_LINK_SUCCESS:
result = SLAVE2_PEER_CREATE_SUCCESS;
slave2_peer = peer;
GNUNET_TESTBED_operation_done (op);
op = NULL;
- delay_task_id =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 1),
- &delay_task,
- NULL);
+ delay_task_id = GNUNET_SCHEDULER_add_delayed (
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1),
+ &delay_task,
+ NULL);
case SLAVE3_STARTED:
result = SLAVE3_PEER_CREATE_SUCCESS;
slave3_peer = peer;
GNUNET_TESTBED_operation_done (op);
op = GNUNET_TESTBED_peer_start (NULL, slave3_peer, NULL, NULL);
break;
case SLAVE3_STARTED:
result = SLAVE3_PEER_CREATE_SUCCESS;
slave3_peer = peer;
GNUNET_TESTBED_operation_done (op);
op = GNUNET_TESTBED_peer_start (NULL, slave3_peer, NULL, NULL);
break;
op = GNUNET_TESTBED_peer_create (mc, slave, cfg, peer_create_cb, NULL);
FAIL_TEST (NULL != op);
break;
op = GNUNET_TESTBED_peer_create (mc, slave, cfg, peer_create_cb, NULL);
FAIL_TEST (NULL != op);
break;
case SLAVE1_PEER_START_SUCCESS:
check_operation_success (event);
GNUNET_TESTBED_operation_done (op);
case SLAVE1_PEER_START_SUCCESS:
check_operation_success (event);
GNUNET_TESTBED_operation_done (op);
op = GNUNET_TESTBED_peer_create (mc, slave2, cfg, peer_create_cb, NULL);
FAIL_TEST (NULL != op);
break;
op = GNUNET_TESTBED_peer_create (mc, slave2, cfg, peer_create_cb, NULL);
FAIL_TEST (NULL != op);
break;
case MASTER_PEER_CREATE_SUCCESS:
FAIL_TEST (GNUNET_TESTBED_ET_PEER_START == event->type);
FAIL_TEST (event->details.peer_start.host == host);
case MASTER_PEER_CREATE_SUCCESS:
FAIL_TEST (GNUNET_TESTBED_ET_PEER_START == event->type);
FAIL_TEST (event->details.peer_start.host == host);
rh = GNUNET_TESTBED_register_host (mc, slave, ®istration_cont, NULL);
FAIL_TEST (NULL != rh);
break;
rh = GNUNET_TESTBED_register_host (mc, slave, ®istration_cont, NULL);
FAIL_TEST (NULL != rh);
break;
case SLAVE1_PEER_CREATE_SUCCESS:
FAIL_TEST (GNUNET_TESTBED_ET_PEER_START == event->type);
FAIL_TEST (event->details.peer_start.host == slave);
case SLAVE1_PEER_CREATE_SUCCESS:
FAIL_TEST (GNUNET_TESTBED_ET_PEER_START == event->type);
FAIL_TEST (event->details.peer_start.host == slave);
result = SLAVE1_PEER_START_SUCCESS;
op = GNUNET_TESTBED_controller_link (NULL, mc, slave2, slave, GNUNET_YES);
break;
result = SLAVE1_PEER_START_SUCCESS;
op = GNUNET_TESTBED_controller_link (NULL, mc, slave2, slave, GNUNET_YES);
break;
case SLAVE2_PEER_CREATE_SUCCESS:
FAIL_TEST (GNUNET_TESTBED_ET_PEER_STOP == event->type);
FAIL_TEST (event->details.peer_stop.peer == slave1_peer);
case SLAVE2_PEER_CREATE_SUCCESS:
FAIL_TEST (GNUNET_TESTBED_ET_PEER_STOP == event->type);
FAIL_TEST (event->details.peer_stop.peer == slave1_peer);
op = GNUNET_TESTBED_peer_start (NULL, slave2_peer, NULL, NULL);
FAIL_TEST (NULL != op);
break;
op = GNUNET_TESTBED_peer_start (NULL, slave2_peer, NULL, NULL);
FAIL_TEST (NULL != op);
break;
case SLAVE3_PEER_CREATE_SUCCESS:
FAIL_TEST (GNUNET_TESTBED_ET_PEER_START == event->type);
FAIL_TEST (event->details.peer_start.host == slave3);
case SLAVE3_PEER_CREATE_SUCCESS:
FAIL_TEST (GNUNET_TESTBED_ET_PEER_START == event->type);
FAIL_TEST (event->details.peer_start.host == slave3);
- op = GNUNET_TESTBED_overlay_connect (mc, NULL, NULL, slave2_peer,
- slave3_peer);
+ op =
+ GNUNET_TESTBED_overlay_connect (mc, NULL, NULL, slave2_peer, slave3_peer);
case SLAVE3_PEER_START_SUCCESS:
FAIL_TEST (NULL != event);
FAIL_TEST (GNUNET_TESTBED_ET_CONNECT == event->type);
case SLAVE3_PEER_START_SUCCESS:
FAIL_TEST (NULL != event);
FAIL_TEST (GNUNET_TESTBED_ET_CONNECT == event->type);
- delay_task_id =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 1), &delay_task,
- NULL);
+ delay_task_id = GNUNET_SCHEDULER_add_delayed (
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1),
+ &delay_task,
+ NULL);
case SLAVE1_PEER_STOP_SUCCESS:
FAIL_TEST (GNUNET_TESTBED_ET_PEER_START == event->type);
FAIL_TEST (event->details.peer_start.host == slave2);
FAIL_TEST (event->details.peer_start.peer == slave2_peer);
GNUNET_TESTBED_operation_done (op);
result = SLAVE2_PEER_START_SUCCESS;
case SLAVE1_PEER_STOP_SUCCESS:
FAIL_TEST (GNUNET_TESTBED_ET_PEER_START == event->type);
FAIL_TEST (event->details.peer_start.host == slave2);
FAIL_TEST (event->details.peer_start.peer == slave2_peer);
GNUNET_TESTBED_operation_done (op);
result = SLAVE2_PEER_START_SUCCESS;
- op = GNUNET_TESTBED_overlay_connect (mc, NULL, NULL, master_peer,
- slave2_peer);
+ op =
+ GNUNET_TESTBED_overlay_connect (mc, NULL, NULL, master_peer, slave2_peer);
case SLAVE2_PEER_START_SUCCESS:
FAIL_TEST (NULL != event);
FAIL_TEST (GNUNET_TESTBED_ET_CONNECT == event->type);
case SLAVE2_PEER_START_SUCCESS:
FAIL_TEST (NULL != event);
FAIL_TEST (GNUNET_TESTBED_ET_CONNECT == event->type);
- delay_task_id =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 1), &delay_task,
- NULL);
+ delay_task_id = GNUNET_SCHEDULER_add_delayed (
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1),
+ &delay_task,
+ NULL);
case SLAVE2_SLAVE3_PEERS_CONNECTED:
FAIL_TEST (GNUNET_TESTBED_ET_PEER_STOP == event->type);
FAIL_TEST (event->details.peer_stop.peer == slave2_peer);
case SLAVE2_SLAVE3_PEERS_CONNECTED:
FAIL_TEST (GNUNET_TESTBED_ET_PEER_STOP == event->type);
FAIL_TEST (event->details.peer_stop.peer == slave2_peer);
case SLAVE2_PEER_STOP_SUCCESS:
check_operation_success (event);
GNUNET_TESTBED_operation_done (op);
case SLAVE2_PEER_STOP_SUCCESS:
check_operation_success (event);
GNUNET_TESTBED_operation_done (op);
case SLAVE1_PEER_DESTROY_SUCCESS:
check_operation_success (event);
GNUNET_TESTBED_operation_done (op);
case SLAVE1_PEER_DESTROY_SUCCESS:
check_operation_success (event);
GNUNET_TESTBED_operation_done (op);
case SLAVE2_PEER_DESTROY_SUCCESS:
FAIL_TEST (NULL != event);
FAIL_TEST (GNUNET_TESTBED_ET_OPERATION_FINISHED == event->type);
case SLAVE2_PEER_DESTROY_SUCCESS:
FAIL_TEST (NULL != event);
FAIL_TEST (GNUNET_TESTBED_ET_OPERATION_FINISHED == event->type);
result = SLAVE3_GET_CONFIG_SUCCESS;
op = GNUNET_TESTBED_controller_link (NULL, mc, slave3, slave, GNUNET_NO);
break;
result = SLAVE3_GET_CONFIG_SUCCESS;
op = GNUNET_TESTBED_controller_link (NULL, mc, slave3, slave, GNUNET_NO);
break;
op = GNUNET_TESTBED_peer_create (mc, slave3, cfg, peer_create_cb, NULL);
FAIL_TEST (NULL != op);
break;
op = GNUNET_TESTBED_peer_create (mc, slave3, cfg, peer_create_cb, NULL);
FAIL_TEST (NULL != op);
break;
case SLAVE3_GET_CONFIG_SUCCESS:
result = SLAVE3_LINK_SUCCESS;
GNUNET_TESTBED_operation_done (op);
op = GNUNET_TESTBED_peer_destroy (master_peer);
break;
case SLAVE3_GET_CONFIG_SUCCESS:
result = SLAVE3_LINK_SUCCESS;
GNUNET_TESTBED_operation_done (op);
op = GNUNET_TESTBED_peer_destroy (master_peer);
break;
case SLAVE3_LINK_SUCCESS:
check_operation_success (event);
result = MASTER_PEER_DESTROY_SUCCESS;
GNUNET_TESTBED_operation_done (op);
op = GNUNET_TESTBED_peer_destroy (slave3_peer);
break;
case SLAVE3_LINK_SUCCESS:
check_operation_success (event);
result = MASTER_PEER_DESTROY_SUCCESS;
GNUNET_TESTBED_operation_done (op);
op = GNUNET_TESTBED_peer_destroy (slave3_peer);
break;
case MASTER_PEER_DESTROY_SUCCESS:
result = SUCCESS;
GNUNET_TESTBED_operation_done (op);
op = NULL;
GNUNET_SCHEDULER_shutdown ();
break;
case MASTER_PEER_DESTROY_SUCCESS:
result = SUCCESS;
GNUNET_TESTBED_operation_done (op);
op = NULL;
GNUNET_SCHEDULER_shutdown ();
break;
rh = GNUNET_TESTBED_register_host (mc, slave2, ®istration_cont, NULL);
FAIL_TEST (NULL != rh);
break;
rh = GNUNET_TESTBED_register_host (mc, slave2, ®istration_cont, NULL);
FAIL_TEST (NULL != rh);
break;
op = GNUNET_TESTBED_controller_link (NULL, mc, slave, NULL, GNUNET_YES);
FAIL_TEST (NULL != op);
break;
op = GNUNET_TESTBED_controller_link (NULL, mc, slave, NULL, GNUNET_YES);
FAIL_TEST (NULL != op);
break;
op = GNUNET_TESTBED_controller_link (NULL, mc, slave3, NULL, GNUNET_YES);
FAIL_TEST (NULL != op);
break;
op = GNUNET_TESTBED_controller_link (NULL, mc, slave3, NULL, GNUNET_YES);
FAIL_TEST (NULL != op);
break;
event_mask |= (1L << GNUNET_TESTBED_ET_PEER_STOP);
event_mask |= (1L << GNUNET_TESTBED_ET_CONNECT);
event_mask |= (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED);
event_mask |= (1L << GNUNET_TESTBED_ET_PEER_STOP);
event_mask |= (1L << GNUNET_TESTBED_ET_CONNECT);
event_mask |= (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED);
FAIL_TEST (NULL != mc);
result = MASTER_STARTED;
op = GNUNET_TESTBED_peer_create (mc, host, cfg, peer_create_cb, NULL);
FAIL_TEST (NULL != op);
break;
FAIL_TEST (NULL != mc);
result = MASTER_STARTED;
op = GNUNET_TESTBED_peer_create (mc, host, cfg, peer_create_cb, NULL);
FAIL_TEST (NULL != op);
break;
"Unable to run the test as this system is not configured "
"to use password less SSH logins to localhost.\n"
"Skipping test\n");
"Unable to run the test as this system is not configured "
"to use password less SSH logins to localhost.\n"
"Skipping test\n");
- cp = GNUNET_TESTBED_controller_start ("127.0.0.1", host, status_cb,
- NULL);
+ cp = GNUNET_TESTBED_controller_start ("127.0.0.1", host, status_cb, NULL);
const struct GNUNET_CONFIGURATION_Handle *config)
{
cfg = GNUNET_CONFIGURATION_dup (config);
host = GNUNET_TESTBED_host_create (NULL, NULL, cfg, 0);
FAIL_TEST (NULL != host);
const struct GNUNET_CONFIGURATION_Handle *config)
{
cfg = GNUNET_CONFIGURATION_dup (config);
host = GNUNET_TESTBED_host_create (NULL, NULL, cfg, 0);
FAIL_TEST (NULL != host);
"Unable to run the test as this system is not configured "
"to use password less SSH logins to localhost.\n"
"Marking test as successful\n");
result = SKIP;
return;
}
"Unable to run the test as this system is not configured "
"to use password less SSH logins to localhost.\n"
"Marking test as successful\n");
result = SKIP;
return;
}
- abort_task =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_MINUTES, 5), &do_abort,
- NULL);
- GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
- NULL);
+ abort_task = GNUNET_SCHEDULER_add_delayed (
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5),
+ &do_abort,
+ NULL);
+ GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL);
main (int argc, char **argv)
{
char *const argv2[] = { "test_testbed_api_controllerlink",
main (int argc, char **argv)
{
char *const argv2[] = { "test_testbed_api_controllerlink",
- "-c", "test_testbed_api.conf",
- NULL
- };
- struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_OPTION_END
- };
+ "-c",
+ "test_testbed_api.conf",
+ NULL };
+ struct GNUNET_GETOPT_CommandLineOption options[] =
+ { GNUNET_GETOPT_OPTION_END };
- ret =
- GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
- "test_testbed_api_controllerlink", "nohelp", options,
- &run, NULL);
+ ret = GNUNET_PROGRAM_run ((sizeof(argv2) / sizeof(char *)) - 1,
+ argv2,
+ "test_testbed_api_controllerlink",
+ "nohelp",
+ options,
+ &run,
+ NULL);