diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-06-27 14:43:43 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-06-27 14:43:43 +0000 |
commit | b0474eb7a6aa570c04e4d76fd664caa406b3dd30 (patch) | |
tree | 3c75a22df7f927addeb3b6ca51c266088b6978fd /src/testbed/test_testbed_api.c | |
parent | 6f9c566127d0737ecd529f458dc28b7fc02e6eb9 (diff) | |
download | gnunet-b0474eb7a6aa570c04e4d76fd664caa406b3dd30.tar.gz gnunet-b0474eb7a6aa570c04e4d76fd664caa406b3dd30.zip |
convert testbed_api_barriers to new MQ API
Diffstat (limited to 'src/testbed/test_testbed_api.c')
-rw-r--r-- | src/testbed/test_testbed_api.c | 77 |
1 files changed, 48 insertions, 29 deletions
diff --git a/src/testbed/test_testbed_api.c b/src/testbed/test_testbed_api.c index 83203e71e..19e95f2c2 100644 --- a/src/testbed/test_testbed_api.c +++ b/src/testbed/test_testbed_api.c | |||
@@ -90,7 +90,7 @@ static struct GNUNET_ARM_Handle *arm_handle; | |||
90 | /** | 90 | /** |
91 | * Abort task identifier | 91 | * Abort task identifier |
92 | */ | 92 | */ |
93 | static struct GNUNET_SCHEDULER_Task * abort_task; | 93 | static struct GNUNET_SCHEDULER_Task *abort_task; |
94 | 94 | ||
95 | /** | 95 | /** |
96 | * The testing result | 96 | * The testing result |
@@ -103,25 +103,25 @@ static int result; | |||
103 | */ | 103 | */ |
104 | enum Test | 104 | enum Test |
105 | { | 105 | { |
106 | /** | 106 | /** |
107 | * Test cases which are not covered by the below ones | 107 | * Test cases which are not covered by the below ones |
108 | */ | 108 | */ |
109 | OTHER, | 109 | OTHER, |
110 | 110 | ||
111 | /** | 111 | /** |
112 | * Test where we get a peer config from controller | 112 | * Test where we get a peer config from controller |
113 | */ | 113 | */ |
114 | PEER_GETCONFIG, | 114 | PEER_GETCONFIG, |
115 | 115 | ||
116 | /** | 116 | /** |
117 | * Test where we connect to a service running on the peer | 117 | * Test where we connect to a service running on the peer |
118 | */ | 118 | */ |
119 | PEER_SERVICE_CONNECT, | 119 | PEER_SERVICE_CONNECT, |
120 | 120 | ||
121 | /** | 121 | /** |
122 | * Test where we get a peer's identity from controller | 122 | * Test where we get a peer's identity from controller |
123 | */ | 123 | */ |
124 | PEER_DESTROY, | 124 | PEER_DESTROY |
125 | }; | 125 | }; |
126 | 126 | ||
127 | /** | 127 | /** |
@@ -197,7 +197,8 @@ do_abort (void *cls) | |||
197 | * @return service handle to return in 'op_result', NULL on error | 197 | * @return service handle to return in 'op_result', NULL on error |
198 | */ | 198 | */ |
199 | static void * | 199 | static void * |
200 | arm_connect_adapter (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) | 200 | arm_connect_adapter (void *cls, |
201 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
201 | { | 202 | { |
202 | FAIL_TEST (NULL == cls, return NULL); | 203 | FAIL_TEST (NULL == cls, return NULL); |
203 | FAIL_TEST (OTHER == sub_test, return NULL); | 204 | FAIL_TEST (OTHER == sub_test, return NULL); |
@@ -215,7 +216,8 @@ arm_connect_adapter (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
215 | * @param op_result service handle returned from the connect adapter | 216 | * @param op_result service handle returned from the connect adapter |
216 | */ | 217 | */ |
217 | static void | 218 | static void |
218 | arm_disconnect_adapter (void *cls, void *op_result) | 219 | arm_disconnect_adapter (void *cls, |
220 | void *op_result) | ||
219 | { | 221 | { |
220 | FAIL_TEST (NULL != op_result, return); | 222 | FAIL_TEST (NULL != op_result, return); |
221 | FAIL_TEST (op_result == arm_handle, return); | 223 | FAIL_TEST (op_result == arm_handle, return); |
@@ -238,8 +240,10 @@ arm_disconnect_adapter (void *cls, void *op_result) | |||
238 | * operation has executed successfully. | 240 | * operation has executed successfully. |
239 | */ | 241 | */ |
240 | static void | 242 | static void |
241 | service_connect_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, | 243 | service_connect_comp_cb (void *cls, |
242 | void *ca_result, const char *emsg) | 244 | struct GNUNET_TESTBED_Operation *op, |
245 | void *ca_result, | ||
246 | const char *emsg) | ||
243 | { | 247 | { |
244 | switch (sub_test) | 248 | switch (sub_test) |
245 | { | 249 | { |
@@ -268,7 +272,8 @@ service_connect_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, | |||
268 | * operation is successfull | 272 | * operation is successfull |
269 | */ | 273 | */ |
270 | static void | 274 | static void |
271 | peerinfo_cb (void *cb_cls, struct GNUNET_TESTBED_Operation *op, | 275 | peerinfo_cb (void *cb_cls, |
276 | struct GNUNET_TESTBED_Operation *op, | ||
272 | const struct GNUNET_TESTBED_PeerInformation *pinfo, | 277 | const struct GNUNET_TESTBED_PeerInformation *pinfo, |
273 | const char *emsg) | 278 | const char *emsg) |
274 | { | 279 | { |
@@ -299,7 +304,8 @@ peerinfo_cb (void *cb_cls, struct GNUNET_TESTBED_Operation *op, | |||
299 | * @param event information about the event | 304 | * @param event information about the event |
300 | */ | 305 | */ |
301 | static void | 306 | static void |
302 | controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) | 307 | controller_cb (void *cls, |
308 | const struct GNUNET_TESTBED_EventInformation *event) | ||
303 | { | 309 | { |
304 | switch (event->type) | 310 | switch (event->type) |
305 | { | 311 | { |
@@ -365,7 +371,9 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) | |||
365 | * @param emsg NULL if peer is not NULL; else MAY contain the error description | 371 | * @param emsg NULL if peer is not NULL; else MAY contain the error description |
366 | */ | 372 | */ |
367 | static void | 373 | static void |
368 | peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) | 374 | peer_create_cb (void *cls, |
375 | struct GNUNET_TESTBED_Peer *peer, | ||
376 | const char *emsg) | ||
369 | { | 377 | { |
370 | struct GNUNET_TESTBED_Peer **peer_ptr; | 378 | struct GNUNET_TESTBED_Peer **peer_ptr; |
371 | 379 | ||
@@ -374,7 +382,10 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) | |||
374 | FAIL_TEST (NULL != peer_ptr, return); | 382 | FAIL_TEST (NULL != peer_ptr, return); |
375 | *peer_ptr = peer; | 383 | *peer_ptr = peer; |
376 | GNUNET_TESTBED_operation_done (operation); | 384 | GNUNET_TESTBED_operation_done (operation); |
377 | operation = GNUNET_TESTBED_peer_start (NULL, peer, NULL, NULL); | 385 | operation = GNUNET_TESTBED_peer_start (NULL, |
386 | peer, | ||
387 | NULL, | ||
388 | NULL); | ||
378 | FAIL_TEST (NULL != operation, return); | 389 | FAIL_TEST (NULL != operation, return); |
379 | } | 390 | } |
380 | 391 | ||
@@ -386,12 +397,16 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) | |||
386 | * @param emsg the error message; NULL if host registration is successful | 397 | * @param emsg the error message; NULL if host registration is successful |
387 | */ | 398 | */ |
388 | static void | 399 | static void |
389 | registration_comp (void *cls, const char *emsg) | 400 | registration_comp (void *cls, |
401 | const char *emsg) | ||
390 | { | 402 | { |
391 | FAIL_TEST (cls == neighbour, return); | 403 | FAIL_TEST (cls == neighbour, return); |
392 | reg_handle = NULL; | 404 | reg_handle = NULL; |
393 | operation = | 405 | operation = |
394 | GNUNET_TESTBED_peer_create (controller, host, cfg, &peer_create_cb, | 406 | GNUNET_TESTBED_peer_create (controller, |
407 | host, | ||
408 | cfg, | ||
409 | &peer_create_cb, | ||
395 | &peer); | 410 | &peer); |
396 | FAIL_TEST (NULL != operation, return); | 411 | FAIL_TEST (NULL != operation, return); |
397 | } | 412 | } |
@@ -402,12 +417,14 @@ registration_comp (void *cls, const char *emsg) | |||
402 | * | 417 | * |
403 | * @param cls the closure from GNUNET_TESTBED_controller_start() | 418 | * @param cls the closure from GNUNET_TESTBED_controller_start() |
404 | * @param cfg the configuration with which the controller has been started; | 419 | * @param cfg the configuration with which the controller has been started; |
405 | * NULL if status is not GNUNET_OK | 420 | * NULL if status is not #GNUNET_OK |
406 | * @param status GNUNET_OK if the startup is successfull; GNUNET_SYSERR if not, | 421 | * @param status #GNUNET_OK if the startup is successfull; #GNUNET_SYSERR if not, |
407 | * GNUNET_TESTBED_controller_stop() shouldn't be called in this case | 422 | * GNUNET_TESTBED_controller_stop() shouldn't be called in this case |
408 | */ | 423 | */ |
409 | static void | 424 | static void |
410 | status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg_, int status) | 425 | status_cb (void *cls, |
426 | const struct GNUNET_CONFIGURATION_Handle *cfg_, | ||
427 | int status) | ||
411 | { | 428 | { |
412 | uint64_t event_mask; | 429 | uint64_t event_mask; |
413 | 430 | ||
@@ -440,12 +457,14 @@ status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg_, int status | |||
440 | * Main run function. | 457 | * Main run function. |
441 | * | 458 | * |
442 | * @param cls NULL | 459 | * @param cls NULL |
443 | * @param args arguments passed to GNUNET_PROGRAM_run | 460 | * @param args arguments passed to #GNUNET_PROGRAM_run() |
444 | * @param cfgfile the path to configuration file | 461 | * @param cfgfile the path to configuration file |
445 | * @param cfg the configuration file handle | 462 | * @param cfg the configuration file handle |
446 | */ | 463 | */ |
447 | static void | 464 | static void |
448 | run (void *cls, char *const *args, const char *cfgfile, | 465 | run (void *cls, |
466 | char *const *args, | ||
467 | const char *cfgfile, | ||
449 | const struct GNUNET_CONFIGURATION_Handle *config) | 468 | const struct GNUNET_CONFIGURATION_Handle *config) |
450 | { | 469 | { |
451 | cfg = GNUNET_CONFIGURATION_dup (config); | 470 | cfg = GNUNET_CONFIGURATION_dup (config); |