diff options
Diffstat (limited to 'src/transport/test_transport_plugin_cmd_udp_backchannel.c')
-rw-r--r-- | src/transport/test_transport_plugin_cmd_udp_backchannel.c | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/src/transport/test_transport_plugin_cmd_udp_backchannel.c b/src/transport/test_transport_plugin_cmd_udp_backchannel.c index b0ca37447..ee6dc0274 100644 --- a/src/transport/test_transport_plugin_cmd_udp_backchannel.c +++ b/src/transport/test_transport_plugin_cmd_udp_backchannel.c | |||
@@ -62,9 +62,8 @@ struct TestState | |||
62 | 62 | ||
63 | static struct GNUNET_TESTING_Command block_send; | 63 | static struct GNUNET_TESTING_Command block_send; |
64 | 64 | ||
65 | static struct GNUNET_TESTING_Command block_receive; | ||
66 | |||
67 | static struct GNUNET_TESTING_Command connect_peers; | 65 | static struct GNUNET_TESTING_Command connect_peers; |
66 | static struct GNUNET_TESTING_Command local_prepared; | ||
68 | 67 | ||
69 | 68 | ||
70 | /** | 69 | /** |
@@ -89,14 +88,14 @@ static void | |||
89 | handle_test (void *cls, | 88 | handle_test (void *cls, |
90 | const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) | 89 | const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) |
91 | { | 90 | { |
92 | struct GNUNET_TESTING_AsyncContext *ac; | 91 | // struct GNUNET_TESTING_AsyncContext *ac; |
93 | 92 | ||
94 | GNUNET_TESTING_get_trait_async_context (&block_receive, | 93 | /*GNUNET_TESTING_get_trait_async_context (&block_receive, |
95 | &ac); | 94 | &ac); |
96 | if ((NULL == ac) || (NULL == ac->cont)) | 95 | if ((NULL == ac) || (NULL == ac->cont)) |
97 | GNUNET_TESTING_async_fail (ac); | 96 | GNUNET_TESTING_async_fail (ac); |
98 | else | 97 | else |
99 | GNUNET_TESTING_async_finish (ac); | 98 | GNUNET_TESTING_async_finish (ac);*/ |
100 | } | 99 | } |
101 | 100 | ||
102 | 101 | ||
@@ -136,8 +135,11 @@ handle_result (void *cls, | |||
136 | rv); | 135 | rv); |
137 | reply = GNUNET_TESTING_send_local_test_finished_msg (rv); | 136 | reply = GNUNET_TESTING_send_local_test_finished_msg (rv); |
138 | 137 | ||
138 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
139 | "message prepared\n"); | ||
139 | ts->write_message (reply, | 140 | ts->write_message (reply, |
140 | ntohs (reply->size)); | 141 | ntohs (reply->size)); |
142 | |||
141 | GNUNET_free (ts->testdir); | 143 | GNUNET_free (ts->testdir); |
142 | GNUNET_free (ts->cfgname); | 144 | GNUNET_free (ts->cfgname); |
143 | GNUNET_free (ts); | 145 | GNUNET_free (ts); |
@@ -155,8 +157,8 @@ notify_connect (void *cls, | |||
155 | { | 157 | { |
156 | struct ConnectPeersState *cps; | 158 | struct ConnectPeersState *cps; |
157 | 159 | ||
158 | GNUNET_TESTING_get_trait_connect_peer_state (&connect_peers, | 160 | GNUNET_TRANSPORT_get_trait_connect_peer_state (&connect_peers, |
159 | &cps); | 161 | &cps); |
160 | void *ret = NULL; | 162 | void *ret = NULL; |
161 | 163 | ||
162 | cps->notify_connect (cps, | 164 | cps->notify_connect (cps, |
@@ -171,7 +173,14 @@ notify_connect (void *cls, | |||
171 | static void | 173 | static void |
172 | all_local_tests_prepared () | 174 | all_local_tests_prepared () |
173 | { | 175 | { |
174 | are_all_local_tests_prepared = GNUNET_YES; | 176 | struct LocalPreparedState *lfs; |
177 | GNUNET_TESTING_get_trait_local_prepared_state (&local_prepared, | ||
178 | &lfs); | ||
179 | |||
180 | if ((NULL == &lfs->ac) || (NULL == lfs->ac.cont)) | ||
181 | GNUNET_TESTING_async_fail (&lfs->ac); | ||
182 | else | ||
183 | GNUNET_TESTING_async_finish (&lfs->ac); | ||
175 | } | 184 | } |
176 | 185 | ||
177 | /** | 186 | /** |
@@ -212,13 +221,14 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, | |||
212 | num = (n_int - 1) * local_m_int + m_int + topology->nodes_x; | 221 | num = (n_int - 1) * local_m_int + m_int + topology->nodes_x; |
213 | 222 | ||
214 | block_send = GNUNET_TESTING_cmd_block_until_external_trigger ("block"); | 223 | block_send = GNUNET_TESTING_cmd_block_until_external_trigger ("block"); |
215 | block_receive = GNUNET_TESTING_cmd_block_until_external_trigger ( | ||
216 | "block-receive"); | ||
217 | connect_peers = GNUNET_TRANSPORT_cmd_connect_peers ("connect-peers", | 224 | connect_peers = GNUNET_TRANSPORT_cmd_connect_peers ("connect-peers", |
218 | "start-peer", | 225 | "start-peer", |
219 | "system-create", | 226 | "system-create", |
220 | num, | 227 | num, |
221 | NULL); | 228 | topology); |
229 | local_prepared = GNUNET_TESTING_cmd_local_test_prepared ( | ||
230 | "local-test-prepared", | ||
231 | write_message); | ||
222 | 232 | ||
223 | GNUNET_asprintf (&ts->cfgname, | 233 | GNUNET_asprintf (&ts->cfgname, |
224 | "test_transport_api2_tcp_node1.conf"); | 234 | "test_transport_api2_tcp_node1.conf"); |
@@ -266,16 +276,16 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, | |||
266 | m_int, | 276 | m_int, |
267 | n_int, | 277 | n_int, |
268 | topology), | 278 | topology), |
269 | GNUNET_TESTING_cmd_local_test_prepared ("local-test-prepared", | 279 | local_prepared, |
270 | write_message, | ||
271 | &are_all_local_tests_prepared), | ||
272 | block_receive, | ||
273 | GNUNET_TRANSPORT_cmd_stop_peer ("stop-peer", | 280 | GNUNET_TRANSPORT_cmd_stop_peer ("stop-peer", |
274 | "start-peer"), | 281 | "start-peer"), |
275 | GNUNET_TESTING_cmd_system_destroy ("system-destroy", | 282 | GNUNET_TESTING_cmd_system_destroy ("system-destroy", |
276 | "system-create") | 283 | "system-create"), |
284 | GNUNET_TESTING_cmd_end () | ||
277 | }; | 285 | }; |
278 | 286 | ||
287 | ts->write_message = write_message; | ||
288 | |||
279 | GNUNET_TESTING_run (commands, | 289 | GNUNET_TESTING_run (commands, |
280 | GNUNET_TIME_UNIT_FOREVER_REL, | 290 | GNUNET_TIME_UNIT_FOREVER_REL, |
281 | &handle_result, | 291 | &handle_result, |