aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2022-12-09 12:07:26 +0900
committerMartin Schanzenbach <schanzen@gnunet.org>2022-12-09 12:07:26 +0900
commit4f46e2f2e72a07871b14c0a9aed70438616c4dd5 (patch)
treef4b904d75ec9fc977aa662d6c8ed0a4d71a22097 /src
parent1b3f6f366fc62e5519bb73fefe8c21c2eed20edf (diff)
downloadgnunet-4f46e2f2e72a07871b14c0a9aed70438616c4dd5.tar.gz
gnunet-4f46e2f2e72a07871b14c0a9aed70438616c4dd5.zip
TESTING: Fix TESTING-NG API to follow naming conventions
Rename structs and functions to follow GNUnet naming conventions. Some structs may actually also be private, a review is necessary. The barrier API was modified in order to untangle Barriers and lists of Barriers. This is a rough draft, it needs fixes wrt memory leaks.
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_testing_barrier.h106
-rw-r--r--src/include/gnunet_testing_netjail_lib.h32
-rw-r--r--src/include/gnunet_testing_ng_lib.h15
-rw-r--r--src/include/gnunet_testing_plugin.h15
-rw-r--r--src/testing/gnunet-cmds-helper.c6
-rw-r--r--src/testing/testing.c5
-rw-r--r--src/testing/testing.h127
-rw-r--r--src/testing/testing_api_cmd_barrier.c45
-rw-r--r--src/testing/testing_api_cmd_barrier_reached.c16
-rw-r--r--src/testing/testing_api_cmd_block_until_external_trigger.c14
-rw-r--r--src/testing/testing_api_cmd_finish.c2
-rw-r--r--src/testing/testing_api_cmd_local_test_finished.c6
-rw-r--r--src/testing/testing_api_cmd_local_test_prepared.c10
-rw-r--r--src/testing/testing_api_cmd_netjail_start.c2
-rw-r--r--src/testing/testing_api_cmd_netjail_start_testsystem.c175
-rw-r--r--src/testing/testing_api_cmd_netjail_stop.c2
-rw-r--r--src/testing/testing_api_cmd_netjail_stop_testsystem.c2
-rw-r--r--src/testing/testing_api_cmd_send_peer_ready.c6
-rw-r--r--src/testing/testing_api_cmd_system_create.c1
-rw-r--r--src/testing/testing_api_cmd_system_destroy.c1
-rw-r--r--src/testing/testing_api_loop.c65
-rw-r--r--src/testing/testing_api_traits.c2
-rw-r--r--src/testing/testing_cmds.h53
-rw-r--r--src/transport/test_transport_plugin_cmd_nat_upnp.c40
-rw-r--r--src/transport/test_transport_plugin_cmd_simple_send.c16
-rw-r--r--src/transport/test_transport_plugin_cmd_simple_send_broadcast.c20
-rw-r--r--src/transport/test_transport_plugin_cmd_simple_send_dv.c20
-rw-r--r--src/transport/test_transport_plugin_cmd_udp_backchannel.c16
28 files changed, 440 insertions, 380 deletions
diff --git a/src/include/gnunet_testing_barrier.h b/src/include/gnunet_testing_barrier.h
index 4a3d87ec7..ed4624e1b 100644
--- a/src/include/gnunet_testing_barrier.h
+++ b/src/include/gnunet_testing_barrier.h
@@ -27,74 +27,44 @@
27#ifndef GNUNET_TESTING_BARRIER_LIB_H 27#ifndef GNUNET_TESTING_BARRIER_LIB_H
28#define GNUNET_TESTING_BARRIER_LIB_H 28#define GNUNET_TESTING_BARRIER_LIB_H
29 29
30#include "gnunet_testing_lib.h" 30#define GNUNET_TESTING_BARRIER_MAX 32
31#include "gnunet_testing_netjail_lib.h"
32 31
33struct GNUNET_TESTING_Barrier 32#include "gnunet_testing_plugin.h"
34{
35 /**
36 * Pointer to the previous prefix in the DLL.
37 */
38 struct GNUNET_TESTING_Barrier *prev;
39
40 /**
41 * Pointer to the next prefix in the DLL.
42 */
43 struct GNUNET_TESTING_Barrier *next;
44
45 /**
46 * Head of the DLL with local commands the barrier is attached too.
47 */
48 struct GNUNET_TESTING_Command *cmds_head;
49
50 /**
51 * Tail of the DLL with local commands the barrier is attached too.
52 */
53 struct GNUNET_TESTING_Command *cmds_tail;
54
55 /**
56 * Hash map containing the global known nodes which are not natted.
57 */
58 struct GNUNET_CONTAINER_MultiShortmap *nodes;
59 33
60 /** 34/**
61 * Name of the barrier. 35 * A testing barrier
62 */ 36 * FIXME better description
63 const char *name; 37 */
64 38struct GNUNET_TESTING_Barrier;
65 /**
66 * Is this barrier running on the master.
67 */
68 unsigned int running_on_master;
69 39
70 /** 40/**
71 * Number of commands attached to this barrier. 41 * An entry for a barrier list
72 */ 42 */
73 unsigned int expected_reaches; 43struct GNUNET_TESTING_BarrierListEntry
44{
45 /* DLL */
46 struct GNUNET_TESTING_BarrierListEntry *next;
74 47
75 /** 48 /* DLL */
76 * Number of commands which reached this barrier. 49 struct GNUNET_TESTING_BarrierListEntry *prev;
77 */
78 unsigned int reached;
79 50
80 /** 51 /* The barrier */
81 * Percentage of of commands which need to reach the barrier to change state. 52 struct GNUNET_TESTING_Barrier *barrier;
82 * Can not be used together with to_be_reached; 53};
83 */
84 double percentage_to_be_reached;
85 54
86 /** 55/**
87 * Number of commands which need to reach the barrier to change state. 56 * A list to hold barriers provided by plugins
88 * Can not be used together with percentage_to_be_reached; 57 */
89 */ 58struct GNUNET_TESTING_BarrierList
90 unsigned int number_to_be_reached; 59{
60 /** List head **/
61 struct GNUNET_TESTING_BarrierListEntry *head;
91 62
92 /* 63 /** List tail **/
93 * No barrier locally. Shadow created. Real barrier created elsewhere. 64 struct GNUNET_TESTING_BarrierListEntry *tail;
94 */
95 unsigned int shadow;
96}; 65};
97 66
67
98/** 68/**
99 * Message send to a child loop to inform the child loop about a barrier being advanced. 69 * Message send to a child loop to inform the child loop about a barrier being advanced.
100 */ 70 */
@@ -112,7 +82,7 @@ struct GNUNET_TESTING_CommandBarrierAdvanced
112}; 82};
113 83
114/** 84/**
115 * Message send by a child loop to inform the master loop how much 85 * Message send by a child loop to inform the master loop how much
116 * GNUNET_CMDS_BARRIER_REACHED messages the child will send. 86 * GNUNET_CMDS_BARRIER_REACHED messages the child will send.
117 */ 87 */
118struct GNUNET_TESTING_CommandBarrierAttached 88struct GNUNET_TESTING_CommandBarrierAttached
@@ -162,17 +132,11 @@ struct GNUNET_TESTING_CommandBarrierReached
162 unsigned int expected_number_of_reached_messages; 132 unsigned int expected_number_of_reached_messages;
163}; 133};
164 134
165
166/** 135/**
167 * Adding a node to the map of nodes of a barrier. 136 * Create a new #GNUNET_TESTING_Barrier
168 *
169 * @param nodes Map of nodes.
170 * @param node The node to add.
171 */ 137 */
172void 138struct GNUNET_TESTING_Barrier*
173GNUNET_TESTING_barrier_add_node (struct GNUNET_CONTAINER_MultiShortmap *nodes, 139GNUNET_TESTING_barrier_new (const char *testcase_name);
174 struct GNUNET_TESTING_NetjailNode *node);
175
176 140
177struct GNUNET_TESTING_Command 141struct GNUNET_TESTING_Command
178GNUNET_TESTING_cmd_barrier_create ( 142GNUNET_TESTING_cmd_barrier_create (
@@ -203,7 +167,7 @@ GNUNET_TESTING_cmd_barrier_reached (
203 unsigned int asynchronous_finish, 167 unsigned int asynchronous_finish,
204 unsigned int node_number, 168 unsigned int node_number,
205 unsigned int running_on_master, 169 unsigned int running_on_master,
206 TESTING_CMD_HELPER_write_cb write_message); 170 GNUNET_TESTING_cmd_helper_write_cb write_message);
207 171
208 172
209/** 173/**
@@ -253,7 +217,7 @@ GNUNET_TESTING_send_barrier_attach (struct GNUNET_TESTING_Interpreter *is,
253 char *barrier_name, 217 char *barrier_name,
254 unsigned int global_node_number, 218 unsigned int global_node_number,
255 unsigned int expected_reaches, 219 unsigned int expected_reaches,
256 TESTING_CMD_HELPER_write_cb write_message); 220 GNUNET_TESTING_cmd_helper_write_cb write_message);
257 221
258 222
259/** 223/**
diff --git a/src/include/gnunet_testing_netjail_lib.h b/src/include/gnunet_testing_netjail_lib.h
index 8d1295c98..53cae38c6 100644
--- a/src/include/gnunet_testing_netjail_lib.h
+++ b/src/include/gnunet_testing_netjail_lib.h
@@ -27,11 +27,10 @@
27#ifndef GNUNET_TESTING_NETJAIL_LIB_H 27#ifndef GNUNET_TESTING_NETJAIL_LIB_H
28#define GNUNET_TESTING_NETJAIL_LIB_H 28#define GNUNET_TESTING_NETJAIL_LIB_H
29 29
30
31#include "gnunet_util_lib.h"
32#include "gnunet_testing_plugin.h"
33#include "gnunet_testing_ng_lib.h" 30#include "gnunet_testing_ng_lib.h"
31#include "gnunet_testing_plugin.h"
34 32
33struct GNUNET_TESTING_AsyncContext;
35 34
36/** 35/**
37 * Router of a netjail subnet. 36 * Router of a netjail subnet.
@@ -342,7 +341,10 @@ unsigned int
342GNUNET_TESTING_calculate_num (struct 341GNUNET_TESTING_calculate_num (struct
343 GNUNET_TESTING_NodeConnection *node_connection, 342 GNUNET_TESTING_NodeConnection *node_connection,
344 struct GNUNET_TESTING_NetjailTopology *topology); 343 struct GNUNET_TESTING_NetjailTopology *topology);
345struct TestState 344
345// FIXME this was not namespaced. Is this correct here? Why are the cmd_helpers
346// defined in _plugin??
347struct GNUNET_TESTING_TestState
346{ 348{
347 /** 349 /**
348 * The head of the DLL with barriers of the test case. 350 * The head of the DLL with barriers of the test case.
@@ -358,12 +360,12 @@ struct TestState
358 * Callback to write messages to the master loop. 360 * Callback to write messages to the master loop.
359 * 361 *
360 */ 362 */
361 TESTING_CMD_HELPER_write_cb write_message; 363 GNUNET_TESTING_cmd_helper_write_cb write_message;
362 364
363 /** 365 /**
364 * Callback to notify the helper test case has finished. 366 * Callback to notify the helper test case has finished.
365 */ 367 */
366 TESTING_CMD_HELPER_finish_cb finished_cb; 368 GNUNET_TESTING_cmd_helper_finish_cb finished_cb;
367 369
368 /** 370 /**
369 * The name for a specific test environment directory. 371 * The name for a specific test environment directory.
@@ -387,12 +389,12 @@ struct TestState
387 * Struct with information for callbacks. 389 * Struct with information for callbacks.
388 * 390 *
389 */ 391 */
390struct BlockState 392struct GNUNET_TESTING_BlockState
391{ 393{
392 /** 394 /**
393 * Context for our asynchronous completion. 395 * Context for our asynchronous completion.
394 */ 396 */
395 struct GNUNET_TESTING_AsyncContext ac; 397 struct GNUNET_TESTING_AsyncContext *ac;
396 398
397 /** 399 /**
398 * The label of this command. 400 * The label of this command.
@@ -409,7 +411,7 @@ struct BlockState
409 * Struct to hold information for callbacks. 411 * Struct to hold information for callbacks.
410 * 412 *
411 */ 413 */
412struct LocalPreparedState 414struct GNUNET_TESTING_LocalPreparedState
413{ 415{
414 /** 416 /**
415 * Context for our asynchronous completion. 417 * Context for our asynchronous completion.
@@ -420,7 +422,7 @@ struct LocalPreparedState
420 * Callback to write messages to the master loop. 422 * Callback to write messages to the master loop.
421 * 423 *
422 */ 424 */
423 TESTING_CMD_HELPER_write_cb write_message; 425 GNUNET_TESTING_cmd_helper_write_cb write_message;
424}; 426};
425 427
426/** 428/**
@@ -538,7 +540,7 @@ GNUNET_TESTING_cmd_block_until_external_trigger (
538 */ 540 */
539struct GNUNET_TESTING_Command 541struct GNUNET_TESTING_Command
540GNUNET_TESTING_cmd_send_peer_ready (const char *label, 542GNUNET_TESTING_cmd_send_peer_ready (const char *label,
541 TESTING_CMD_HELPER_write_cb write_message); 543 GNUNET_TESTING_cmd_helper_write_cb write_message);
542 544
543 545
544/** 546/**
@@ -551,7 +553,7 @@ GNUNET_TESTING_cmd_send_peer_ready (const char *label,
551struct GNUNET_TESTING_Command 553struct GNUNET_TESTING_Command
552GNUNET_TESTING_cmd_local_test_finished ( 554GNUNET_TESTING_cmd_local_test_finished (
553 const char *label, 555 const char *label,
554 TESTING_CMD_HELPER_write_cb write_message); 556 GNUNET_TESTING_cmd_helper_write_cb write_message);
555 557
556/** 558/**
557 * Create command. 559 * Create command.
@@ -562,7 +564,7 @@ GNUNET_TESTING_cmd_local_test_finished (
562 */ 564 */
563struct GNUNET_TESTING_Command 565struct GNUNET_TESTING_Command
564GNUNET_TESTING_cmd_local_test_prepared (const char *label, 566GNUNET_TESTING_cmd_local_test_prepared (const char *label,
565 TESTING_CMD_HELPER_write_cb 567 GNUNET_TESTING_cmd_helper_write_cb
566 write_message); 568 write_message);
567 569
568 570
@@ -576,8 +578,8 @@ GNUNET_TESTING_cmd_local_test_prepared (const char *label,
576 op (test_system, const struct GNUNET_TESTING_System) \ 578 op (test_system, const struct GNUNET_TESTING_System) \
577 op (async_context, const struct GNUNET_TESTING_AsyncContext) \ 579 op (async_context, const struct GNUNET_TESTING_AsyncContext) \
578 op (helper_handles, const struct GNUNET_HELPER_Handle *) \ 580 op (helper_handles, const struct GNUNET_HELPER_Handle *) \
579 op (local_prepared_state, const struct LocalPreparedState) \ 581 op (local_prepared_state, const struct GNUNET_TESTING_LocalPreparedState) \
580 op (block_state, const struct BlockState) 582 op (block_state, const struct GNUNET_TESTING_BlockState)
581 583
582GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT) 584GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT)
583 585
diff --git a/src/include/gnunet_testing_ng_lib.h b/src/include/gnunet_testing_ng_lib.h
index 0b4c05a59..d218a65db 100644
--- a/src/include/gnunet_testing_ng_lib.h
+++ b/src/include/gnunet_testing_ng_lib.h
@@ -29,7 +29,6 @@
29 29
30 30
31#include "gnunet_util_lib.h" 31#include "gnunet_util_lib.h"
32#include "gnunet_testing_plugin.h"
33#include "gnunet_testing_lib.h" 32#include "gnunet_testing_lib.h"
34 33
35/** 34/**
@@ -134,18 +133,6 @@ GNUNET_TESTING_command_new (void *cls,
134 */ 133 */
135struct GNUNET_TESTING_Command 134struct GNUNET_TESTING_Command
136{ 135{
137 // FIXME: This should not be here. Looking at the code commands are used
138 // in arrays. Not lists.
139 /**
140 * Pointer to the previous command in the DLL.
141 */
142 struct GNUNET_TESTING_Command *prev;
143
144 /**
145 * Pointer to the next command in the DLL.
146 */
147 struct GNUNET_TESTING_Command *next;
148
149 /** 136 /**
150 * Closure for all commands with command-specific context information. 137 * Closure for all commands with command-specific context information.
151 */ 138 */
@@ -466,7 +453,7 @@ GNUNET_TESTING_get_barrier (struct GNUNET_TESTING_Interpreter *is,
466 * @param barrier The barrier to add. 453 * @param barrier The barrier to add.
467 */ 454 */
468void 455void
469GNUNET_TESTING_barrier_add (struct GNUNET_TESTING_Interpreter *is, 456GNUNET_TESTING_interpreter_add_barrier (struct GNUNET_TESTING_Interpreter *is,
470 struct GNUNET_TESTING_Barrier *barrier); 457 struct GNUNET_TESTING_Barrier *barrier);
471 458
472 459
diff --git a/src/include/gnunet_testing_plugin.h b/src/include/gnunet_testing_plugin.h
index 312a7bfe5..d986fabcd 100644
--- a/src/include/gnunet_testing_plugin.h
+++ b/src/include/gnunet_testing_plugin.h
@@ -38,18 +38,21 @@ extern "C"
38#endif 38#endif
39#endif 39#endif
40 40
41struct GNUNET_TESTING_Barrier;
42
43//FIXME documentation for both functions
41typedef void 44typedef void
42(*TESTING_CMD_HELPER_write_cb) (struct GNUNET_MessageHeader *message, 45(*GNUNET_TESTING_cmd_helper_write_cb) (struct GNUNET_MessageHeader *message,
43 size_t msg_length); 46 size_t msg_length);
44 47
45typedef void 48typedef void
46(*TESTING_CMD_HELPER_finish_cb) (); 49(*GNUNET_TESTING_cmd_helper_finish_cb) ();
47 50
48// FIXME documentation 51// FIXME documentation
49// FIXME: Why are n, m, local_m strings? 52// FIXME: Why are n, m, local_m strings?
50// 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??
51typedef void 54typedef void
52(*GNUNET_TESTING_PLUGIN_StartTestCase) (TESTING_CMD_HELPER_write_cb 55(*GNUNET_TESTING_PLUGIN_StartTestCase) (GNUNET_TESTING_cmd_helper_write_cb
53 write_message, 56 write_message,
54 const char *router_ip, 57 const char *router_ip,
55 const char *node_ip, 58 const char *node_ip,
@@ -58,7 +61,7 @@ typedef void
58 const char *local_m, 61 const char *local_m,
59 const char *topology_data, 62 const char *topology_data,
60 unsigned int *read_file, 63 unsigned int *read_file,
61 TESTING_CMD_HELPER_finish_cb finish_cb); 64 GNUNET_TESTING_cmd_helper_finish_cb finish_cb);
62 65
63 66
64typedef void 67typedef void
@@ -71,8 +74,8 @@ typedef void
71typedef void 74typedef void
72(*GNUNET_TESTING_PLUGIN_BARRIER_ADVANCED) (const char *barrier_name); 75(*GNUNET_TESTING_PLUGIN_BARRIER_ADVANCED) (const char *barrier_name);
73 76
74typedef struct GNUNET_TESTING_Barrier * 77typedef struct GNUNET_TESTING_BarrierList*
75(*GNUNET_TESTING_PLUGIN_GET_WAITING_FOR_BARRIERS) (); 78(*GNUNET_TESTING_PLUGIN_GET_WAITING_FOR_BARRIERS) (void);
76 79
77 80
78// FIXME documentation 81// FIXME documentation
diff --git a/src/testing/gnunet-cmds-helper.c b/src/testing/gnunet-cmds-helper.c
index f87a055c3..9c16038f0 100644
--- a/src/testing/gnunet-cmds-helper.c
+++ b/src/testing/gnunet-cmds-helper.c
@@ -40,7 +40,9 @@
40#include "gnunet_util_lib.h" 40#include "gnunet_util_lib.h"
41#include "gnunet_testing_lib.h" 41#include "gnunet_testing_lib.h"
42#include "gnunet_testing_ng_lib.h" 42#include "gnunet_testing_ng_lib.h"
43#include "gnunet_testing_plugin.h"
43#include "gnunet_testing_netjail_lib.h" 44#include "gnunet_testing_netjail_lib.h"
45#include "testing.h"
44#include "testing_cmds.h" 46#include "testing_cmds.h"
45#include "gnunet_testing_plugin.h" 47#include "gnunet_testing_plugin.h"
46#include "gnunet_testing_barrier.h" 48#include "gnunet_testing_barrier.h"
@@ -135,7 +137,7 @@ static struct GNUNET_OS_Process *cmd_binary_process;*/
135/** 137/**
136 * Plugin to dynamically load a test case. 138 * Plugin to dynamically load a test case.
137 */ 139 */
138struct Plugin *plugin; 140struct TestcasePlugin *plugin;
139 141
140/** 142/**
141 * Our message stream tokenizer 143 * Our message stream tokenizer
@@ -355,7 +357,7 @@ tokenizer_cb (void *cls, const struct GNUNET_MessageHeader *message)
355 357
356 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-cmd"); 358 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-cmd");
357 359
358 plugin = GNUNET_new (struct Plugin); 360 plugin = GNUNET_new (struct TestcasePlugin);
359 plugin->api = GNUNET_PLUGIN_load (plugin_name, 361 plugin->api = GNUNET_PLUGIN_load (plugin_name,
360 NULL); 362 NULL);
361 plugin->library_name = GNUNET_strdup (basename (plugin_name)); 363 plugin->library_name = GNUNET_strdup (basename (plugin_name));
diff --git a/src/testing/testing.c b/src/testing/testing.c
index 56dc4e92d..b45270d57 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -33,6 +33,9 @@
33#include "gnunet_util_lib.h" 33#include "gnunet_util_lib.h"
34#include "gnunet_arm_service.h" 34#include "gnunet_arm_service.h"
35#include "gnunet_testing_lib.h" 35#include "gnunet_testing_lib.h"
36#include "gnunet_testing_ng_lib.h"
37#include "gnunet_testing_plugin.h"
38#include "gnunet_testing_barrier.h"
36#include "gnunet_testing_netjail_lib.h" 39#include "gnunet_testing_netjail_lib.h"
37#include "testing_cmds.h" 40#include "testing_cmds.h"
38 41
@@ -2248,7 +2251,7 @@ free_nodes_cb (void *cls,
2248 pos_connection); 2251 pos_connection);
2249 GNUNET_free (pos_connection); 2252 GNUNET_free (pos_connection);
2250 } 2253 }
2251 2254
2252 GNUNET_free (node->plugin); 2255 GNUNET_free (node->plugin);
2253 GNUNET_free (node); 2256 GNUNET_free (node);
2254 return GNUNET_OK; 2257 return GNUNET_OK;
diff --git a/src/testing/testing.h b/src/testing/testing.h
index 8aba09e4b..848533251 100644
--- a/src/testing/testing.h
+++ b/src/testing/testing.h
@@ -27,6 +27,133 @@
27 27
28 28
29/** 29/**
30 * Handle for a plugin.
31 */
32struct TestcasePlugin
33{
34 /**
35 * Name of the shared library.
36 */
37 char *library_name;
38
39 /**
40 * Plugin API.
41 */
42 struct GNUNET_TESTING_PluginFunctions *api;
43
44 /**
45 * IP address of the specific node the helper is running for.
46 *
47 */
48 char *node_ip;
49
50 /**
51 * Name of the test case plugin.
52 *
53 */
54 char *plugin_name;
55
56 /**
57 * The number of namespaces
58 *
59 */
60 char *global_n;
61
62 /**
63 * The number of local nodes per namespace.
64 *
65 */
66 char *local_m;
67
68 /**
69 * The number of the namespace this node is in.
70 *
71 */
72 char *n;
73
74 /**
75 * The number of the node in the namespace.
76 *
77 */
78 char *m;
79};
80
81struct CommandListEntry
82{
83 struct CommandListEntry *next;
84
85 struct CommandListEntry *prev;
86
87 struct GNUNET_TESTING_Command *command;
88};
89
90
91struct GNUNET_TESTING_Barrier
92{
93 /**
94 * Pointer to the previous prefix in the DLL.
95 */
96 struct GNUNET_TESTING_Barrier *prev;
97
98 /**
99 * Pointer to the next prefix in the DLL.
100 */
101 struct GNUNET_TESTING_Barrier *next;
102
103 /**
104 * Head of the DLL with local commands the barrier is attached too.
105 */
106 struct CommandListEntry *cmds_head;
107
108 /**
109 * Tail of the DLL with local commands the barrier is attached too.
110 */
111 struct CommandListEntry *cmds_tail;
112
113 /**
114 * Hash map containing the global known nodes which are not natted.
115 */
116 struct GNUNET_CONTAINER_MultiShortmap *nodes;
117
118 /**
119 * Name of the barrier.
120 */
121 const char *name;
122
123 /**
124 * Is this barrier running on the master.
125 */
126 unsigned int running_on_master;
127
128 /**
129 * Number of commands attached to this barrier.
130 */
131 unsigned int expected_reaches;
132
133 /**
134 * Number of commands which reached this barrier.
135 */
136 unsigned int reached;
137
138 /**
139 * Percentage of of commands which need to reach the barrier to change state.
140 * Can not be used together with to_be_reached;
141 */
142 double percentage_to_be_reached;
143
144 /**
145 * Number of commands which need to reach the barrier to change state.
146 * Can not be used together with percentage_to_be_reached;
147 */
148 unsigned int number_to_be_reached;
149
150 /*
151 * No barrier locally. Shadow created. Real barrier created elsewhere.
152 */
153 unsigned int shadow;
154};
155
156/**
30 * Advance internal pointer to next command. 157 * Advance internal pointer to next command.
31 * 158 *
32 * @param cls batch internal state 159 * @param cls batch internal state
diff --git a/src/testing/testing_api_cmd_barrier.c b/src/testing/testing_api_cmd_barrier.c
index be5dc6d2d..64cefd235 100644
--- a/src/testing/testing_api_cmd_barrier.c
+++ b/src/testing/testing_api_cmd_barrier.c
@@ -24,7 +24,10 @@
24 * @author t3sserakt 24 * @author t3sserakt
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "testing.h"
27#include "gnunet_testing_ng_lib.h" 28#include "gnunet_testing_ng_lib.h"
29#include "gnunet_testing_plugin.h"
30#include "gnunet_testing_netjail_lib.h"
28#include "gnunet_testing_barrier.h" 31#include "gnunet_testing_barrier.h"
29 32
30struct BarrierState 33struct BarrierState
@@ -55,7 +58,7 @@ GNUNET_TESTING_send_barrier_attach (struct GNUNET_TESTING_Interpreter *is,
55 char *barrier_name, 58 char *barrier_name,
56 unsigned int global_node_number, 59 unsigned int global_node_number,
57 unsigned int expected_reaches, 60 unsigned int expected_reaches,
58 TESTING_CMD_HELPER_write_cb write_message) 61 GNUNET_TESTING_cmd_helper_write_cb write_message)
59{ 62{
60 struct GNUNET_TESTING_CommandBarrierAttached *atm = GNUNET_new (struct GNUNET_TESTING_CommandBarrierAttached); 63 struct GNUNET_TESTING_CommandBarrierAttached *atm = GNUNET_new (struct GNUNET_TESTING_CommandBarrierAttached);
61 size_t msg_length = sizeof(struct GNUNET_TESTING_CommandBarrierAttached); 64 size_t msg_length = sizeof(struct GNUNET_TESTING_CommandBarrierAttached);
@@ -138,8 +141,6 @@ barrier_traits (void *cls,
138 const char *trait, 141 const char *trait,
139 unsigned int index) 142 unsigned int index)
140{ 143{
141 struct BarrierState *bs = cls;
142
143 struct GNUNET_TESTING_Trait traits[] = { 144 struct GNUNET_TESTING_Trait traits[] = {
144 GNUNET_TESTING_trait_end () 145 GNUNET_TESTING_trait_end ()
145 }; 146 };
@@ -178,32 +179,10 @@ barrier_run (void *cls,
178{ 179{
179 struct BarrierState *brs = cls; 180 struct BarrierState *brs = cls;
180 181
181 GNUNET_TESTING_barrier_add (is, brs->barrier); 182 GNUNET_TESTING_interpreter_add_barrier (is, brs->barrier);
182} 183}
183 184
184/** 185/**
185 * Adding a node to the map of nodes of a barrier.
186 *
187 * @param nodes Map of nodes.
188 * @param node The node to add.
189 */
190void
191GNUNET_TESTING_barrier_add_node (struct GNUNET_CONTAINER_MultiShortmap *nodes,
192 struct GNUNET_TESTING_NetjailNode *node)
193{
194 struct GNUNET_HashCode hc;
195 struct GNUNET_ShortHashCode key;
196
197 GNUNET_CRYPTO_hash (&(node->node_number), sizeof(node->node_number), &hc);
198 memcpy (&key, &hc, sizeof (key));
199 GNUNET_CONTAINER_multishortmap_put (nodes,
200 &key,
201 node,
202 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
203}
204
205
206/**
207 * Getting a node from a map by global node number. 186 * Getting a node from a map by global node number.
208 * 187 *
209 * @param nodes The map. 188 * @param nodes The map.
@@ -239,8 +218,6 @@ GNUNET_TESTING_cmd_barrier_create (const char *label,
239 barrier->name = label; 218 barrier->name = label;
240 GNUNET_assert ((0 < percentage_to_be_reached && 0 == number_to_be_reached) || 219 GNUNET_assert ((0 < percentage_to_be_reached && 0 == number_to_be_reached) ||
241 (0 == percentage_to_be_reached && 0 < number_to_be_reached)); 220 (0 == percentage_to_be_reached && 0 < number_to_be_reached));
242 barrier->percentage_to_be_reached;
243 barrier->number_to_be_reached;
244 bs->barrier = barrier; 221 bs->barrier = barrier;
245 return GNUNET_TESTING_command_new (bs, label, 222 return GNUNET_TESTING_command_new (bs, label,
246 &barrier_run, 223 &barrier_run,
@@ -248,3 +225,15 @@ GNUNET_TESTING_cmd_barrier_create (const char *label,
248 &barrier_traits, 225 &barrier_traits,
249 NULL); 226 NULL);
250} 227}
228
229/**
230 * FIXME: Not sure if this is correct here
231 */
232struct GNUNET_TESTING_Barrier*
233GNUNET_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 1a3b25d32..58f420214 100644
--- a/src/testing/testing_api_cmd_barrier_reached.c
+++ b/src/testing/testing_api_cmd_barrier_reached.c
@@ -24,8 +24,12 @@
24 * @author t3sserakt 24 * @author t3sserakt
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_testing_lib.h"
27#include "gnunet_testing_ng_lib.h" 28#include "gnunet_testing_ng_lib.h"
29#include "gnunet_testing_plugin.h"
28#include "gnunet_testing_barrier.h" 30#include "gnunet_testing_barrier.h"
31#include "gnunet_testing_netjail_lib.h"
32#include "testing.h"
29 33
30/** 34/**
31 * Struct with information for callbacks. 35 * Struct with information for callbacks.
@@ -37,7 +41,7 @@ struct BarrierReachedState
37 * Callback to write messages to the master loop. 41 * Callback to write messages to the master loop.
38 * 42 *
39 */ 43 */
40 TESTING_CMD_HELPER_write_cb write_message; 44 GNUNET_TESTING_cmd_helper_write_cb write_message;
41 45
42 /** 46 /**
43 * Context for our asynchronous completion. 47 * Context for our asynchronous completion.
@@ -84,6 +88,7 @@ barrier_reached_run (void *cls,
84 struct BarrierReachedState *brs = cls; 88 struct BarrierReachedState *brs = cls;
85 struct GNUNET_TESTING_Barrier *barrier; 89 struct GNUNET_TESTING_Barrier *barrier;
86 struct GNUNET_TESTING_Command *cmd = NULL; 90 struct GNUNET_TESTING_Command *cmd = NULL;
91 struct CommandListEntry *cle;
87 size_t msg_length; 92 size_t msg_length;
88 struct GNUNET_TESTING_CommandBarrierReached *msg; 93 struct GNUNET_TESTING_CommandBarrierReached *msg;
89 94
@@ -93,7 +98,7 @@ barrier_reached_run (void *cls,
93 barrier = GNUNET_new (struct GNUNET_TESTING_Barrier); 98 barrier = GNUNET_new (struct GNUNET_TESTING_Barrier);
94 barrier->shadow = GNUNET_YES; 99 barrier->shadow = GNUNET_YES;
95 barrier->name = brs->label; 100 barrier->name = brs->label;
96 GNUNET_TESTING_barrier_add (is, barrier); 101 GNUNET_TESTING_interpreter_add_barrier (is, barrier);
97 } 102 }
98 barrier->reached++; 103 barrier->reached++;
99 if (GNUNET_TESTING_can_barrier_advance (barrier)) 104 if (GNUNET_TESTING_can_barrier_advance (barrier))
@@ -109,10 +114,11 @@ barrier_reached_run (void *cls,
109 * It is unclear how this does not end up with a DLL issue. 114 * It is unclear how this does not end up with a DLL issue.
110 * We should create a dedicated struct to hold this list. 115 * We should create a dedicated struct to hold this list.
111 */ 116 */
112 cmd = GNUNET_TESTING_interpreter_get_current_command (is); 117 cle = GNUNET_new (struct CommandListEntry);
118 cle->command = GNUNET_TESTING_interpreter_get_current_command (is);
113 GNUNET_CONTAINER_DLL_insert (barrier->cmds_head, 119 GNUNET_CONTAINER_DLL_insert (barrier->cmds_head,
114 barrier->cmds_tail, 120 barrier->cmds_tail,
115 cmd); 121 cle);
116 } 122 }
117 else 123 else
118 { 124 {
@@ -194,7 +200,7 @@ GNUNET_TESTING_cmd_barrier_reached (
194 unsigned int asynchronous_finish, 200 unsigned int asynchronous_finish,
195 unsigned int node_number, 201 unsigned int node_number,
196 unsigned int running_on_master, 202 unsigned int running_on_master,
197 TESTING_CMD_HELPER_write_cb write_message) 203 GNUNET_TESTING_cmd_helper_write_cb write_message)
198{ 204{
199 struct BarrierReachedState *brs; 205 struct BarrierReachedState *brs;
200 206
diff --git a/src/testing/testing_api_cmd_block_until_external_trigger.c b/src/testing/testing_api_cmd_block_until_external_trigger.c
index 1e2c3be7c..be30ec86b 100644
--- a/src/testing/testing_api_cmd_block_until_external_trigger.c
+++ b/src/testing/testing_api_cmd_block_until_external_trigger.c
@@ -26,6 +26,8 @@
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_testing_ng_lib.h" 28#include "gnunet_testing_ng_lib.h"
29#include "gnunet_testing_plugin.h"
30#include "gnunet_testing_barrier.h"
29#include "gnunet_testing_netjail_lib.h" 31#include "gnunet_testing_netjail_lib.h"
30 32
31/** 33/**
@@ -52,8 +54,8 @@ block_until_external_trigger_traits (void *cls,
52 const char *trait, 54 const char *trait,
53 unsigned int index) 55 unsigned int index)
54{ 56{
55 struct BlockState *bs = cls; 57 struct GNUNET_TESTING_BlockState *bs = cls;
56 struct GNUNET_TESTING_AsyncContext *ac = &bs->ac; 58 struct GNUNET_TESTING_AsyncContext *ac = bs->ac;
57 struct GNUNET_TESTING_Trait traits[] = { 59 struct GNUNET_TESTING_Trait traits[] = {
58 GNUNET_TESTING_make_trait_async_context ((const void *) ac), 60 GNUNET_TESTING_make_trait_async_context ((const void *) ac),
59 GNUNET_TESTING_make_trait_block_state ((const void *) bs), 61 GNUNET_TESTING_make_trait_block_state ((const void *) bs),
@@ -75,7 +77,7 @@ static void
75block_until_all_peers_started_run (void *cls, 77block_until_all_peers_started_run (void *cls,
76 struct GNUNET_TESTING_Interpreter *is) 78 struct GNUNET_TESTING_Interpreter *is)
77{ 79{
78 struct BlockState *bs = cls; 80 struct GNUNET_TESTING_BlockState *bs = cls;
79 struct GNUNET_TESTING_Command *cmd = 81 struct GNUNET_TESTING_Command *cmd =
80 GNUNET_TESTING_interpreter_get_current_command (is); 82 GNUNET_TESTING_interpreter_get_current_command (is);
81 83
@@ -103,14 +105,14 @@ struct GNUNET_TESTING_Command
103GNUNET_TESTING_cmd_block_until_external_trigger ( 105GNUNET_TESTING_cmd_block_until_external_trigger (
104 const char *label) 106 const char *label)
105{ 107{
106 struct BlockState *bs; 108 struct GNUNET_TESTING_BlockState *bs;
107 109
108 bs = GNUNET_new (struct BlockState); 110 bs = GNUNET_new (struct GNUNET_TESTING_BlockState);
109 bs->label = label; 111 bs->label = label;
110 bs->asynchronous_finish = GNUNET_NO; 112 bs->asynchronous_finish = GNUNET_NO;
111 return GNUNET_TESTING_command_new (bs, label, 113 return GNUNET_TESTING_command_new (bs, label,
112 &block_until_all_peers_started_run, 114 &block_until_all_peers_started_run,
113 &block_until_all_peers_started_cleanup, 115 &block_until_all_peers_started_cleanup,
114 &block_until_external_trigger_traits, 116 &block_until_external_trigger_traits,
115 &bs->ac); 117 bs->ac);
116} 118}
diff --git a/src/testing/testing_api_cmd_finish.c b/src/testing/testing_api_cmd_finish.c
index b352e28dc..e1fc69a09 100644
--- a/src/testing/testing_api_cmd_finish.c
+++ b/src/testing/testing_api_cmd_finish.c
@@ -25,6 +25,8 @@
25#include "platform.h" 25#include "platform.h"
26#include "gnunet_util_lib.h" 26#include "gnunet_util_lib.h"
27#include "gnunet_testing_ng_lib.h" 27#include "gnunet_testing_ng_lib.h"
28#include "gnunet_testing_plugin.h"
29#include "gnunet_testing_barrier.h"
28#include "gnunet_testing_netjail_lib.h" 30#include "gnunet_testing_netjail_lib.h"
29 31
30 32
diff --git a/src/testing/testing_api_cmd_local_test_finished.c b/src/testing/testing_api_cmd_local_test_finished.c
index fb6fef030..f54b67acf 100644
--- a/src/testing/testing_api_cmd_local_test_finished.c
+++ b/src/testing/testing_api_cmd_local_test_finished.c
@@ -26,6 +26,8 @@
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_testing_ng_lib.h" 28#include "gnunet_testing_ng_lib.h"
29#include "gnunet_testing_plugin.h"
30#include "gnunet_testing_barrier.h"
29#include "gnunet_testing_netjail_lib.h" 31#include "gnunet_testing_netjail_lib.h"
30#include "testing_cmds.h" 32#include "testing_cmds.h"
31 33
@@ -46,7 +48,7 @@ struct LocalFinishedState
46 * Callback to write messages to the master loop. 48 * Callback to write messages to the master loop.
47 * 49 *
48 */ 50 */
49 TESTING_CMD_HELPER_write_cb write_message; 51 GNUNET_TESTING_cmd_helper_write_cb write_message;
50 52
51 /** 53 /**
52 * The message send back to the master loop. 54 * The message send back to the master loop.
@@ -101,7 +103,7 @@ local_test_finished_run (void *cls,
101struct GNUNET_TESTING_Command 103struct GNUNET_TESTING_Command
102GNUNET_TESTING_cmd_local_test_finished ( 104GNUNET_TESTING_cmd_local_test_finished (
103 const char *label, 105 const char *label,
104 TESTING_CMD_HELPER_write_cb write_message) 106 GNUNET_TESTING_cmd_helper_write_cb write_message)
105{ 107{
106 struct LocalFinishedState *lfs; 108 struct LocalFinishedState *lfs;
107 109
diff --git a/src/testing/testing_api_cmd_local_test_prepared.c b/src/testing/testing_api_cmd_local_test_prepared.c
index 3f976f554..2b1525077 100644
--- a/src/testing/testing_api_cmd_local_test_prepared.c
+++ b/src/testing/testing_api_cmd_local_test_prepared.c
@@ -26,6 +26,8 @@
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_testing_ng_lib.h" 28#include "gnunet_testing_ng_lib.h"
29#include "gnunet_testing_plugin.h"
30#include "gnunet_testing_barrier.h"
29#include "gnunet_testing_netjail_lib.h" 31#include "gnunet_testing_netjail_lib.h"
30#include "testing_cmds.h" 32#include "testing_cmds.h"
31 33
@@ -78,7 +80,7 @@ static void
78local_test_prepared_run (void *cls, 80local_test_prepared_run (void *cls,
79 struct GNUNET_TESTING_Interpreter *is) 81 struct GNUNET_TESTING_Interpreter *is)
80{ 82{
81 struct LocalPreparedState *lfs = cls; 83 struct GNUNET_TESTING_LocalPreparedState *lfs = cls;
82 84
83 struct GNUNET_TESTING_CommandLocalTestPrepared *reply; 85 struct GNUNET_TESTING_CommandLocalTestPrepared *reply;
84 size_t msg_length; 86 size_t msg_length;
@@ -94,12 +96,12 @@ local_test_prepared_run (void *cls,
94 96
95struct GNUNET_TESTING_Command 97struct GNUNET_TESTING_Command
96GNUNET_TESTING_cmd_local_test_prepared (const char *label, 98GNUNET_TESTING_cmd_local_test_prepared (const char *label,
97 TESTING_CMD_HELPER_write_cb 99 GNUNET_TESTING_cmd_helper_write_cb
98 write_message) 100 write_message)
99{ 101{
100 struct LocalPreparedState *lfs; 102 struct GNUNET_TESTING_LocalPreparedState *lfs;
101 103
102 lfs = GNUNET_new (struct LocalPreparedState); 104 lfs = GNUNET_new (struct GNUNET_TESTING_LocalPreparedState);
103 lfs->write_message = write_message; 105 lfs->write_message = write_message;
104 106
105 return GNUNET_TESTING_command_new (lfs, label, 107 return GNUNET_TESTING_command_new (lfs, label,
diff --git a/src/testing/testing_api_cmd_netjail_start.c b/src/testing/testing_api_cmd_netjail_start.c
index 9c1949c88..f45ab939b 100644
--- a/src/testing/testing_api_cmd_netjail_start.c
+++ b/src/testing/testing_api_cmd_netjail_start.c
@@ -26,6 +26,8 @@
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_testing_ng_lib.h" 28#include "gnunet_testing_ng_lib.h"
29#include "gnunet_testing_plugin.h"
30#include "gnunet_testing_barrier.h"
29#include "gnunet_testing_netjail_lib.h" 31#include "gnunet_testing_netjail_lib.h"
30 32
31#define NETJAIL_START_SCRIPT "netjail_start.sh" 33#define NETJAIL_START_SCRIPT "netjail_start.sh"
diff --git a/src/testing/testing_api_cmd_netjail_start_testsystem.c b/src/testing/testing_api_cmd_netjail_start_testsystem.c
index 6663e9b82..a1712c7b5 100644
--- a/src/testing/testing_api_cmd_netjail_start_testsystem.c
+++ b/src/testing/testing_api_cmd_netjail_start_testsystem.c
@@ -25,9 +25,11 @@
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_testing_ng_lib.h" 27#include "gnunet_testing_ng_lib.h"
28#include "gnunet_testing_plugin.h"
29#include "gnunet_testing_barrier.h"
28#include "gnunet_testing_netjail_lib.h" 30#include "gnunet_testing_netjail_lib.h"
31#include "testing.h"
29#include "testing_cmds.h" 32#include "testing_cmds.h"
30#include "gnunet_testing_barrier.h"
31 33
32#define NETJAIL_EXEC_SCRIPT "netjail_exec.sh" 34#define NETJAIL_EXEC_SCRIPT "netjail_exec.sh"
33 35
@@ -176,7 +178,7 @@ struct TestingSystemCount
176 /** 178 /**
177 * The plugin correlated to this netjail node. 179 * The plugin correlated to this netjail node.
178 */ 180 */
179 struct Plugin *plugin; 181 struct TestcasePlugin *plugin;
180 182
181 /** 183 /**
182 * Kept in a DLL. 184 * Kept in a DLL.
@@ -259,7 +261,7 @@ clear_msg (void *cls, int result)
259 struct TestingSystemCount *tbc = cls; 261 struct TestingSystemCount *tbc = cls;
260 262
261 GNUNET_assert (NULL != tbc->shandle); 263 GNUNET_assert (NULL != tbc->shandle);
262 //GNUNET_free (tbc->shandle); 264 // GNUNET_free (tbc->shandle);
263 GNUNET_free (tbc->plugin); 265 GNUNET_free (tbc->plugin);
264 tbc->shandle = NULL; 266 tbc->shandle = NULL;
265 GNUNET_free (tbc); 267 GNUNET_free (tbc);
@@ -304,23 +306,6 @@ send_message_to_locals (
304 306
305 307
306static void 308static void
307send_barrier_advanced (struct GNUNET_TESTING_CommandBarrierReached *rm,
308 unsigned int i,
309 unsigned int j,
310 struct NetJailState *ns)
311{
312 struct GNUNET_TESTING_CommandBarrierAdvanced *adm = GNUNET_new (struct GNUNET_TESTING_CommandBarrierAdvanced);
313 size_t msg_length = sizeof(struct GNUNET_TESTING_CommandAllLocalTestsPrepared);
314
315 adm->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED);
316 adm->header.size = htons ((uint16_t) msg_length);
317 adm->barrier_name = rm->barrier_name;
318 send_message_to_locals (i, j, ns, &adm->header);
319 GNUNET_free (adm);
320}
321
322
323static void
324send_all_local_tests_prepared (unsigned int i, unsigned int j, struct 309send_all_local_tests_prepared (unsigned int i, unsigned int j, struct
325 NetJailState *ns) 310 NetJailState *ns)
326{ 311{
@@ -357,11 +342,14 @@ send_all_peers_started (unsigned int i, unsigned int j, struct NetJailState *ns)
357 342
358 343
359void 344void
360barrier_attached (struct NetJailState *ns, const struct GNUNET_MessageHeader *message) 345barrier_attached (struct NetJailState *ns, const struct
346 GNUNET_MessageHeader *message)
361{ 347{
362 struct GNUNET_TESTING_CommandBarrierAttached *am; 348 struct GNUNET_TESTING_CommandBarrierAttached *am;
363 struct GNUNET_TESTING_NetjailNode *node; 349 struct GNUNET_TESTING_NetjailNode *node;
364 struct GNUNET_TESTING_Barrier *barrier; 350 struct GNUNET_TESTING_Barrier *barrier;
351 struct GNUNET_ShortHashCode key;
352 struct GNUNET_HashCode hc;
365 353
366 am = (struct GNUNET_TESTING_CommandBarrierAttached *) message; 354 am = (struct GNUNET_TESTING_CommandBarrierAttached *) message;
367 barrier = GNUNET_TESTING_get_barrier (ns->is, am->barrier_name); 355 barrier = GNUNET_TESTING_get_barrier (ns->is, am->barrier_name);
@@ -371,7 +359,13 @@ barrier_attached (struct NetJailState *ns, const struct GNUNET_MessageHeader *me
371 { 359 {
372 node = GNUNET_new (struct GNUNET_TESTING_NetjailNode); 360 node = GNUNET_new (struct GNUNET_TESTING_NetjailNode);
373 node->node_number = am->node_number; 361 node->node_number = am->node_number;
374 GNUNET_TESTING_barrier_add_node (barrier->nodes, node); 362
363 GNUNET_CRYPTO_hash (&(node->node_number), sizeof(node->node_number), &hc);
364 memcpy (&key, &hc, sizeof (key));
365 GNUNET_CONTAINER_multishortmap_put (barrier->nodes,
366 &key,
367 node,
368 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
375 } 369 }
376 node->expected_reaches = node->expected_reaches + am->expected_reaches; 370 node->expected_reaches = node->expected_reaches + am->expected_reaches;
377 barrier->expected_reaches = barrier->expected_reaches + am->expected_reaches; 371 barrier->expected_reaches = barrier->expected_reaches + am->expected_reaches;
@@ -379,10 +373,15 @@ barrier_attached (struct NetJailState *ns, const struct GNUNET_MessageHeader *me
379 373
380 374
381void 375void
382barrier_reached (struct NetJailState *ns, const struct GNUNET_MessageHeader *message) 376barrier_reached (struct NetJailState *ns, const struct
377 GNUNET_MessageHeader *message)
383{ 378{
384 struct GNUNET_TESTING_CommandBarrierReached *rm = (struct GNUNET_TESTING_CommandBarrierReached *) message; 379 struct GNUNET_TESTING_CommandBarrierReached *rm = (struct
385 struct GNUNET_TESTING_Barrier *barrier = GNUNET_TESTING_get_barrier (ns->is, rm->barrier_name); 380 GNUNET_TESTING_CommandBarrierReached
381 *) message;
382 struct GNUNET_TESTING_Barrier *barrier = GNUNET_TESTING_get_barrier (ns->is,
383 rm->
384 barrier_name);
386 385
387 GNUNET_assert (NULL != barrier && GNUNET_NO == barrier->shadow); 386 GNUNET_assert (NULL != barrier && GNUNET_NO == barrier->shadow);
388 barrier->reached++; 387 barrier->reached++;
@@ -414,62 +413,62 @@ helper_mst (void *cls, const struct GNUNET_MessageHeader *message)
414 413
415 switch (message_type) 414 switch (message_type)
416 { 415 {
417 case GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_ATTACHED: 416 case GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_ATTACHED:
418 barrier_attached (ns, message); 417 barrier_attached (ns, message);
419 break; 418 break;
420 case GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_REACHED: 419 case GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_REACHED:
421 barrier_reached (ns, message); 420 barrier_reached (ns, message);
422 break; 421 break;
423 case GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY: 422 case GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY:
424 ns->number_of_testsystems_started++; 423 ns->number_of_testsystems_started++;
425 break; 424 break;
426 case GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED: 425 case GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED:
427 ns->number_of_peers_started++; 426 ns->number_of_peers_started++;
428 if (ns->number_of_peers_started == total_number) 427 if (ns->number_of_peers_started == total_number)
428 {
429 for (int i = 1; i <= ns->known; i++)
429 { 430 {
430 for (int i = 1; i <= ns->known; i++) 431 send_all_peers_started (0,i, ns);
431 {
432 send_all_peers_started (0,i, ns);
433 }
434 for (int i = 1; i <= ns->global_n; i++)
435 {
436 for (int j = 1; j <= ns->local_m; j++)
437 {
438 send_all_peers_started (i,j, ns);
439 }
440 }
441 ns->number_of_peers_started = 0;
442 } 432 }
443 break; 433 for (int i = 1; i <= ns->global_n; i++)
444 case GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TEST_PREPARED:
445 ns->number_of_local_tests_prepared++;
446 if (ns->number_of_local_tests_prepared == total_number)
447 { 434 {
448 for (int i = 1; i <= ns->known; i++) 435 for (int j = 1; j <= ns->local_m; j++)
449 { 436 {
450 send_all_local_tests_prepared (0,i, ns); 437 send_all_peers_started (i,j, ns);
451 } 438 }
439 }
440 ns->number_of_peers_started = 0;
441 }
442 break;
443 case GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TEST_PREPARED:
444 ns->number_of_local_tests_prepared++;
445 if (ns->number_of_local_tests_prepared == total_number)
446 {
447 for (int i = 1; i <= ns->known; i++)
448 {
449 send_all_local_tests_prepared (0,i, ns);
450 }
452 451
453 for (int i = 1; i <= ns->global_n; i++) 452 for (int i = 1; i <= ns->global_n; i++)
453 {
454 for (int j = 1; j <= ns->local_m; j++)
454 { 455 {
455 for (int j = 1; j <= ns->local_m; j++) 456 send_all_local_tests_prepared (i,j, ns);
456 {
457 send_all_local_tests_prepared (i,j, ns);
458 }
459 } 457 }
460 } 458 }
461 break; 459 }
462 case GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED: 460 break;
463 ns->number_of_local_tests_finished++; 461 case GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED:
464 if (ns->number_of_local_tests_finished == total_number) 462 ns->number_of_local_tests_finished++;
465 { 463 if (ns->number_of_local_tests_finished == total_number)
466 GNUNET_SCHEDULER_cancel (ns->timeout_task); 464 {
467 GNUNET_TESTING_async_finish (&ns->ac); 465 GNUNET_SCHEDULER_cancel (ns->timeout_task);
468 } 466 GNUNET_TESTING_async_finish (&ns->ac);
469 break; 467 }
470 default: 468 break;
471 // We received a message we can not handle. 469 default:
472 GNUNET_assert (0); 470 // We received a message we can not handle.
471 GNUNET_assert (0);
473 } 472 }
474 473
475 LOG (GNUNET_ERROR_TYPE_DEBUG, 474 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -541,7 +540,7 @@ start_helper (struct NetJailState *ns,
541 unsigned int m, 540 unsigned int m,
542 unsigned int n) 541 unsigned int n)
543{ 542{
544 struct Plugin *plugin; 543 struct TestcasePlugin *plugin;
545 struct GNUNET_HELPER_Handle *helper; 544 struct GNUNET_HELPER_Handle *helper;
546 struct GNUNET_TESTING_CommandHelperInit *msg; 545 struct GNUNET_TESTING_CommandHelperInit *msg;
547 struct TestingSystemCount *tbc; 546 struct TestingSystemCount *tbc;
@@ -556,6 +555,7 @@ start_helper (struct NetJailState *ns,
556 pid_t pid; 555 pid_t pid;
557 unsigned int script_num; 556 unsigned int script_num;
558 struct GNUNET_ShortHashCode *hkey; 557 struct GNUNET_ShortHashCode *hkey;
558 struct GNUNET_ShortHashCode key;
559 struct GNUNET_HashCode hc; 559 struct GNUNET_HashCode hc;
560 struct GNUNET_TESTING_NetjailTopology *topology = ns->topology; 560 struct GNUNET_TESTING_NetjailTopology *topology = ns->topology;
561 struct GNUNET_TESTING_NetjailNode *node; 561 struct GNUNET_TESTING_NetjailNode *node;
@@ -563,9 +563,9 @@ start_helper (struct NetJailState *ns,
563 struct GNUNET_TESTING_NetjailNamespace *namespace; 563 struct GNUNET_TESTING_NetjailNamespace *namespace;
564 char *data_dir; 564 char *data_dir;
565 char *script_name; 565 char *script_name;
566 struct GNUNET_TESTING_Barrier *barriers; 566 struct GNUNET_TESTING_BarrierListEntry *pos;
567 struct GNUNET_TESTING_Barrier *pos;
568 struct GNUNET_TESTING_Barrier *barrier; 567 struct GNUNET_TESTING_Barrier *barrier;
568 struct GNUNET_TESTING_BarrierList *barriers;
569 569
570 if (0 == n) 570 if (0 == n)
571 script_num = m - 1; 571 script_num = m - 1;
@@ -691,28 +691,35 @@ start_helper (struct NetJailState *ns,
691 691
692 } 692 }
693 693
694 plugin = GNUNET_new (struct Plugin); 694 plugin = GNUNET_new (struct TestcasePlugin);
695 plugin->api = GNUNET_PLUGIN_load (plugin_name, 695 plugin->api = GNUNET_PLUGIN_load (plugin_name,
696 NULL); 696 NULL);
697 barriers = plugin->api->get_waiting_for_barriers (); 697 barriers = plugin->api->get_waiting_for_barriers ();
698 698
699 699
700 for (pos = barriers; NULL != pos; pos = pos->next) 700 for (pos = barriers->head; NULL != pos; pos = pos->next)
701 { 701 {
702 barrier = GNUNET_TESTING_get_barrier (ns->is, pos->name); 702 barrier = GNUNET_TESTING_get_barrier (ns->is, pos->barrier->name);
703 if (NULL == barrier || GNUNET_YES == barrier->shadow) 703 if (NULL == barrier || GNUNET_YES == barrier->shadow)
704 { 704 {
705 GNUNET_TESTING_barrier_add (ns->is, pos); 705 GNUNET_TESTING_interpreter_add_barrier (ns->is, pos->barrier);
706 barrier = pos; 706 barrier = pos->barrier;
707 barrier->nodes = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); 707 barrier->nodes = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
708 } 708 }
709 GNUNET_assert (NULL != node); 709 GNUNET_assert (NULL != node);
710 barrier_node = GNUNET_new (struct GNUNET_TESTING_NetjailNode); 710 barrier_node = GNUNET_new (struct GNUNET_TESTING_NetjailNode);
711 barrier_node->node_number = node->node_number; 711 barrier_node->node_number = node->node_number;
712 barrier_node->expected_reaches = pos->expected_reaches; 712 barrier_node->expected_reaches = pos->barrier->expected_reaches;
713 barrier->expected_reaches = barrier->expected_reaches + pos->expected_reaches; 713 barrier->expected_reaches = barrier->expected_reaches
714 GNUNET_TESTING_barrier_add_node (barrier->nodes, node); 714 + pos->barrier->expected_reaches;
715 GNUNET_CRYPTO_hash (&(node->node_number), sizeof(node->node_number), &hc);
716 memcpy (&key, &hc, sizeof (key));
717 GNUNET_CONTAINER_multishortmap_put (barrier->nodes,
718 &key,
719 node,
720 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
715 } 721 }
722 // FIXME Free barriers??
716 tbc->plugin = plugin; 723 tbc->plugin = plugin;
717 724
718 msg = create_helper_init_msg_ (plugin_name); 725 msg = create_helper_init_msg_ (plugin_name);
diff --git a/src/testing/testing_api_cmd_netjail_stop.c b/src/testing/testing_api_cmd_netjail_stop.c
index 49151a168..c13d177fb 100644
--- a/src/testing/testing_api_cmd_netjail_stop.c
+++ b/src/testing/testing_api_cmd_netjail_stop.c
@@ -26,6 +26,8 @@
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_testing_ng_lib.h" 28#include "gnunet_testing_ng_lib.h"
29#include "gnunet_testing_plugin.h"
30#include "gnunet_testing_barrier.h"
29#include "gnunet_testing_netjail_lib.h" 31#include "gnunet_testing_netjail_lib.h"
30 32
31 33
diff --git a/src/testing/testing_api_cmd_netjail_stop_testsystem.c b/src/testing/testing_api_cmd_netjail_stop_testsystem.c
index 38b14ac5c..8f63216ef 100644
--- a/src/testing/testing_api_cmd_netjail_stop_testsystem.c
+++ b/src/testing/testing_api_cmd_netjail_stop_testsystem.c
@@ -25,6 +25,8 @@
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_testing_ng_lib.h" 27#include "gnunet_testing_ng_lib.h"
28#include "gnunet_testing_plugin.h"
29#include "gnunet_testing_barrier.h"
28#include "gnunet_testing_netjail_lib.h" 30#include "gnunet_testing_netjail_lib.h"
29#include "testing_cmds.h" 31#include "testing_cmds.h"
30 32
diff --git a/src/testing/testing_api_cmd_send_peer_ready.c b/src/testing/testing_api_cmd_send_peer_ready.c
index d76a95ae8..dcd69e595 100644
--- a/src/testing/testing_api_cmd_send_peer_ready.c
+++ b/src/testing/testing_api_cmd_send_peer_ready.c
@@ -26,6 +26,8 @@
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_testing_ng_lib.h" 28#include "gnunet_testing_ng_lib.h"
29#include "gnunet_testing_plugin.h"
30#include "gnunet_testing_barrier.h"
29#include "gnunet_testing_netjail_lib.h" 31#include "gnunet_testing_netjail_lib.h"
30#include "testing_cmds.h" 32#include "testing_cmds.h"
31 33
@@ -40,7 +42,7 @@ struct SendPeerReadyState
40 * Callback to write messages to the master loop. 42 * Callback to write messages to the master loop.
41 * 43 *
42 */ 44 */
43 TESTING_CMD_HELPER_write_cb write_message; 45 GNUNET_TESTING_cmd_helper_write_cb write_message;
44 46
45 /** 47 /**
46 * The message send back to the master loop. 48 * The message send back to the master loop.
@@ -107,7 +109,7 @@ send_peer_ready_run (void *cls,
107 */ 109 */
108struct GNUNET_TESTING_Command 110struct GNUNET_TESTING_Command
109GNUNET_TESTING_cmd_send_peer_ready (const char *label, 111GNUNET_TESTING_cmd_send_peer_ready (const char *label,
110 TESTING_CMD_HELPER_write_cb write_message) 112 GNUNET_TESTING_cmd_helper_write_cb write_message)
111{ 113{
112 struct SendPeerReadyState *sprs; 114 struct SendPeerReadyState *sprs;
113 115
diff --git a/src/testing/testing_api_cmd_system_create.c b/src/testing/testing_api_cmd_system_create.c
index 66b0f57b9..46fbd706e 100644
--- a/src/testing/testing_api_cmd_system_create.c
+++ b/src/testing/testing_api_cmd_system_create.c
@@ -26,6 +26,7 @@
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_testing_ng_lib.h" 28#include "gnunet_testing_ng_lib.h"
29#include "gnunet_testing_plugin.h"
29#include "gnunet_testing_netjail_lib.h" 30#include "gnunet_testing_netjail_lib.h"
30#include "gnunet_testing_lib.h" 31#include "gnunet_testing_lib.h"
31 32
diff --git a/src/testing/testing_api_cmd_system_destroy.c b/src/testing/testing_api_cmd_system_destroy.c
index 23d8b9162..45adfd0da 100644
--- a/src/testing/testing_api_cmd_system_destroy.c
+++ b/src/testing/testing_api_cmd_system_destroy.c
@@ -26,6 +26,7 @@
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_testing_ng_lib.h" 28#include "gnunet_testing_ng_lib.h"
29#include "gnunet_testing_plugin.h"
29#include "gnunet_testing_netjail_lib.h" 30#include "gnunet_testing_netjail_lib.h"
30#include "gnunet_testing_lib.h" 31#include "gnunet_testing_lib.h"
31 32
diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c
index da95500f7..f133956cf 100644
--- a/src/testing/testing_api_loop.c
+++ b/src/testing/testing_api_loop.c
@@ -28,7 +28,9 @@
28#include "platform.h" 28#include "platform.h"
29#include "gnunet_util_lib.h" 29#include "gnunet_util_lib.h"
30#include "gnunet_testing_ng_lib.h" 30#include "gnunet_testing_ng_lib.h"
31#include "gnunet_testing_plugin.h"
31#include "gnunet_testing_barrier.h" 32#include "gnunet_testing_barrier.h"
33#include "gnunet_testing_netjail_lib.h"
32#include "testing.h" 34#include "testing.h"
33 35
34/** 36/**
@@ -71,7 +73,7 @@ struct GNUNET_TESTING_Interpreter
71 /** 73 /**
72 * Map with barriers for this loop. 74 * Map with barriers for this loop.
73 */ 75 */
74 struct GNUNET_CONTAINER_MultiShortmap *barriers; 76 struct GNUNET_CONTAINER_MultiShortmap *barriers;
75 77
76 /** 78 /**
77 * Number of GNUNET_TESTING_Command in commands. 79 * Number of GNUNET_TESTING_Command in commands.
@@ -528,17 +530,17 @@ GNUNET_TESTING_command_new (void *cls,
528 GNUNET_TESTING_CommandGetTraits traits, 530 GNUNET_TESTING_CommandGetTraits traits,
529 struct GNUNET_TESTING_AsyncContext *ac) 531 struct GNUNET_TESTING_AsyncContext *ac)
530{ 532{
531 struct GNUNET_TESTING_Command cmd = { 533 struct GNUNET_TESTING_Command cmd = {
532 .cls = cls, 534 .cls = cls,
533 .run = run, 535 .run = run,
534 .ac = ac, 536 .ac = ac,
535 .cleanup = cleanup, 537 .cleanup = cleanup,
536 .traits = traits 538 .traits = traits
537 }; 539 };
538 memset (&cmd, 0, sizeof (cmd)); 540 memset (&cmd, 0, sizeof (cmd));
539 strncpy (cmd.label, label, GNUNET_TESTING_CMD_MAX_LABEL_LENGTH); 541 strncpy (cmd.label, label, GNUNET_TESTING_CMD_MAX_LABEL_LENGTH);
540 542
541 return cmd; 543 return cmd;
542 544
543} 545}
544 546
@@ -649,8 +651,8 @@ GNUNET_TESTING_send_message_to_netjail (struct GNUNET_TESTING_Interpreter *is,
649 const struct GNUNET_HELPER_Handle *helper; 651 const struct GNUNET_HELPER_Handle *helper;
650 652
651 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 653 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
652 "send message of type %u to locals\n", 654 "send message of type %u to locals\n",
653 header->type); 655 header->type);
654 helper = is->helper[global_node_number - 1]; 656 helper = is->helper[global_node_number - 1];
655 struct GNUNET_HELPER_SendHandle *sh = GNUNET_HELPER_send ( 657 struct GNUNET_HELPER_SendHandle *sh = GNUNET_HELPER_send (
656 (struct GNUNET_HELPER_Handle *) helper, 658 (struct GNUNET_HELPER_Handle *) helper,
@@ -691,18 +693,19 @@ void
691GNUNET_TESTING_finish_attached_cmds (struct GNUNET_TESTING_Interpreter *is, 693GNUNET_TESTING_finish_attached_cmds (struct GNUNET_TESTING_Interpreter *is,
692 struct GNUNET_TESTING_Barrier *barrier) 694 struct GNUNET_TESTING_Barrier *barrier)
693{ 695{
694 struct GNUNET_TESTING_Command *pos; 696 struct CommandListEntry *pos;
695 struct FreeBarrierNodeCbCls *free_barrier_node_cb_cls; 697 struct FreeBarrierNodeCbCls *free_barrier_node_cb_cls;
696 698
697 while (NULL != (pos = barrier->cmds_head)) 699 while (NULL != (pos = barrier->cmds_head))
698 { 700 {
699 if (GNUNET_NO == pos->ac->finished && GNUNET_NO == pos->asynchronous_finish) 701 if (GNUNET_NO == pos->command->ac->finished &&
702 GNUNET_NO == pos->command->asynchronous_finish)
700 { 703 {
701 GNUNET_TESTING_async_finish (pos->ac); 704 GNUNET_TESTING_async_finish (pos->command->ac);
702 } 705 }
703 else if (GNUNET_NO == pos->ac->finished) 706 else if (GNUNET_NO == pos->command->ac->finished)
704 { 707 {
705 pos->asynchronous_finish = GNUNET_YES; 708 pos->command->asynchronous_finish = GNUNET_YES;
706 } 709 }
707 GNUNET_CONTAINER_DLL_remove (barrier->cmds_head, 710 GNUNET_CONTAINER_DLL_remove (barrier->cmds_head,
708 barrier->cmds_tail, 711 barrier->cmds_tail,
@@ -715,7 +718,8 @@ GNUNET_TESTING_finish_attached_cmds (struct GNUNET_TESTING_Interpreter *is,
715 free_barrier_node_cb_cls = GNUNET_new (struct FreeBarrierNodeCbCls); 718 free_barrier_node_cb_cls = GNUNET_new (struct FreeBarrierNodeCbCls);
716 free_barrier_node_cb_cls->barrier = barrier; 719 free_barrier_node_cb_cls->barrier = barrier;
717 free_barrier_node_cb_cls->is = is; 720 free_barrier_node_cb_cls->is = is;
718 GNUNET_CONTAINER_multishortmap_iterate (barrier->nodes, free_barrier_node_cb, free_barrier_node_cb_cls); 721 GNUNET_CONTAINER_multishortmap_iterate (barrier->nodes, free_barrier_node_cb,
722 free_barrier_node_cb_cls);
719 GNUNET_CONTAINER_multishortmap_destroy (barrier->nodes); 723 GNUNET_CONTAINER_multishortmap_destroy (barrier->nodes);
720 GNUNET_free (free_barrier_node_cb_cls); 724 GNUNET_free (free_barrier_node_cb_cls);
721} 725}
@@ -723,18 +727,19 @@ GNUNET_TESTING_finish_attached_cmds (struct GNUNET_TESTING_Interpreter *is,
723 727
724int 728int
725free_barriers_cb (void *cls, 729free_barriers_cb (void *cls,
726 const struct GNUNET_ShortHashCode *key, 730 const struct GNUNET_ShortHashCode *key,
727 void *value) 731 void *value)
728{ 732{
729 struct GNUNET_TESTING_Interpreter *is = cls; 733 struct GNUNET_TESTING_Interpreter *is = cls;
730 struct GNUNET_TESTING_Barrier *barrier = value; 734 struct GNUNET_TESTING_Barrier *barrier = value;
731 struct GNUNET_TESTING_Command *pos; 735 struct CommandListEntry *pos;
732 struct FreeBarrierNodeCbCls *free_barrier_node_cb_cls; 736 struct FreeBarrierNodeCbCls *free_barrier_node_cb_cls;
733 737
734 free_barrier_node_cb_cls = GNUNET_new (struct FreeBarrierNodeCbCls); 738 free_barrier_node_cb_cls = GNUNET_new (struct FreeBarrierNodeCbCls);
735 free_barrier_node_cb_cls->barrier = barrier; 739 free_barrier_node_cb_cls->barrier = barrier;
736 free_barrier_node_cb_cls->is = is; 740 free_barrier_node_cb_cls->is = is;
737 GNUNET_CONTAINER_multishortmap_iterate (barrier->nodes, free_barrier_node_cb, free_barrier_node_cb_cls); 741 GNUNET_CONTAINER_multishortmap_iterate (barrier->nodes, free_barrier_node_cb,
742 free_barrier_node_cb_cls);
738 GNUNET_CONTAINER_multishortmap_destroy (barrier->nodes); 743 GNUNET_CONTAINER_multishortmap_destroy (barrier->nodes);
739 744
740 while (NULL != (pos = barrier->cmds_head)) 745 while (NULL != (pos = barrier->cmds_head))
@@ -778,12 +783,12 @@ GNUNET_TESTING_get_barrier (struct GNUNET_TESTING_Interpreter *is,
778 struct GNUNET_ShortHashCode create_key; 783 struct GNUNET_ShortHashCode create_key;
779 struct GNUNET_TESTING_Barrier *barrier; 784 struct GNUNET_TESTING_Barrier *barrier;
780 785
781 GNUNET_CRYPTO_hash (barrier_name, strlen(barrier_name), &hc); 786 GNUNET_CRYPTO_hash (barrier_name, strlen (barrier_name), &hc);
782 memcpy (&create_key, 787 memcpy (&create_key,
783 &hc, 788 &hc,
784 sizeof (create_key)); 789 sizeof (create_key));
785 barrier = GNUNET_CONTAINER_multishortmap_get (is->barriers, &create_key); 790 barrier = GNUNET_CONTAINER_multishortmap_get (is->barriers, &create_key);
786 //GNUNET_free (create_key); 791 // GNUNET_free (create_key);
787 return barrier; 792 return barrier;
788} 793}
789 794
@@ -794,16 +799,16 @@ GNUNET_TESTING_get_barrier (struct GNUNET_TESTING_Interpreter *is,
794 * @param barrier The barrier to add. 799 * @param barrier The barrier to add.
795 */ 800 */
796void 801void
797GNUNET_TESTING_barrier_add (struct GNUNET_TESTING_Interpreter *is, 802GNUNET_TESTING_interpreter_add_barrier (struct GNUNET_TESTING_Interpreter *is,
798 struct GNUNET_TESTING_Barrier *barrier) 803 struct GNUNET_TESTING_Barrier *barrier)
799{ 804{
800 struct GNUNET_HashCode hc; 805 struct GNUNET_HashCode hc;
801 struct GNUNET_ShortHashCode create_key; 806 struct GNUNET_ShortHashCode create_key;
802 807
803 GNUNET_CRYPTO_hash (barrier->name, strlen(barrier->name), &hc); 808 GNUNET_CRYPTO_hash (barrier->name, strlen (barrier->name), &hc);
804 memcpy (&create_key, 809 memcpy (&create_key,
805 &hc, 810 &hc,
806 sizeof (create_key)); 811 sizeof (create_key));
807 GNUNET_CONTAINER_multishortmap_put (is->barriers, 812 GNUNET_CONTAINER_multishortmap_put (is->barriers,
808 &create_key, 813 &create_key,
809 barrier, 814 barrier,
diff --git a/src/testing/testing_api_traits.c b/src/testing/testing_api_traits.c
index 9b54443a1..ee3edbed0 100644
--- a/src/testing/testing_api_traits.c
+++ b/src/testing/testing_api_traits.c
@@ -27,6 +27,8 @@
27 */ 27 */
28#include "platform.h" 28#include "platform.h"
29#include "gnunet_testing_ng_lib.h" 29#include "gnunet_testing_ng_lib.h"
30#include "gnunet_testing_plugin.h"
31#include "gnunet_testing_barrier.h"
30#include "gnunet_testing_netjail_lib.h" 32#include "gnunet_testing_netjail_lib.h"
31 33
32 34
diff --git a/src/testing/testing_cmds.h b/src/testing/testing_cmds.h
index edc4dfe19..a5ea59a3a 100644
--- a/src/testing/testing_cmds.h
+++ b/src/testing/testing_cmds.h
@@ -28,62 +28,11 @@
28#define TESTING_CMDS_H 28#define TESTING_CMDS_H
29 29
30#define HELPER_CMDS_BINARY "gnunet-cmds-helper" 30#define HELPER_CMDS_BINARY "gnunet-cmds-helper"
31#include "gnunet_common.h"
31 32
32GNUNET_NETWORK_STRUCT_BEGIN 33GNUNET_NETWORK_STRUCT_BEGIN
33 34
34/** 35/**
35 * Handle for a plugin.
36 */
37struct Plugin
38{
39 /**
40 * Name of the shared library.
41 */
42 char *library_name;
43
44 /**
45 * Plugin API.
46 */
47 struct GNUNET_TESTING_PluginFunctions *api;
48
49 /**
50 * IP address of the specific node the helper is running for.
51 *
52 */
53 char *node_ip;
54
55 /**
56 * Name of the test case plugin.
57 *
58 */
59 char *plugin_name;
60
61 /**
62 * The number of namespaces
63 *
64 */
65 char *global_n;
66
67 /**
68 * The number of local nodes per namespace.
69 *
70 */
71 char *local_m;
72
73 /**
74 * The number of the namespace this node is in.
75 *
76 */
77 char *n;
78
79 /**
80 * The number of the node in the namespace.
81 *
82 */
83 char *m;
84};
85
86/**
87 * Initialization message for gnunet-cmds-testbed to start cmd binary. 36 * Initialization message for gnunet-cmds-testbed to start cmd binary.
88 */ 37 */
89struct GNUNET_TESTING_CommandHelperInit 38struct GNUNET_TESTING_CommandHelperInit
diff --git a/src/transport/test_transport_plugin_cmd_nat_upnp.c b/src/transport/test_transport_plugin_cmd_nat_upnp.c
index 73380e03c..3fef41d87 100644
--- a/src/transport/test_transport_plugin_cmd_nat_upnp.c
+++ b/src/transport/test_transport_plugin_cmd_nat_upnp.c
@@ -87,21 +87,25 @@ handle_test (void *cls,
87} 87}
88 88
89 89
90struct GNUNET_TESTING_Barrier * 90struct GNUNET_TESTING_BarrierList*
91get_waiting_for_barriers () 91get_waiting_for_barriers ()
92{ 92{
93 struct GNUNET_TESTING_Barrier *barriers_head; 93 struct GNUNET_TESTING_BarrierList* barriers;
94 struct GNUNET_TESTING_Barrier *barriers_tail; 94 struct GNUNET_TESTING_BarrierListEntry *ble;
95 struct GNUNET_TESTING_Barrier *ready_to_connect; 95
96 struct GNUNET_TESTING_Barrier *test_case_finished; 96 barriers = GNUNET_new (struct GNUNET_TESTING_BarrierList);
97 97 ble = GNUNET_new (struct GNUNET_TESTING_BarrierListEntry);
98 ready_to_connect = GNUNET_new (struct GNUNET_TESTING_Barrier); 98 ble->barrier = GNUNET_TESTING_barrier_new ("ready-to-connect");
99 ready_to_connect->name = "ready-to-connect"; 99 GNUNET_CONTAINER_DLL_insert (barriers->head,
100 test_case_finished = GNUNET_new (struct GNUNET_TESTING_Barrier); 100 barriers->tail,
101 test_case_finished->name = "test-case-finished"; 101 ble);
102 GNUNET_CONTAINER_DLL_insert (barriers_head, barriers_tail, ready_to_connect); 102
103 GNUNET_CONTAINER_DLL_insert (barriers_head, barriers_tail, test_case_finished); 103 ble = GNUNET_new (struct GNUNET_TESTING_BarrierListEntry);
104 return barriers_head; 104 ble->barrier = GNUNET_TESTING_barrier_new ("test-case-finished");
105 GNUNET_CONTAINER_DLL_insert (barriers->head,
106 barriers->tail,
107 ble);
108 return barriers;
105} 109}
106 110
107 111
@@ -143,7 +147,7 @@ static void
143handle_result (void *cls, 147handle_result (void *cls,
144 enum GNUNET_GenericReturnValue rv) 148 enum GNUNET_GenericReturnValue rv)
145{ 149{
146 struct TestState *ts = cls; 150 struct GNUNET_TESTING_TestState *ts = cls;
147 151
148 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 152 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
149 "Local test exits with status %d\n", 153 "Local test exits with status %d\n",
@@ -186,7 +190,7 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is,
186static void 190static void
187all_local_tests_prepared () 191all_local_tests_prepared ()
188{ 192{
189 const struct LocalPreparedState *lfs; 193 const struct GNUNET_TESTING_LocalPreparedState *lfs;
190 194
191 GNUNET_TESTING_get_trait_local_prepared_state (&local_prepared, 195 GNUNET_TESTING_get_trait_local_prepared_state (&local_prepared,
192 &lfs); 196 &lfs);
@@ -210,7 +214,7 @@ all_local_tests_prepared ()
210 * @param local_m The number of nodes in a network namespace. 214 * @param local_m The number of nodes in a network namespace.
211 */ 215 */
212static void 216static void
213start_testcase (TESTING_CMD_HELPER_write_cb write_message, 217start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message,
214 const char *router_ip, 218 const char *router_ip,
215 const char *node_ip, 219 const char *node_ip,
216 const char *m, 220 const char *m,
@@ -218,14 +222,14 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message,
218 const char *local_m, 222 const char *local_m,
219 const char *topology_data, 223 const char *topology_data,
220 unsigned int *read_file, 224 unsigned int *read_file,
221 TESTING_CMD_HELPER_finish_cb finished_cb) 225 GNUNET_TESTING_cmd_helper_finish_cb finished_cb)
222{ 226{
223 227
224 unsigned int n_int; 228 unsigned int n_int;
225 unsigned int m_int; 229 unsigned int m_int;
226 unsigned int local_m_int; 230 unsigned int local_m_int;
227 unsigned int num; 231 unsigned int num;
228 struct TestState *ts = GNUNET_new (struct TestState); 232 struct GNUNET_TESTING_TestState *ts = GNUNET_new (struct GNUNET_TESTING_TestState);
229 struct GNUNET_TESTING_NetjailTopology *topology; 233 struct GNUNET_TESTING_NetjailTopology *topology;
230 unsigned int sscanf_ret = 0; 234 unsigned int sscanf_ret = 0;
231 235
diff --git a/src/transport/test_transport_plugin_cmd_simple_send.c b/src/transport/test_transport_plugin_cmd_simple_send.c
index de923cbdd..e94667593 100644
--- a/src/transport/test_transport_plugin_cmd_simple_send.c
+++ b/src/transport/test_transport_plugin_cmd_simple_send.c
@@ -87,13 +87,11 @@ handle_test (void *cls,
87} 87}
88 88
89 89
90struct GNUNET_TESTING_Barrier * 90struct GNUNET_TESTING_BarrierList *
91get_waiting_for_barriers () 91get_waiting_for_barriers ()
92{ 92{
93 struct GNUNET_TESTING_Barrier *barrier;
94
95 //No Barrier 93 //No Barrier
96 return NULL; 94 return GNUNET_new (struct GNUNET_TESTING_BarrierList);
97} 95}
98 96
99 97
@@ -135,7 +133,7 @@ static void
135handle_result (void *cls, 133handle_result (void *cls,
136 enum GNUNET_GenericReturnValue rv) 134 enum GNUNET_GenericReturnValue rv)
137{ 135{
138 struct TestState *ts = cls; 136 struct GNUNET_TESTING_TestState *ts = cls;
139 137
140 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 138 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
141 "Local test exits with status %d\n", 139 "Local test exits with status %d\n",
@@ -178,7 +176,7 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is,
178static void 176static void
179all_local_tests_prepared () 177all_local_tests_prepared ()
180{ 178{
181 const struct LocalPreparedState *lfs; 179 const struct GNUNET_TESTING_LocalPreparedState *lfs;
182 180
183 GNUNET_TESTING_get_trait_local_prepared_state (&local_prepared, 181 GNUNET_TESTING_get_trait_local_prepared_state (&local_prepared,
184 &lfs); 182 &lfs);
@@ -202,7 +200,7 @@ all_local_tests_prepared ()
202 * @param local_m The number of nodes in a network namespace. 200 * @param local_m The number of nodes in a network namespace.
203 */ 201 */
204static void 202static void
205start_testcase (TESTING_CMD_HELPER_write_cb write_message, 203start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message,
206 const char *router_ip, 204 const char *router_ip,
207 const char *node_ip, 205 const char *node_ip,
208 const char *m, 206 const char *m,
@@ -210,14 +208,14 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message,
210 const char *local_m, 208 const char *local_m,
211 const char *topology_data, 209 const char *topology_data,
212 unsigned int *read_file, 210 unsigned int *read_file,
213 TESTING_CMD_HELPER_finish_cb finished_cb) 211 GNUNET_TESTING_cmd_helper_finish_cb finished_cb)
214{ 212{
215 213
216 unsigned int n_int; 214 unsigned int n_int;
217 unsigned int m_int; 215 unsigned int m_int;
218 unsigned int local_m_int; 216 unsigned int local_m_int;
219 unsigned int num; 217 unsigned int num;
220 struct TestState *ts = GNUNET_new (struct TestState); 218 struct GNUNET_TESTING_TestState *ts = GNUNET_new (struct GNUNET_TESTING_TestState);
221 struct GNUNET_TESTING_NetjailTopology *topology; 219 struct GNUNET_TESTING_NetjailTopology *topology;
222 unsigned int sscanf_ret = 0; 220 unsigned int sscanf_ret = 0;
223 221
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 ff6f0def9..4eeb25ec8 100644
--- a/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c
+++ b/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c
@@ -87,13 +87,11 @@ handle_test (void *cls,
87} 87}
88 88
89 89
90struct GNUNET_TESTING_Barrier * 90struct GNUNET_TESTING_BarrierList *
91get_waiting_for_barriers () 91get_waiting_for_barriers ()
92{ 92{
93 struct GNUNET_TESTING_Barrier *barrier;
94
95 //No Barrier 93 //No Barrier
96 return NULL; 94 return GNUNET_new (struct GNUNET_TESTING_BarrierList);
97} 95}
98 96
99 97
@@ -137,7 +135,7 @@ static void
137handle_result (void *cls, 135handle_result (void *cls,
138 enum GNUNET_GenericReturnValue rv) 136 enum GNUNET_GenericReturnValue rv)
139{ 137{
140 struct TestState *ts = cls; 138 struct GNUNET_TESTING_TestState *ts = cls;
141 139
142 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 140 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
143 "Local test exits with status %d\n", 141 "Local test exits with status %d\n",
@@ -161,7 +159,7 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is,
161 const struct GNUNET_TESTING_AsyncContext *ac; 159 const struct GNUNET_TESTING_AsyncContext *ac;
162 void *ret = NULL; 160 void *ret = NULL;
163 const struct GNUNET_TESTING_Command *cmd; 161 const struct GNUNET_TESTING_Command *cmd;
164 struct BlockState *bs; 162 struct GNUNET_TESTING_BlockState *bs;
165 163
166 164
167 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 165 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -190,7 +188,7 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is,
190 cmd->label); 188 cmd->label);
191 GNUNET_TESTING_get_trait_block_state ( 189 GNUNET_TESTING_get_trait_block_state (
192 cmd, 190 cmd,
193 (const struct BlockState **) &bs); 191 (const struct GNUNET_TESTING_BlockState **) &bs);
194 192
195 LOG (GNUNET_ERROR_TYPE_DEBUG, 193 LOG (GNUNET_ERROR_TYPE_DEBUG,
196 "block state %u\n", 194 "block state %u\n",
@@ -211,7 +209,7 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is,
211static void 209static void
212all_local_tests_prepared () 210all_local_tests_prepared ()
213{ 211{
214 const struct LocalPreparedState *lfs; 212 const struct GNUNET_TESTING_LocalPreparedState *lfs;
215 213
216 GNUNET_TESTING_get_trait_local_prepared_state (&local_prepared, 214 GNUNET_TESTING_get_trait_local_prepared_state (&local_prepared,
217 &lfs); 215 &lfs);
@@ -235,7 +233,7 @@ all_local_tests_prepared ()
235 * @param local_m The number of nodes in a network namespace. 233 * @param local_m The number of nodes in a network namespace.
236 */ 234 */
237static void 235static void
238start_testcase (TESTING_CMD_HELPER_write_cb write_message, 236start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message,
239 const char *router_ip, 237 const char *router_ip,
240 const char *node_ip, 238 const char *node_ip,
241 const char *m, 239 const char *m,
@@ -243,13 +241,13 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message,
243 const char *local_m, 241 const char *local_m,
244 const char *topology_data, 242 const char *topology_data,
245 unsigned int *read_file, 243 unsigned int *read_file,
246 TESTING_CMD_HELPER_finish_cb finished_cb) 244 GNUNET_TESTING_cmd_helper_finish_cb finished_cb)
247{ 245{
248 unsigned int n_int; 246 unsigned int n_int;
249 unsigned int m_int; 247 unsigned int m_int;
250 unsigned int local_m_int; 248 unsigned int local_m_int;
251 unsigned int num; 249 unsigned int num;
252 struct TestState *ts = GNUNET_new (struct TestState); 250 struct GNUNET_TESTING_TestState *ts = GNUNET_new (struct GNUNET_TESTING_TestState);
253 struct GNUNET_TESTING_NetjailTopology *topology; 251 struct GNUNET_TESTING_NetjailTopology *topology;
254 unsigned int sscanf_ret = 0; 252 unsigned int sscanf_ret = 0;
255 253
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 adbb3cc0b..fe2c04401 100644
--- a/src/transport/test_transport_plugin_cmd_simple_send_dv.c
+++ b/src/transport/test_transport_plugin_cmd_simple_send_dv.c
@@ -87,7 +87,7 @@ handle_test (void *cls,
87 const struct GNUNET_TESTING_AsyncContext *ac_block; 87 const struct GNUNET_TESTING_AsyncContext *ac_block;
88 const struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map; 88 const struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map;
89 unsigned int connected; 89 unsigned int connected;
90 struct BlockState *bs; 90 struct GNUNET_TESTING_BlockState *bs;
91 struct GNUNET_TRANSPORT_CoreHandle *ch; 91 struct GNUNET_TRANSPORT_CoreHandle *ch;
92 const struct StartPeerState *sps; 92 const struct StartPeerState *sps;
93 93
@@ -129,7 +129,7 @@ handle_test (void *cls,
129 { 129 {
130 GNUNET_TESTING_get_trait_block_state ( 130 GNUNET_TESTING_get_trait_block_state (
131 &block_receive, 131 &block_receive,
132 (const struct BlockState **) &bs); 132 (const struct GNUNET_TESTING_BlockState **) &bs);
133 bs->asynchronous_finish = GNUNET_YES; 133 bs->asynchronous_finish = GNUNET_YES;
134 } 134 }
135 135
@@ -139,13 +139,11 @@ handle_test (void *cls,
139} 139}
140 140
141 141
142struct GNUNET_TESTING_Barrier * 142struct GNUNET_TESTING_BarrierList *
143get_waiting_for_barriers () 143get_waiting_for_barriers ()
144{ 144{
145 struct GNUNET_TESTING_Barrier *barrier;
146
147 //No Barrier 145 //No Barrier
148 return NULL; 146 return GNUNET_new (struct GNUNET_TESTING_BarrierList);
149} 147}
150 148
151 149
@@ -189,7 +187,7 @@ static void
189handle_result (void *cls, 187handle_result (void *cls,
190 enum GNUNET_GenericReturnValue rv) 188 enum GNUNET_GenericReturnValue rv)
191{ 189{
192 struct TestState *ts = cls; 190 struct GNUNET_TESTING_TestState *ts = cls;
193 191
194 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 192 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
195 "Local test exits with status %d\n", 193 "Local test exits with status %d\n",
@@ -234,7 +232,7 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is,
234static void 232static void
235all_local_tests_prepared () 233all_local_tests_prepared ()
236{ 234{
237 const struct LocalPreparedState *lfs; 235 const struct GNUNET_TESTING_LocalPreparedState *lfs;
238 236
239 GNUNET_TESTING_get_trait_local_prepared_state (&local_prepared, 237 GNUNET_TESTING_get_trait_local_prepared_state (&local_prepared,
240 &lfs); 238 &lfs);
@@ -258,7 +256,7 @@ all_local_tests_prepared ()
258 * @param local_m The number of nodes in a network namespace. 256 * @param local_m The number of nodes in a network namespace.
259 */ 257 */
260static void 258static void
261start_testcase (TESTING_CMD_HELPER_write_cb write_message, 259start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message,
262 const char *router_ip, 260 const char *router_ip,
263 const char *node_ip, 261 const char *node_ip,
264 const char *m, 262 const char *m,
@@ -266,13 +264,13 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message,
266 const char *local_m, 264 const char *local_m,
267 const char *topology_data, 265 const char *topology_data,
268 unsigned int *read_file, 266 unsigned int *read_file,
269 TESTING_CMD_HELPER_finish_cb finished_cb) 267 GNUNET_TESTING_cmd_helper_finish_cb finished_cb)
270{ 268{
271 unsigned int n_int; 269 unsigned int n_int;
272 unsigned int m_int; 270 unsigned int m_int;
273 unsigned int local_m_int; 271 unsigned int local_m_int;
274 unsigned int num; 272 unsigned int num;
275 struct TestState *ts = GNUNET_new (struct TestState); 273 struct GNUNET_TESTING_TestState *ts = GNUNET_new (struct GNUNET_TESTING_TestState);
276 struct GNUNET_TESTING_NetjailTopology *topology; 274 struct GNUNET_TESTING_NetjailTopology *topology;
277 struct GNUNET_MQ_MessageHandler handlers[] = { 275 struct GNUNET_MQ_MessageHandler handlers[] = {
278 GNUNET_MQ_hd_var_size (test, 276 GNUNET_MQ_hd_var_size (test,
diff --git a/src/transport/test_transport_plugin_cmd_udp_backchannel.c b/src/transport/test_transport_plugin_cmd_udp_backchannel.c
index 1bc965848..f96a25e80 100644
--- a/src/transport/test_transport_plugin_cmd_udp_backchannel.c
+++ b/src/transport/test_transport_plugin_cmd_udp_backchannel.c
@@ -85,13 +85,11 @@ handle_test (void *cls,
85} 85}
86 86
87 87
88struct GNUNET_TESTING_Barrier * 88struct GNUNET_TESTING_BarrierList *
89get_waiting_for_barriers () 89get_waiting_for_barriers ()
90{ 90{
91 struct GNUNET_TESTING_Barrier *barrier;
92
93 // No Barrier 91 // No Barrier
94 return NULL; 92 return GNUNET_new (struct GNUNET_TESTING_BarrierList);
95} 93}
96 94
97 95
@@ -134,7 +132,7 @@ static void
134handle_result (void *cls, 132handle_result (void *cls,
135 enum GNUNET_GenericReturnValue rv) 133 enum GNUNET_GenericReturnValue rv)
136{ 134{
137 struct TestState *ts = cls; 135 struct GNUNET_TESTING_TestState *ts = cls;
138 136
139 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 137 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
140 "Local test exits with status %d\n", 138 "Local test exits with status %d\n",
@@ -173,7 +171,7 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is,
173static void 171static void
174all_local_tests_prepared () 172all_local_tests_prepared ()
175{ 173{
176 const struct LocalPreparedState *lfs; 174 const struct GNUNET_TESTING_LocalPreparedState *lfs;
177 175
178 GNUNET_TESTING_get_trait_local_prepared_state (&local_prepared, 176 GNUNET_TESTING_get_trait_local_prepared_state (&local_prepared,
179 &lfs); 177 &lfs);
@@ -196,7 +194,7 @@ all_local_tests_prepared ()
196 * @param local_m The number of nodes in a network namespace. 194 * @param local_m The number of nodes in a network namespace.
197 */ 195 */
198static void 196static void
199start_testcase (TESTING_CMD_HELPER_write_cb write_message, 197start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message,
200 const char *router_ip, 198 const char *router_ip,
201 const char *node_ip, 199 const char *node_ip,
202 const char *m, 200 const char *m,
@@ -204,14 +202,14 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message,
204 const char *local_m, 202 const char *local_m,
205 const char *topology_data, 203 const char *topology_data,
206 unsigned int *read_file, 204 unsigned int *read_file,
207 TESTING_CMD_HELPER_finish_cb finished_cb) 205 GNUNET_TESTING_cmd_helper_finish_cb finished_cb)
208{ 206{
209 207
210 unsigned int n_int; 208 unsigned int n_int;
211 unsigned int m_int; 209 unsigned int m_int;
212 unsigned int local_m_int; 210 unsigned int local_m_int;
213 unsigned int num; 211 unsigned int num;
214 struct TestState *ts = GNUNET_new (struct TestState); 212 struct GNUNET_TESTING_TestState *ts = GNUNET_new (struct GNUNET_TESTING_TestState);
215 struct GNUNET_TESTING_NetjailTopology *topology; 213 struct GNUNET_TESTING_NetjailTopology *topology;
216 unsigned int sscanf_ret = 0; 214 unsigned int sscanf_ret = 0;
217 215