diff options
author | t3sserakt <t3ss@posteo.de> | 2022-12-13 13:08:17 +0100 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2022-12-13 13:08:17 +0100 |
commit | ba4d141be09651b452270fc21f062d50bd3f738a (patch) | |
tree | 309c149fc8989fc83a893703e4f86194fb9a2f36 | |
parent | 52d0d09146c1d13bded8195cb91845acac1b355d (diff) | |
download | gnunet-ba4d141be09651b452270fc21f062d50bd3f738a.tar.gz gnunet-ba4d141be09651b452270fc21f062d50bd3f738a.zip |
- refactored barrier header, fixed messages for barrier signaling
-rw-r--r-- | src/include/gnunet_testing_barrier.h | 185 | ||||
-rw-r--r-- | src/include/gnunet_testing_netjail_lib.h | 10 | ||||
-rw-r--r-- | src/include/gnunet_testing_ng_lib.h | 32 | ||||
-rw-r--r-- | src/include/gnunet_testing_plugin.h | 2 | ||||
-rw-r--r-- | src/testing/gnunet-cmds-helper.c | 8 | ||||
-rw-r--r-- | src/testing/testing.h | 185 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_barrier.c | 20 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_barrier_reached.c | 6 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_netjail_start_testsystem.c | 25 | ||||
-rw-r--r-- | src/testing/testing_api_loop.c | 52 | ||||
-rw-r--r-- | src/transport/test_transport_plugin_cmd_nat_upnp.c | 22 | ||||
-rw-r--r-- | src/transport/test_transport_plugin_cmd_simple_send.c | 16 | ||||
-rw-r--r-- | src/transport/test_transport_plugin_cmd_simple_send_broadcast.c | 16 | ||||
-rw-r--r-- | src/transport/test_transport_plugin_cmd_simple_send_dv.c | 16 | ||||
-rw-r--r-- | src/transport/test_transport_plugin_cmd_udp_backchannel.c | 17 |
15 files changed, 271 insertions, 341 deletions
diff --git a/src/include/gnunet_testing_barrier.h b/src/include/gnunet_testing_barrier.h index b02499d14..3eb61c7ec 100644 --- a/src/include/gnunet_testing_barrier.h +++ b/src/include/gnunet_testing_barrier.h | |||
@@ -29,14 +29,6 @@ | |||
29 | 29 | ||
30 | #define GNUNET_TESTING_BARRIER_MAX 32 | 30 | #define GNUNET_TESTING_BARRIER_MAX 32 |
31 | 31 | ||
32 | #include "gnunet_testing_plugin.h" | ||
33 | |||
34 | /** | ||
35 | * A testing barrier | ||
36 | * FIXME better description | ||
37 | */ | ||
38 | struct GNUNET_TESTING_Barrier; | ||
39 | |||
40 | /** | 32 | /** |
41 | * An entry for a barrier list | 33 | * An entry for a barrier list |
42 | */ | 34 | */ |
@@ -48,8 +40,13 @@ struct GNUNET_TESTING_BarrierListEntry | |||
48 | /* DLL */ | 40 | /* DLL */ |
49 | struct GNUNET_TESTING_BarrierListEntry *prev; | 41 | struct GNUNET_TESTING_BarrierListEntry *prev; |
50 | 42 | ||
51 | /* The barrier */ | 43 | /* The barrier name*/ |
52 | struct GNUNET_TESTING_Barrier *barrier; | 44 | char *barrier_name; |
45 | |||
46 | /** | ||
47 | * Number of commands attached to the barrier. | ||
48 | */ | ||
49 | unsigned int expected_reaches; | ||
53 | }; | 50 | }; |
54 | 51 | ||
55 | /** | 52 | /** |
@@ -66,82 +63,6 @@ struct GNUNET_TESTING_BarrierList | |||
66 | 63 | ||
67 | 64 | ||
68 | /** | 65 | /** |
69 | * Message send to a child loop to inform the child loop about a barrier being advanced. | ||
70 | * FIXME: This is not packed and contains a char*... no payload documentation. | ||
71 | */ | ||
72 | struct GNUNET_TESTING_CommandBarrierAdvanced | ||
73 | { | ||
74 | /** | ||
75 | * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_ADVANCED | ||
76 | */ | ||
77 | struct GNUNET_MessageHeader header; | ||
78 | |||
79 | /** | ||
80 | * The name of the barrier. | ||
81 | */ | ||
82 | const char *barrier_name; | ||
83 | }; | ||
84 | |||
85 | /** | ||
86 | * Message send by a child loop to inform the master loop how much | ||
87 | * GNUNET_CMDS_BARRIER_REACHED messages the child will send. | ||
88 | * FIXME: Not packed and contains char*; int in NBO? bitlength undefined. | ||
89 | */ | ||
90 | struct GNUNET_TESTING_CommandBarrierAttached | ||
91 | { | ||
92 | /** | ||
93 | * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_ATTACHED | ||
94 | */ | ||
95 | struct GNUNET_MessageHeader header; | ||
96 | |||
97 | /** | ||
98 | * The name of the barrier. | ||
99 | */ | ||
100 | const char *barrier_name; | ||
101 | |||
102 | /** | ||
103 | * How often the child loop will reach the barrier. | ||
104 | */ | ||
105 | unsigned int expected_reaches; | ||
106 | |||
107 | /** | ||
108 | * The number of the node the barrier is running on. | ||
109 | */ | ||
110 | unsigned int node_number; | ||
111 | }; | ||
112 | |||
113 | |||
114 | // FIXME: See above | ||
115 | struct GNUNET_TESTING_CommandBarrierReached | ||
116 | { | ||
117 | /** | ||
118 | * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_REACHED | ||
119 | */ | ||
120 | struct GNUNET_MessageHeader header; | ||
121 | |||
122 | /** | ||
123 | * The name of the barrier. | ||
124 | */ | ||
125 | const char *barrier_name; | ||
126 | |||
127 | /** | ||
128 | * The number of the node the barrier is reached. | ||
129 | */ | ||
130 | unsigned int node_number; | ||
131 | |||
132 | /** | ||
133 | * The number of reach messages which most likely will send. | ||
134 | */ | ||
135 | unsigned int expected_number_of_reached_messages; | ||
136 | }; | ||
137 | |||
138 | /** | ||
139 | * Create a new #GNUNET_TESTING_Barrier | ||
140 | */ | ||
141 | struct GNUNET_TESTING_Barrier* | ||
142 | GNUNET_TESTING_barrier_new (const char *testcase_name); | ||
143 | |||
144 | /** | ||
145 | * FIXME: documentation | 66 | * FIXME: documentation |
146 | * FIXME: high-level it is baffling how we need both the GNUNET_TESTING_Barrier | 67 | * FIXME: high-level it is baffling how we need both the GNUNET_TESTING_Barrier |
147 | * and the Command that creates barriers. Conceptually this seems to be | 68 | * and the Command that creates barriers. Conceptually this seems to be |
@@ -153,97 +74,5 @@ GNUNET_TESTING_cmd_barrier_create ( | |||
153 | double percentage_to_be_reached, | 74 | double percentage_to_be_reached, |
154 | unsigned int number_to_be_reached); | 75 | unsigned int number_to_be_reached); |
155 | 76 | ||
156 | |||
157 | // Wait for barrier to be reached by all; | ||
158 | // async version implies reached but does not | ||
159 | // wait on other peers to reach it. | ||
160 | /** | ||
161 | * FIXME: Documentation | ||
162 | * Create command. | ||
163 | * | ||
164 | * @param label name for command. | ||
165 | * @param barrier_label The name of the barrier we wait for and which will be reached. | ||
166 | * @param asynchronous_finish If GNUNET_YES this command will not block. Can be NULL. | ||
167 | * @param asynchronous_finish If GNUNET_YES this command will not block. Can be NULL. | ||
168 | * @param node_number The global numer of the node the cmd runs on. | ||
169 | * @param running_on_master Is this cmd running on the master loop. | ||
170 | * @param write_message Callback to write messages to the master loop. | ||
171 | * @return command. | ||
172 | */ | ||
173 | struct GNUNET_TESTING_Command | ||
174 | GNUNET_TESTING_cmd_barrier_reached ( | ||
175 | const char *label, | ||
176 | const char *barrier_label, | ||
177 | unsigned int asynchronous_finish, | ||
178 | unsigned int node_number, | ||
179 | unsigned int running_on_master, | ||
180 | GNUNET_TESTING_cmd_helper_write_cb write_message); | ||
181 | |||
182 | |||
183 | /** | ||
184 | * FIXME: Return type | ||
185 | * FIXME: Documentation | ||
186 | * Can we advance the barrier? | ||
187 | * | ||
188 | * @param barrier The barrier in question. | ||
189 | * @return GNUNET_YES if we can advance the barrier, GNUNET_NO if not. | ||
190 | */ | ||
191 | unsigned int | ||
192 | GNUNET_TESTING_can_barrier_advance (struct GNUNET_TESTING_Barrier *barrier); | ||
193 | |||
194 | |||
195 | /** | ||
196 | * FIXME: Naming | ||
197 | * Send Message to netjail nodes that a barrier can be advanced. | ||
198 | * | ||
199 | * @param is The interpreter loop. | ||
200 | * @param barrier_name The name of the barrier to advance. | ||
201 | * @param global_node_number The global number of the node to inform. | ||
202 | */ | ||
203 | void | ||
204 | GNUNET_TESTING_send_barrier_advance (struct GNUNET_TESTING_Interpreter *is, | ||
205 | const char *barrier_name, | ||
206 | unsigned int global_node_number); | ||
207 | |||
208 | |||
209 | /** | ||
210 | * Finish all "barrier reached" comands attached to this barrier. | ||
211 | * | ||
212 | * @param barrier The barrier in question. | ||
213 | */ | ||
214 | void | ||
215 | GNUNET_TESTING_finish_attached_cmds (struct GNUNET_TESTING_Interpreter *is, | ||
216 | struct GNUNET_TESTING_Barrier *barrier); | ||
217 | |||
218 | |||
219 | /** | ||
220 | * Send Message to master loop that cmds being attached to a barrier. | ||
221 | * | ||
222 | * @param is The interpreter loop. | ||
223 | * @param barrier_name The name of the barrier to advance. | ||
224 | * @param subnet_number The number of the subnet. | ||
225 | * @param node_number The node to inform. | ||
226 | * @param write_message Callback to write messages to the master loop. | ||
227 | */ | ||
228 | void | ||
229 | GNUNET_TESTING_send_barrier_attach (struct GNUNET_TESTING_Interpreter *is, | ||
230 | char *barrier_name, | ||
231 | unsigned int global_node_number, | ||
232 | unsigned int expected_reaches, | ||
233 | GNUNET_TESTING_cmd_helper_write_cb write_message); | ||
234 | |||
235 | |||
236 | /** | ||
237 | * Getting a node from a map by global node number. | ||
238 | * | ||
239 | * @param nodes The map. | ||
240 | * @param node_number The global node number. | ||
241 | * @return The node. | ||
242 | */ | ||
243 | struct GNUNET_TESTING_NetjailNode * | ||
244 | GNUNET_TESTING_barrier_get_node (struct GNUNET_CONTAINER_MultiShortmap *nodes, | ||
245 | unsigned int node_number); | ||
246 | |||
247 | |||
248 | #endif | 77 | #endif |
249 | /* end of testing_barrier.h */ | 78 | /* end of testing_barrier.h */ |
diff --git a/src/include/gnunet_testing_netjail_lib.h b/src/include/gnunet_testing_netjail_lib.h index 6f1adde41..ada8b4754 100644 --- a/src/include/gnunet_testing_netjail_lib.h +++ b/src/include/gnunet_testing_netjail_lib.h | |||
@@ -349,16 +349,6 @@ GNUNET_TESTING_calculate_num (struct | |||
349 | struct GNUNET_TESTING_TestState | 349 | struct GNUNET_TESTING_TestState |
350 | { | 350 | { |
351 | /** | 351 | /** |
352 | * The head of the DLL with barriers of the test case. | ||
353 | */ | ||
354 | struct GNUNET_TESTING_Barrier *barriers_head; | ||
355 | |||
356 | /** | ||
357 | * The tail of the DLL with barriers of the test case. | ||
358 | */ | ||
359 | struct GNUNET_TESTING_Barrier *barriers_tail; | ||
360 | |||
361 | /** | ||
362 | * Callback to write messages to the master loop. | 352 | * Callback to write messages to the master loop. |
363 | * | 353 | * |
364 | */ | 354 | */ |
diff --git a/src/include/gnunet_testing_ng_lib.h b/src/include/gnunet_testing_ng_lib.h index 270fdab26..f0e2e3250 100644 --- a/src/include/gnunet_testing_ng_lib.h +++ b/src/include/gnunet_testing_ng_lib.h | |||
@@ -418,38 +418,6 @@ GNUNET_TESTING_main (struct GNUNET_TESTING_Command *commands, | |||
418 | struct GNUNET_TIME_Relative timeout); | 418 | struct GNUNET_TIME_Relative timeout); |
419 | 419 | ||
420 | 420 | ||
421 | /** | ||
422 | * Deleting all barriers create in the context of this interpreter. | ||
423 | * | ||
424 | * @param is The interpreter. | ||
425 | */ | ||
426 | void | ||
427 | GNUNET_TESTING_delete_barriers (struct GNUNET_TESTING_Interpreter *is); | ||
428 | |||
429 | |||
430 | /** | ||
431 | * Getting a barrier from the interpreter. | ||
432 | * | ||
433 | * @param is The interpreter. | ||
434 | * @param barrier_name The name of the barrier. | ||
435 | * @return The barrier. | ||
436 | */ | ||
437 | struct GNUNET_TESTING_Barrier * | ||
438 | GNUNET_TESTING_get_barrier (struct GNUNET_TESTING_Interpreter *is, | ||
439 | const char *barrier_name); | ||
440 | |||
441 | |||
442 | /** | ||
443 | * Add a barrier to the loop. | ||
444 | * | ||
445 | * @param is The interpreter. | ||
446 | * @param barrier The barrier to add. | ||
447 | */ | ||
448 | void | ||
449 | GNUNET_TESTING_interpreter_add_barrier (struct GNUNET_TESTING_Interpreter *is, | ||
450 | struct GNUNET_TESTING_Barrier *barrier); | ||
451 | |||
452 | |||
453 | /* ************** Specific interpreter commands ************ */ | 421 | /* ************** Specific interpreter commands ************ */ |
454 | 422 | ||
455 | 423 | ||
diff --git a/src/include/gnunet_testing_plugin.h b/src/include/gnunet_testing_plugin.h index d986fabcd..5f7570680 100644 --- a/src/include/gnunet_testing_plugin.h +++ b/src/include/gnunet_testing_plugin.h | |||
@@ -51,7 +51,7 @@ typedef void | |||
51 | // FIXME documentation | 51 | // FIXME documentation |
52 | // FIXME: Why are n, m, local_m strings? | 52 | // FIXME: Why are n, m, local_m strings? |
53 | // FIXME: Why is topology_data a string and not a GNUNET_TESTING_NetworkTopology?? | 53 | // FIXME: Why is topology_data a string and not a GNUNET_TESTING_NetworkTopology?? |
54 | typedef void | 54 | typedef struct GNUNET_TESTING_Interpreter * |
55 | (*GNUNET_TESTING_PLUGIN_StartTestCase) (GNUNET_TESTING_cmd_helper_write_cb | 55 | (*GNUNET_TESTING_PLUGIN_StartTestCase) (GNUNET_TESTING_cmd_helper_write_cb |
56 | write_message, | 56 | write_message, |
57 | const char *router_ip, | 57 | const char *router_ip, |
diff --git a/src/testing/gnunet-cmds-helper.c b/src/testing/gnunet-cmds-helper.c index 9c16038f0..22cf5a428 100644 --- a/src/testing/gnunet-cmds-helper.c +++ b/src/testing/gnunet-cmds-helper.c | |||
@@ -67,6 +67,8 @@ | |||
67 | 67 | ||
68 | struct GNUNET_SCHEDULER_Task *finished_task; | 68 | struct GNUNET_SCHEDULER_Task *finished_task; |
69 | 69 | ||
70 | struct GNUNET_TESTING_Interpreter *is; | ||
71 | |||
70 | /** | 72 | /** |
71 | * Struct with information about a specific node and the whole network namespace setup. | 73 | * Struct with information about a specific node and the whole network namespace setup. |
72 | * | 74 | * |
@@ -392,7 +394,7 @@ tokenizer_cb (void *cls, const struct GNUNET_MessageHeader *message) | |||
392 | } | 394 | } |
393 | strcat (node_ip, plugin->m); | 395 | strcat (node_ip, plugin->m); |
394 | 396 | ||
395 | plugin->api->start_testcase (&write_message, router_ip, node_ip, plugin->m, | 397 | is = plugin->api->start_testcase (&write_message, router_ip, node_ip, plugin->m, |
396 | 398 | ||
397 | plugin->n, plugin->local_m, ni->topology_data, | 399 | plugin->n, plugin->local_m, ni->topology_data, |
398 | ni->read_file, &finished_cb); | 400 | ni->read_file, &finished_cb); |
@@ -413,9 +415,11 @@ tokenizer_cb (void *cls, const struct GNUNET_MessageHeader *message) | |||
413 | else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_ADVANCED == ntohs ( | 415 | else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_ADVANCED == ntohs ( |
414 | message->type)) | 416 | message->type)) |
415 | { | 417 | { |
418 | const char *barrier_name; | ||
416 | struct GNUNET_TESTING_CommandBarrierAdvanced *adm = (struct GNUNET_TESTING_CommandBarrierAdvanced *) message; | 419 | struct GNUNET_TESTING_CommandBarrierAdvanced *adm = (struct GNUNET_TESTING_CommandBarrierAdvanced *) message; |
417 | 420 | ||
418 | plugin->api->barrier_advanced (adm->barrier_name); | 421 | barrier_name = (const char *) &adm[1]; |
422 | GNUNET_TESTING_finish_attached_cmds (is, barrier_name); | ||
419 | return GNUNET_OK; | 423 | return GNUNET_OK; |
420 | } | 424 | } |
421 | else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED == ntohs ( | 425 | else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED == ntohs ( |
diff --git a/src/testing/testing.h b/src/testing/testing.h index 848533251..382879706 100644 --- a/src/testing/testing.h +++ b/src/testing/testing.h | |||
@@ -24,7 +24,70 @@ | |||
24 | #ifndef TESTING_H | 24 | #ifndef TESTING_H |
25 | #define TESTING_H | 25 | #define TESTING_H |
26 | #include "gnunet_util_lib.h" | 26 | #include "gnunet_util_lib.h" |
27 | #include "gnunet_testing_plugin.h" | ||
27 | 28 | ||
29 | GNUNET_NETWORK_STRUCT_BEGIN | ||
30 | |||
31 | /** | ||
32 | * Message send to a child loop to inform the child loop about a barrier being advanced. | ||
33 | * FIXME: This is not packed and contains a char*... no payload documentation. | ||
34 | */ | ||
35 | struct GNUNET_TESTING_CommandBarrierAdvanced | ||
36 | { | ||
37 | /** | ||
38 | * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_ADVANCED | ||
39 | */ | ||
40 | struct GNUNET_MessageHeader header; | ||
41 | |||
42 | /* followed by 0-terminated barrier name */ | ||
43 | }; | ||
44 | |||
45 | /** | ||
46 | * Message send by a child loop to inform the master loop how much | ||
47 | * GNUNET_CMDS_BARRIER_REACHED messages the child will send. | ||
48 | * FIXME: Not packed and contains char*; int in NBO? bitlength undefined. | ||
49 | */ | ||
50 | struct GNUNET_TESTING_CommandBarrierAttached | ||
51 | { | ||
52 | /** | ||
53 | * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_ATTACHED | ||
54 | */ | ||
55 | struct GNUNET_MessageHeader header; | ||
56 | |||
57 | /** | ||
58 | * How often the child loop will reach the barrier. | ||
59 | */ | ||
60 | uint32_t expected_reaches GNUNET_PACKED; | ||
61 | |||
62 | /** | ||
63 | * The number of the node the barrier is running on. | ||
64 | */ | ||
65 | uint32_t node_number GNUNET_PACKED; | ||
66 | |||
67 | /* followed by 0-terminated barrier name */ | ||
68 | }; | ||
69 | |||
70 | struct GNUNET_TESTING_CommandBarrierReached | ||
71 | { | ||
72 | /** | ||
73 | * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_REACHED | ||
74 | */ | ||
75 | struct GNUNET_MessageHeader header; | ||
76 | |||
77 | /** | ||
78 | * The number of the node the barrier is reached. | ||
79 | */ | ||
80 | uint32_t node_number GNUNET_PACKED; | ||
81 | |||
82 | /** | ||
83 | * The number of reach messages which most likely will send. | ||
84 | */ | ||
85 | uint32_t expected_number_of_reached_messages GNUNET_PACKED; | ||
86 | |||
87 | /* followed by 0-terminated barrier name */ | ||
88 | }; | ||
89 | |||
90 | GNUNET_NETWORK_STRUCT_END | ||
28 | 91 | ||
29 | /** | 92 | /** |
30 | * Handle for a plugin. | 93 | * Handle for a plugin. |
@@ -153,6 +216,7 @@ struct GNUNET_TESTING_Barrier | |||
153 | unsigned int shadow; | 216 | unsigned int shadow; |
154 | }; | 217 | }; |
155 | 218 | ||
219 | |||
156 | /** | 220 | /** |
157 | * Advance internal pointer to next command. | 221 | * Advance internal pointer to next command. |
158 | * | 222 | * |
@@ -196,6 +260,127 @@ GNUNET_TESTING_cmd_batch_set_current_ (const struct GNUNET_TESTING_Command *cmd, | |||
196 | unsigned int new_ip); | 260 | unsigned int new_ip); |
197 | 261 | ||
198 | 262 | ||
263 | // Wait for barrier to be reached by all; | ||
264 | // async version implies reached but does not | ||
265 | // wait on other peers to reach it. | ||
266 | /** | ||
267 | * FIXME: Documentation | ||
268 | * Create command. | ||
269 | * | ||
270 | * @param label name for command. | ||
271 | * @param barrier_label The name of the barrier we wait for and which will be reached. | ||
272 | * @param asynchronous_finish If GNUNET_YES this command will not block. Can be NULL. | ||
273 | * @param asynchronous_finish If GNUNET_YES this command will not block. Can be NULL. | ||
274 | * @param node_number The global numer of the node the cmd runs on. | ||
275 | * @param running_on_master Is this cmd running on the master loop. | ||
276 | * @param write_message Callback to write messages to the master loop. | ||
277 | * @return command. | ||
278 | */ | ||
279 | struct GNUNET_TESTING_Command | ||
280 | GNUNET_TESTING_cmd_barrier_reached ( | ||
281 | const char *label, | ||
282 | const char *barrier_label, | ||
283 | unsigned int asynchronous_finish, | ||
284 | unsigned int node_number, | ||
285 | unsigned int running_on_master, | ||
286 | GNUNET_TESTING_cmd_helper_write_cb write_message); | ||
287 | |||
288 | |||
289 | /** | ||
290 | * FIXME: Return type | ||
291 | * FIXME: Documentation | ||
292 | * Can we advance the barrier? | ||
293 | * | ||
294 | * @param barrier The barrier in question. | ||
295 | * @return GNUNET_YES if we can advance the barrier, GNUNET_NO if not. | ||
296 | */ | ||
297 | unsigned int | ||
298 | GNUNET_TESTING_can_barrier_advance (struct GNUNET_TESTING_Barrier *barrier); | ||
299 | |||
300 | |||
301 | /** | ||
302 | * FIXME: Naming | ||
303 | * Send Message to netjail nodes that a barrier can be advanced. | ||
304 | * | ||
305 | * @param is The interpreter loop. | ||
306 | * @param barrier_name The name of the barrier to advance. | ||
307 | * @param global_node_number The global number of the node to inform. | ||
308 | */ | ||
309 | void | ||
310 | GNUNET_TESTING_send_barrier_advance (struct GNUNET_TESTING_Interpreter *is, | ||
311 | const char *barrier_name, | ||
312 | unsigned int global_node_number); | ||
313 | |||
314 | |||
315 | /** | ||
316 | * Finish all "barrier reached" comands attached to this barrier. | ||
317 | * | ||
318 | * @param barrier The barrier in question. | ||
319 | */ | ||
320 | void | ||
321 | GNUNET_TESTING_finish_attached_cmds (struct GNUNET_TESTING_Interpreter *is, | ||
322 | const char *barrier_name); | ||
323 | |||
324 | |||
325 | /** | ||
326 | * Send Message to master loop that cmds being attached to a barrier. | ||
327 | * | ||
328 | * @param is The interpreter loop. | ||
329 | * @param barrier_name The name of the barrier to advance. | ||
330 | * @param subnet_number The number of the subnet. | ||
331 | * @param node_number The node to inform. | ||
332 | * @param write_message Callback to write messages to the master loop. | ||
333 | */ | ||
334 | void | ||
335 | GNUNET_TESTING_send_barrier_attach (struct GNUNET_TESTING_Interpreter *is, | ||
336 | char *barrier_name, | ||
337 | unsigned int global_node_number, | ||
338 | unsigned int expected_reaches, | ||
339 | GNUNET_TESTING_cmd_helper_write_cb write_message); | ||
340 | |||
341 | |||
342 | /** | ||
343 | * Getting a node from a map by global node number. | ||
344 | * | ||
345 | * @param nodes The map. | ||
346 | * @param node_number The global node number. | ||
347 | * @return The node. | ||
348 | */ | ||
349 | struct GNUNET_TESTING_NetjailNode * | ||
350 | GNUNET_TESTING_barrier_get_node (struct GNUNET_CONTAINER_MultiShortmap *nodes, | ||
351 | unsigned int node_number); | ||
352 | |||
353 | |||
354 | /** | ||
355 | * Deleting all barriers create in the context of this interpreter. | ||
356 | * | ||
357 | * @param is The interpreter. | ||
358 | */ | ||
359 | void | ||
360 | GNUNET_TESTING_delete_barriers (struct GNUNET_TESTING_Interpreter *is); | ||
361 | |||
362 | |||
363 | /** | ||
364 | * Getting a barrier from the interpreter. | ||
365 | * | ||
366 | * @param is The interpreter. | ||
367 | * @param barrier_name The name of the barrier. | ||
368 | * @return The barrier. | ||
369 | */ | ||
370 | struct GNUNET_TESTING_Barrier * | ||
371 | GNUNET_TESTING_get_barrier (struct GNUNET_TESTING_Interpreter *is, | ||
372 | const char *barrier_name); | ||
373 | |||
374 | |||
375 | /** | ||
376 | * Add a barrier to the loop. | ||
377 | * | ||
378 | * @param is The interpreter. | ||
379 | * @param barrier The barrier to add. | ||
380 | */ | ||
381 | void | ||
382 | GNUNET_TESTING_interpreter_add_barrier (struct GNUNET_TESTING_Interpreter *is, | ||
383 | struct GNUNET_TESTING_Barrier *barrier); | ||
199 | 384 | ||
200 | 385 | ||
201 | #endif | 386 | #endif |
diff --git a/src/testing/testing_api_cmd_barrier.c b/src/testing/testing_api_cmd_barrier.c index 64cefd235..d27ce9d94 100644 --- a/src/testing/testing_api_cmd_barrier.c +++ b/src/testing/testing_api_cmd_barrier.c | |||
@@ -62,12 +62,14 @@ GNUNET_TESTING_send_barrier_attach (struct GNUNET_TESTING_Interpreter *is, | |||
62 | { | 62 | { |
63 | struct GNUNET_TESTING_CommandBarrierAttached *atm = GNUNET_new (struct GNUNET_TESTING_CommandBarrierAttached); | 63 | struct GNUNET_TESTING_CommandBarrierAttached *atm = GNUNET_new (struct GNUNET_TESTING_CommandBarrierAttached); |
64 | size_t msg_length = sizeof(struct GNUNET_TESTING_CommandBarrierAttached); | 64 | size_t msg_length = sizeof(struct GNUNET_TESTING_CommandBarrierAttached); |
65 | size_t name_len; | ||
65 | 66 | ||
67 | name_len = strlen (barrier_name) + 1; | ||
66 | atm->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_ATTACHED); | 68 | atm->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_ATTACHED); |
67 | atm->header.size = htons ((uint16_t) msg_length); | 69 | atm->header.size = htons ((uint16_t) msg_length); |
68 | atm->barrier_name = barrier_name; | ||
69 | atm->expected_reaches = expected_reaches; | 70 | atm->expected_reaches = expected_reaches; |
70 | atm->node_number = global_node_number; | 71 | atm->node_number = global_node_number; |
72 | memcpy (&atm[1], barrier_name, name_len); | ||
71 | write_message ((struct GNUNET_MessageHeader *) atm, msg_length); | 73 | write_message ((struct GNUNET_MessageHeader *) atm, msg_length); |
72 | 74 | ||
73 | GNUNET_free (atm); | 75 | GNUNET_free (atm); |
@@ -88,10 +90,12 @@ GNUNET_TESTING_send_barrier_advance (struct GNUNET_TESTING_Interpreter *is, | |||
88 | { | 90 | { |
89 | struct GNUNET_TESTING_CommandBarrierAdvanced *adm = GNUNET_new (struct GNUNET_TESTING_CommandBarrierAdvanced); | 91 | struct GNUNET_TESTING_CommandBarrierAdvanced *adm = GNUNET_new (struct GNUNET_TESTING_CommandBarrierAdvanced); |
90 | size_t msg_length = sizeof(struct GNUNET_TESTING_CommandBarrierAdvanced); | 92 | size_t msg_length = sizeof(struct GNUNET_TESTING_CommandBarrierAdvanced); |
93 | size_t name_len; | ||
91 | 94 | ||
95 | name_len = strlen (barrier_name) + 1; | ||
92 | adm->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_ADVANCED); | 96 | adm->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_ADVANCED); |
93 | adm->header.size = htons ((uint16_t) msg_length); | 97 | adm->header.size = htons ((uint16_t) msg_length); |
94 | adm->barrier_name = barrier_name; | 98 | memcpy (&adm[1], barrier_name, name_len); |
95 | GNUNET_TESTING_send_message_to_netjail (is, | 99 | GNUNET_TESTING_send_message_to_netjail (is, |
96 | global_node_number, | 100 | global_node_number, |
97 | &adm->header); | 101 | &adm->header); |
@@ -225,15 +229,3 @@ GNUNET_TESTING_cmd_barrier_create (const char *label, | |||
225 | &barrier_traits, | 229 | &barrier_traits, |
226 | NULL); | 230 | NULL); |
227 | } | 231 | } |
228 | |||
229 | /** | ||
230 | * FIXME: Not sure if this is correct here | ||
231 | */ | ||
232 | struct GNUNET_TESTING_Barrier* | ||
233 | GNUNET_TESTING_barrier_new (const char* testcase_name) | ||
234 | { | ||
235 | struct GNUNET_TESTING_Barrier *barr; | ||
236 | barr = GNUNET_new (struct GNUNET_TESTING_Barrier); | ||
237 | barr->name = GNUNET_strdup (testcase_name); | ||
238 | return barr; | ||
239 | } | ||
diff --git a/src/testing/testing_api_cmd_barrier_reached.c b/src/testing/testing_api_cmd_barrier_reached.c index 58f420214..eca422b1d 100644 --- a/src/testing/testing_api_cmd_barrier_reached.c +++ b/src/testing/testing_api_cmd_barrier_reached.c | |||
@@ -91,6 +91,7 @@ barrier_reached_run (void *cls, | |||
91 | struct CommandListEntry *cle; | 91 | struct CommandListEntry *cle; |
92 | size_t msg_length; | 92 | size_t msg_length; |
93 | struct GNUNET_TESTING_CommandBarrierReached *msg; | 93 | struct GNUNET_TESTING_CommandBarrierReached *msg; |
94 | size_t name_len; | ||
94 | 95 | ||
95 | barrier = GNUNET_TESTING_get_barrier (is, brs->barrier_name); | 96 | barrier = GNUNET_TESTING_get_barrier (is, brs->barrier_name); |
96 | if (NULL == barrier) | 97 | if (NULL == barrier) |
@@ -106,7 +107,7 @@ barrier_reached_run (void *cls, | |||
106 | //FIXME cmd uninitialized | 107 | //FIXME cmd uninitialized |
107 | GNUNET_assert (NULL != cmd); | 108 | GNUNET_assert (NULL != cmd); |
108 | cmd->asynchronous_finish = GNUNET_YES; | 109 | cmd->asynchronous_finish = GNUNET_YES; |
109 | GNUNET_TESTING_finish_attached_cmds (is, barrier); | 110 | GNUNET_TESTING_finish_attached_cmds (is, barrier->name); |
110 | } | 111 | } |
111 | else if (GNUNET_NO == brs->asynchronous_finish) | 112 | else if (GNUNET_NO == brs->asynchronous_finish) |
112 | { | 113 | { |
@@ -126,11 +127,12 @@ barrier_reached_run (void *cls, | |||
126 | } | 127 | } |
127 | if (GNUNET_NO == brs->running_on_master) | 128 | if (GNUNET_NO == brs->running_on_master) |
128 | { | 129 | { |
130 | name_len = strlen (barrier->name) + 1; | ||
129 | msg_length = sizeof(struct GNUNET_TESTING_CommandBarrierReached); | 131 | msg_length = sizeof(struct GNUNET_TESTING_CommandBarrierReached); |
130 | msg = GNUNET_new (struct GNUNET_TESTING_CommandBarrierReached); | 132 | msg = GNUNET_new (struct GNUNET_TESTING_CommandBarrierReached); |
131 | msg->header.size = htons ((uint16_t) msg_length); | 133 | msg->header.size = htons ((uint16_t) msg_length); |
132 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_REACHED); | 134 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_REACHED); |
133 | msg->barrier_name = barrier->name; | 135 | memcpy (&msg[1], barrier->name, name_len); |
134 | msg->node_number = brs->node_number; | 136 | msg->node_number = brs->node_number; |
135 | brs->write_message ((struct GNUNET_MessageHeader *) msg, msg_length); | 137 | brs->write_message ((struct GNUNET_MessageHeader *) msg, msg_length); |
136 | } | 138 | } |
diff --git a/src/testing/testing_api_cmd_netjail_start_testsystem.c b/src/testing/testing_api_cmd_netjail_start_testsystem.c index a1712c7b5..09f767b7a 100644 --- a/src/testing/testing_api_cmd_netjail_start_testsystem.c +++ b/src/testing/testing_api_cmd_netjail_start_testsystem.c | |||
@@ -350,9 +350,11 @@ barrier_attached (struct NetJailState *ns, const struct | |||
350 | struct GNUNET_TESTING_Barrier *barrier; | 350 | struct GNUNET_TESTING_Barrier *barrier; |
351 | struct GNUNET_ShortHashCode key; | 351 | struct GNUNET_ShortHashCode key; |
352 | struct GNUNET_HashCode hc; | 352 | struct GNUNET_HashCode hc; |
353 | const char *barrier_name; | ||
353 | 354 | ||
354 | am = (struct GNUNET_TESTING_CommandBarrierAttached *) message; | 355 | am = (struct GNUNET_TESTING_CommandBarrierAttached *) message; |
355 | barrier = GNUNET_TESTING_get_barrier (ns->is, am->barrier_name); | 356 | barrier_name = (const char *) &am[1]; |
357 | barrier = GNUNET_TESTING_get_barrier (ns->is, barrier_name); | ||
356 | GNUNET_assert (NULL != barrier && GNUNET_NO == barrier->shadow); | 358 | GNUNET_assert (NULL != barrier && GNUNET_NO == barrier->shadow); |
357 | node = GNUNET_TESTING_barrier_get_node (barrier->nodes, am->node_number); | 359 | node = GNUNET_TESTING_barrier_get_node (barrier->nodes, am->node_number); |
358 | if (NULL == node) | 360 | if (NULL == node) |
@@ -376,18 +378,19 @@ void | |||
376 | barrier_reached (struct NetJailState *ns, const struct | 378 | barrier_reached (struct NetJailState *ns, const struct |
377 | GNUNET_MessageHeader *message) | 379 | GNUNET_MessageHeader *message) |
378 | { | 380 | { |
381 | struct GNUNET_TESTING_Barrier *barrier; | ||
382 | const char *barrier_name; | ||
379 | struct GNUNET_TESTING_CommandBarrierReached *rm = (struct | 383 | struct GNUNET_TESTING_CommandBarrierReached *rm = (struct |
380 | GNUNET_TESTING_CommandBarrierReached | 384 | GNUNET_TESTING_CommandBarrierReached |
381 | *) message; | 385 | *) message; |
382 | struct GNUNET_TESTING_Barrier *barrier = GNUNET_TESTING_get_barrier (ns->is, | ||
383 | rm-> | ||
384 | barrier_name); | ||
385 | 386 | ||
387 | barrier_name = (const char *) &rm[1]; | ||
388 | barrier = GNUNET_TESTING_get_barrier (ns->is, barrier_name); | ||
386 | GNUNET_assert (NULL != barrier && GNUNET_NO == barrier->shadow); | 389 | GNUNET_assert (NULL != barrier && GNUNET_NO == barrier->shadow); |
387 | barrier->reached++; | 390 | barrier->reached++; |
388 | if (GNUNET_TESTING_can_barrier_advance (barrier)) | 391 | if (GNUNET_TESTING_can_barrier_advance (barrier)) |
389 | { | 392 | { |
390 | GNUNET_TESTING_finish_attached_cmds (ns->is, barrier); | 393 | GNUNET_TESTING_finish_attached_cmds (ns->is, barrier->name); |
391 | } | 394 | } |
392 | } | 395 | } |
393 | 396 | ||
@@ -699,19 +702,21 @@ start_helper (struct NetJailState *ns, | |||
699 | 702 | ||
700 | for (pos = barriers->head; NULL != pos; pos = pos->next) | 703 | for (pos = barriers->head; NULL != pos; pos = pos->next) |
701 | { | 704 | { |
702 | barrier = GNUNET_TESTING_get_barrier (ns->is, pos->barrier->name); | 705 | barrier = GNUNET_TESTING_get_barrier (ns->is, pos->barrier_name); |
703 | if (NULL == barrier || GNUNET_YES == barrier->shadow) | 706 | if (NULL == barrier || GNUNET_YES == barrier->shadow) |
704 | { | 707 | { |
705 | GNUNET_TESTING_interpreter_add_barrier (ns->is, pos->barrier); | 708 | barrier = GNUNET_new (struct GNUNET_TESTING_Barrier); |
706 | barrier = pos->barrier; | 709 | barrier->name = pos->barrier_name; |
710 | GNUNET_TESTING_interpreter_add_barrier (ns->is, barrier); | ||
711 | |||
707 | barrier->nodes = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); | 712 | barrier->nodes = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); |
708 | } | 713 | } |
709 | GNUNET_assert (NULL != node); | 714 | GNUNET_assert (NULL != node); |
710 | barrier_node = GNUNET_new (struct GNUNET_TESTING_NetjailNode); | 715 | barrier_node = GNUNET_new (struct GNUNET_TESTING_NetjailNode); |
711 | barrier_node->node_number = node->node_number; | 716 | barrier_node->node_number = node->node_number; |
712 | barrier_node->expected_reaches = pos->barrier->expected_reaches; | 717 | barrier_node->expected_reaches = pos->expected_reaches; |
713 | barrier->expected_reaches = barrier->expected_reaches | 718 | barrier->expected_reaches = barrier->expected_reaches |
714 | + pos->barrier->expected_reaches; | 719 | + pos->expected_reaches; |
715 | GNUNET_CRYPTO_hash (&(node->node_number), sizeof(node->node_number), &hc); | 720 | GNUNET_CRYPTO_hash (&(node->node_number), sizeof(node->node_number), &hc); |
716 | memcpy (&key, &hc, sizeof (key)); | 721 | memcpy (&key, &hc, sizeof (key)); |
717 | GNUNET_CONTAINER_multishortmap_put (barrier->nodes, | 722 | GNUNET_CONTAINER_multishortmap_put (barrier->nodes, |
diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c index e8680fc13..d7456b91f 100644 --- a/src/testing/testing_api_loop.c +++ b/src/testing/testing_api_loop.c | |||
@@ -688,16 +688,43 @@ free_barrier_node_cb (void *cls, | |||
688 | 688 | ||
689 | 689 | ||
690 | /** | 690 | /** |
691 | * Getting a barrier from the interpreter. | ||
692 | * | ||
693 | * @param is The interpreter. | ||
694 | * @param barrier_name The name of the barrier. | ||
695 | * @return The barrier. | ||
696 | */ | ||
697 | struct GNUNET_TESTING_Barrier * | ||
698 | GNUNET_TESTING_get_barrier (struct GNUNET_TESTING_Interpreter *is, | ||
699 | const char *barrier_name) | ||
700 | { | ||
701 | struct GNUNET_HashCode hc; | ||
702 | struct GNUNET_ShortHashCode create_key; | ||
703 | struct GNUNET_TESTING_Barrier *barrier; | ||
704 | |||
705 | GNUNET_CRYPTO_hash (barrier_name, strlen (barrier_name), &hc); | ||
706 | memcpy (&create_key, | ||
707 | &hc, | ||
708 | sizeof (create_key)); | ||
709 | barrier = GNUNET_CONTAINER_multishortmap_get (is->barriers, &create_key); | ||
710 | // GNUNET_free (create_key); | ||
711 | return barrier; | ||
712 | } | ||
713 | |||
714 | |||
715 | /** | ||
691 | * Finish all "barrier reached" comands attached to this barrier. | 716 | * Finish all "barrier reached" comands attached to this barrier. |
692 | * | 717 | * |
693 | * @param barrier The barrier in question. | 718 | * @param barrier The barrier in question. |
694 | */ | 719 | */ |
695 | void | 720 | void |
696 | GNUNET_TESTING_finish_attached_cmds (struct GNUNET_TESTING_Interpreter *is, | 721 | GNUNET_TESTING_finish_attached_cmds (struct GNUNET_TESTING_Interpreter *is, |
697 | struct GNUNET_TESTING_Barrier *barrier) | 722 | const char *barrier_name) |
698 | { | 723 | { |
699 | struct CommandListEntry *pos; | 724 | struct CommandListEntry *pos; |
700 | struct FreeBarrierNodeCbCls *free_barrier_node_cb_cls; | 725 | struct FreeBarrierNodeCbCls *free_barrier_node_cb_cls; |
726 | struct GNUNET_TESTING_Barrier *barrier = GNUNET_TESTING_get_barrier (is, | ||
727 | barrier_name); | ||
701 | 728 | ||
702 | while (NULL != (pos = barrier->cmds_head)) | 729 | while (NULL != (pos = barrier->cmds_head)) |
703 | { | 730 | { |
@@ -771,29 +798,6 @@ GNUNET_TESTING_delete_barriers (struct GNUNET_TESTING_Interpreter *is) | |||
771 | GNUNET_CONTAINER_multishortmap_destroy (is->barriers); | 798 | GNUNET_CONTAINER_multishortmap_destroy (is->barriers); |
772 | } | 799 | } |
773 | 800 | ||
774 | /** | ||
775 | * Getting a barrier from the interpreter. | ||
776 | * | ||
777 | * @param is The interpreter. | ||
778 | * @param barrier_name The name of the barrier. | ||
779 | * @return The barrier. | ||
780 | */ | ||
781 | struct GNUNET_TESTING_Barrier * | ||
782 | GNUNET_TESTING_get_barrier (struct GNUNET_TESTING_Interpreter *is, | ||
783 | const char *barrier_name) | ||
784 | { | ||
785 | struct GNUNET_HashCode hc; | ||
786 | struct GNUNET_ShortHashCode create_key; | ||
787 | struct GNUNET_TESTING_Barrier *barrier; | ||
788 | |||
789 | GNUNET_CRYPTO_hash (barrier_name, strlen (barrier_name), &hc); | ||
790 | memcpy (&create_key, | ||
791 | &hc, | ||
792 | sizeof (create_key)); | ||
793 | barrier = GNUNET_CONTAINER_multishortmap_get (is->barriers, &create_key); | ||
794 | // GNUNET_free (create_key); | ||
795 | return barrier; | ||
796 | } | ||
797 | 801 | ||
798 | /** | 802 | /** |
799 | * Add a barrier to the loop. | 803 | * Add a barrier to the loop. |
diff --git a/src/transport/test_transport_plugin_cmd_nat_upnp.c b/src/transport/test_transport_plugin_cmd_nat_upnp.c index 3fef41d87..b02673d04 100644 --- a/src/transport/test_transport_plugin_cmd_nat_upnp.c +++ b/src/transport/test_transport_plugin_cmd_nat_upnp.c | |||
@@ -24,7 +24,7 @@ | |||
24 | * @author t3sserakt | 24 | * @author t3sserakt |
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_testing_ng_lib.h" | 27 | #include "gnunet_testing_barrier.h" |
28 | #include "gnunet_testing_netjail_lib.h" | 28 | #include "gnunet_testing_netjail_lib.h" |
29 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
30 | #include "gnunet_transport_application_service.h" | 30 | #include "gnunet_transport_application_service.h" |
@@ -95,13 +95,15 @@ get_waiting_for_barriers () | |||
95 | 95 | ||
96 | barriers = GNUNET_new (struct GNUNET_TESTING_BarrierList); | 96 | barriers = GNUNET_new (struct GNUNET_TESTING_BarrierList); |
97 | ble = GNUNET_new (struct GNUNET_TESTING_BarrierListEntry); | 97 | ble = GNUNET_new (struct GNUNET_TESTING_BarrierListEntry); |
98 | ble->barrier = GNUNET_TESTING_barrier_new ("ready-to-connect"); | 98 | ble->barrier_name = "ready-to-connect"; |
99 | ble->expected_reaches = 1; | ||
99 | GNUNET_CONTAINER_DLL_insert (barriers->head, | 100 | GNUNET_CONTAINER_DLL_insert (barriers->head, |
100 | barriers->tail, | 101 | barriers->tail, |
101 | ble); | 102 | ble); |
102 | 103 | ||
103 | ble = GNUNET_new (struct GNUNET_TESTING_BarrierListEntry); | 104 | ble = GNUNET_new (struct GNUNET_TESTING_BarrierListEntry); |
104 | ble->barrier = GNUNET_TESTING_barrier_new ("test-case-finished"); | 105 | ble->barrier_name = "test-case-finished"; |
106 | ble->expected_reaches = 1; | ||
105 | GNUNET_CONTAINER_DLL_insert (barriers->head, | 107 | GNUNET_CONTAINER_DLL_insert (barriers->head, |
106 | barriers->tail, | 108 | barriers->tail, |
107 | ble); | 109 | ble); |
@@ -109,15 +111,6 @@ get_waiting_for_barriers () | |||
109 | } | 111 | } |
110 | 112 | ||
111 | 113 | ||
112 | static void | ||
113 | barrier_advanced (const char *barrier_name) | ||
114 | { | ||
115 | struct GNUNET_TESTING_Barrier *barrier = GNUNET_TESTING_get_barrier (is, barrier_name); | ||
116 | |||
117 | GNUNET_TESTING_finish_attached_cmds (is, barrier); | ||
118 | } | ||
119 | |||
120 | |||
121 | /** | 114 | /** |
122 | * Callback to set the flag indicating all peers started. Will be called via the plugin api. | 115 | * Callback to set the flag indicating all peers started. Will be called via the plugin api. |
123 | * | 116 | * |
@@ -213,7 +206,7 @@ all_local_tests_prepared () | |||
213 | * @param n The number of the network namespace. | 206 | * @param n The number of the network namespace. |
214 | * @param local_m The number of nodes in a network namespace. | 207 | * @param local_m The number of nodes in a network namespace. |
215 | */ | 208 | */ |
216 | static void | 209 | static struct GNUNET_TESTING_Interpreter * |
217 | start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message, | 210 | start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message, |
218 | const char *router_ip, | 211 | const char *router_ip, |
219 | const char *node_ip, | 212 | const char *node_ip, |
@@ -354,7 +347,7 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message, | |||
354 | TIMEOUT, | 347 | TIMEOUT, |
355 | &handle_result, | 348 | &handle_result, |
356 | ts); | 349 | ts); |
357 | 350 | return is; | |
358 | } | 351 | } |
359 | 352 | ||
360 | 353 | ||
@@ -377,7 +370,6 @@ libgnunet_test_transport_plugin_cmd_nat_upnp_init (void *cls) | |||
377 | api->start_testcase = &start_testcase; | 370 | api->start_testcase = &start_testcase; |
378 | api->all_peers_started = &all_peers_started; | 371 | api->all_peers_started = &all_peers_started; |
379 | api->all_local_tests_prepared = all_local_tests_prepared; | 372 | api->all_local_tests_prepared = all_local_tests_prepared; |
380 | api->barrier_advanced = barrier_advanced; | ||
381 | api->get_waiting_for_barriers = get_waiting_for_barriers; | 373 | api->get_waiting_for_barriers = get_waiting_for_barriers; |
382 | return api; | 374 | return api; |
383 | } | 375 | } |
diff --git a/src/transport/test_transport_plugin_cmd_simple_send.c b/src/transport/test_transport_plugin_cmd_simple_send.c index e94667593..83f9d62b8 100644 --- a/src/transport/test_transport_plugin_cmd_simple_send.c +++ b/src/transport/test_transport_plugin_cmd_simple_send.c | |||
@@ -24,7 +24,7 @@ | |||
24 | * @author t3sserakt | 24 | * @author t3sserakt |
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_testing_ng_lib.h" | 27 | #include "gnunet_testing_barrier.h" |
28 | #include "gnunet_testing_netjail_lib.h" | 28 | #include "gnunet_testing_netjail_lib.h" |
29 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
30 | #include "gnunet_transport_application_service.h" | 30 | #include "gnunet_transport_application_service.h" |
@@ -95,15 +95,6 @@ get_waiting_for_barriers () | |||
95 | } | 95 | } |
96 | 96 | ||
97 | 97 | ||
98 | static void | ||
99 | barrier_advanced (const char *barrier_name) | ||
100 | { | ||
101 | struct GNUNET_TESTING_Barrier *barrier = GNUNET_TESTING_get_barrier (is, barrier_name); | ||
102 | |||
103 | GNUNET_TESTING_finish_attached_cmds (is, barrier); | ||
104 | } | ||
105 | |||
106 | |||
107 | /** | 98 | /** |
108 | * Callback to set the flag indicating all peers started. Will be called via the plugin api. | 99 | * Callback to set the flag indicating all peers started. Will be called via the plugin api. |
109 | * | 100 | * |
@@ -199,7 +190,7 @@ all_local_tests_prepared () | |||
199 | * @param n The number of the network namespace. | 190 | * @param n The number of the network namespace. |
200 | * @param local_m The number of nodes in a network namespace. | 191 | * @param local_m The number of nodes in a network namespace. |
201 | */ | 192 | */ |
202 | static void | 193 | static struct GNUNET_TESTING_Interpreter * |
203 | start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message, | 194 | start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message, |
204 | const char *router_ip, | 195 | const char *router_ip, |
205 | const char *node_ip, | 196 | const char *node_ip, |
@@ -338,7 +329,7 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message, | |||
338 | TIMEOUT, | 329 | TIMEOUT, |
339 | &handle_result, | 330 | &handle_result, |
340 | ts); | 331 | ts); |
341 | 332 | return is; | |
342 | } | 333 | } |
343 | 334 | ||
344 | 335 | ||
@@ -361,7 +352,6 @@ libgnunet_test_transport_plugin_cmd_simple_send_init (void *cls) | |||
361 | api->start_testcase = &start_testcase; | 352 | api->start_testcase = &start_testcase; |
362 | api->all_peers_started = &all_peers_started; | 353 | api->all_peers_started = &all_peers_started; |
363 | api->all_local_tests_prepared = all_local_tests_prepared; | 354 | api->all_local_tests_prepared = all_local_tests_prepared; |
364 | api->barrier_advanced = barrier_advanced; | ||
365 | api->get_waiting_for_barriers = get_waiting_for_barriers; | 355 | api->get_waiting_for_barriers = get_waiting_for_barriers; |
366 | return api; | 356 | return api; |
367 | } | 357 | } |
diff --git a/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c b/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c index 4eeb25ec8..9f028e260 100644 --- a/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c +++ b/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c | |||
@@ -24,7 +24,7 @@ | |||
24 | * @author t3sserakt | 24 | * @author t3sserakt |
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_testing_ng_lib.h" | 27 | #include "gnunet_testing_barrier.h" |
28 | #include "gnunet_testing_netjail_lib.h" | 28 | #include "gnunet_testing_netjail_lib.h" |
29 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
30 | #include "gnunet_transport_application_service.h" | 30 | #include "gnunet_transport_application_service.h" |
@@ -95,15 +95,6 @@ get_waiting_for_barriers () | |||
95 | } | 95 | } |
96 | 96 | ||
97 | 97 | ||
98 | static void | ||
99 | barrier_advanced (const char *barrier_name) | ||
100 | { | ||
101 | struct GNUNET_TESTING_Barrier *barrier = GNUNET_TESTING_get_barrier (is, barrier_name); | ||
102 | |||
103 | GNUNET_TESTING_finish_attached_cmds (is, barrier); | ||
104 | } | ||
105 | |||
106 | |||
107 | /** | 98 | /** |
108 | * Callback to set the flag indicating all peers started. Will be called via the plugin api. | 99 | * Callback to set the flag indicating all peers started. Will be called via the plugin api. |
109 | * | 100 | * |
@@ -232,7 +223,7 @@ all_local_tests_prepared () | |||
232 | * @param n The number of the network namespace. | 223 | * @param n The number of the network namespace. |
233 | * @param local_m The number of nodes in a network namespace. | 224 | * @param local_m The number of nodes in a network namespace. |
234 | */ | 225 | */ |
235 | static void | 226 | static struct GNUNET_TESTING_Interpreter * |
236 | start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message, | 227 | start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message, |
237 | const char *router_ip, | 228 | const char *router_ip, |
238 | const char *node_ip, | 229 | const char *node_ip, |
@@ -365,7 +356,7 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message, | |||
365 | TIMEOUT, | 356 | TIMEOUT, |
366 | &handle_result, | 357 | &handle_result, |
367 | ts); | 358 | ts); |
368 | 359 | return is; | |
369 | } | 360 | } |
370 | 361 | ||
371 | 362 | ||
@@ -388,7 +379,6 @@ libgnunet_test_transport_plugin_cmd_simple_send_broadcast_init (void *cls) | |||
388 | api->start_testcase = &start_testcase; | 379 | api->start_testcase = &start_testcase; |
389 | api->all_peers_started = &all_peers_started; | 380 | api->all_peers_started = &all_peers_started; |
390 | api->all_local_tests_prepared = all_local_tests_prepared; | 381 | api->all_local_tests_prepared = all_local_tests_prepared; |
391 | api->barrier_advanced = barrier_advanced; | ||
392 | api->get_waiting_for_barriers = get_waiting_for_barriers; | 382 | api->get_waiting_for_barriers = get_waiting_for_barriers; |
393 | return api; | 383 | return api; |
394 | } | 384 | } |
diff --git a/src/transport/test_transport_plugin_cmd_simple_send_dv.c b/src/transport/test_transport_plugin_cmd_simple_send_dv.c index fe2c04401..3f4ae735c 100644 --- a/src/transport/test_transport_plugin_cmd_simple_send_dv.c +++ b/src/transport/test_transport_plugin_cmd_simple_send_dv.c | |||
@@ -24,7 +24,7 @@ | |||
24 | * @author t3sserakt | 24 | * @author t3sserakt |
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_testing_ng_lib.h" | 27 | #include "gnunet_testing_barrier.h" |
28 | #include "gnunet_testing_netjail_lib.h" | 28 | #include "gnunet_testing_netjail_lib.h" |
29 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
30 | #include "gnunet_transport_application_service.h" | 30 | #include "gnunet_transport_application_service.h" |
@@ -147,15 +147,6 @@ get_waiting_for_barriers () | |||
147 | } | 147 | } |
148 | 148 | ||
149 | 149 | ||
150 | static void | ||
151 | barrier_advanced (const char *barrier_name) | ||
152 | { | ||
153 | struct GNUNET_TESTING_Barrier *barrier = GNUNET_TESTING_get_barrier (is, barrier_name); | ||
154 | |||
155 | GNUNET_TESTING_finish_attached_cmds (is, barrier); | ||
156 | } | ||
157 | |||
158 | |||
159 | /** | 150 | /** |
160 | * Callback to set the flag indicating all peers started. Will be called via the plugin api. | 151 | * Callback to set the flag indicating all peers started. Will be called via the plugin api. |
161 | * | 152 | * |
@@ -255,7 +246,7 @@ all_local_tests_prepared () | |||
255 | * @param n The number of the network namespace. | 246 | * @param n The number of the network namespace. |
256 | * @param local_m The number of nodes in a network namespace. | 247 | * @param local_m The number of nodes in a network namespace. |
257 | */ | 248 | */ |
258 | static void | 249 | static struct GNUNET_TESTING_Interpreter * |
259 | start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message, | 250 | start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message, |
260 | const char *router_ip, | 251 | const char *router_ip, |
261 | const char *node_ip, | 252 | const char *node_ip, |
@@ -393,7 +384,7 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message, | |||
393 | TIMEOUT, | 384 | TIMEOUT, |
394 | &handle_result, | 385 | &handle_result, |
395 | ts); | 386 | ts); |
396 | 387 | return is; | |
397 | } | 388 | } |
398 | 389 | ||
399 | 390 | ||
@@ -416,7 +407,6 @@ libgnunet_test_transport_plugin_cmd_simple_send_dv_init (void *cls) | |||
416 | api->start_testcase = &start_testcase; | 407 | api->start_testcase = &start_testcase; |
417 | api->all_peers_started = &all_peers_started; | 408 | api->all_peers_started = &all_peers_started; |
418 | api->all_local_tests_prepared = all_local_tests_prepared; | 409 | api->all_local_tests_prepared = all_local_tests_prepared; |
419 | api->barrier_advanced = barrier_advanced; | ||
420 | api->get_waiting_for_barriers = get_waiting_for_barriers; | 410 | api->get_waiting_for_barriers = get_waiting_for_barriers; |
421 | return api; | 411 | return api; |
422 | } | 412 | } |
diff --git a/src/transport/test_transport_plugin_cmd_udp_backchannel.c b/src/transport/test_transport_plugin_cmd_udp_backchannel.c index f96a25e80..524250590 100644 --- a/src/transport/test_transport_plugin_cmd_udp_backchannel.c +++ b/src/transport/test_transport_plugin_cmd_udp_backchannel.c | |||
@@ -24,7 +24,7 @@ | |||
24 | * @author t3sserakt | 24 | * @author t3sserakt |
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_testing_ng_lib.h" | 27 | #include "gnunet_testing_barrier.h" |
28 | #include "gnunet_testing_netjail_lib.h" | 28 | #include "gnunet_testing_netjail_lib.h" |
29 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
30 | #include "gnunet_transport_application_service.h" | 30 | #include "gnunet_transport_application_service.h" |
@@ -93,16 +93,6 @@ get_waiting_for_barriers () | |||
93 | } | 93 | } |
94 | 94 | ||
95 | 95 | ||
96 | static void | ||
97 | barrier_advanced (const char *barrier_name) | ||
98 | { | ||
99 | struct GNUNET_TESTING_Barrier *barrier = GNUNET_TESTING_get_barrier (is, | ||
100 | barrier_name); | ||
101 | |||
102 | GNUNET_TESTING_finish_attached_cmds (is, barrier); | ||
103 | } | ||
104 | |||
105 | |||
106 | /** | 96 | /** |
107 | * Callback to set the flag indicating all peers started. Will be called via the plugin api. | 97 | * Callback to set the flag indicating all peers started. Will be called via the plugin api. |
108 | * | 98 | * |
@@ -193,7 +183,7 @@ all_local_tests_prepared () | |||
193 | * @param n The number of the network namespace. | 183 | * @param n The number of the network namespace. |
194 | * @param local_m The number of nodes in a network namespace. | 184 | * @param local_m The number of nodes in a network namespace. |
195 | */ | 185 | */ |
196 | static void | 186 | static struct GNUNET_TESTING_Interpreter * |
197 | start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message, | 187 | start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message, |
198 | const char *router_ip, | 188 | const char *router_ip, |
199 | const char *node_ip, | 189 | const char *node_ip, |
@@ -331,7 +321,7 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message, | |||
331 | TIMEOUT, | 321 | TIMEOUT, |
332 | &handle_result, | 322 | &handle_result, |
333 | ts); | 323 | ts); |
334 | 324 | return is; | |
335 | } | 325 | } |
336 | 326 | ||
337 | 327 | ||
@@ -354,7 +344,6 @@ libgnunet_test_transport_plugin_cmd_udp_backchannel_init (void *cls) | |||
354 | api->start_testcase = &start_testcase; | 344 | api->start_testcase = &start_testcase; |
355 | api->all_peers_started = &all_peers_started; | 345 | api->all_peers_started = &all_peers_started; |
356 | api->all_local_tests_prepared = all_local_tests_prepared; | 346 | api->all_local_tests_prepared = all_local_tests_prepared; |
357 | api->barrier_advanced = barrier_advanced; | ||
358 | api->get_waiting_for_barriers = get_waiting_for_barriers; | 347 | api->get_waiting_for_barriers = get_waiting_for_barriers; |
359 | return api; | 348 | return api; |
360 | } | 349 | } |