aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2022-12-08 17:52:42 +0900
committerMartin Schanzenbach <schanzen@gnunet.org>2022-12-08 17:52:42 +0900
commit1029772b39c7aab734c43df1188180764ff5c34b (patch)
treecdca60dca1e063a3c35c7e8a97e46e59909749dc /src/testing
parent5c4b060714954a6e4571fe981b333856d2ef4a1b (diff)
downloadgnunet-1029772b39c7aab734c43df1188180764ff5c34b.tar.gz
gnunet-1029772b39c7aab734c43df1188180764ff5c34b.zip
TESTING: Properly handle label allocations
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/gnunet-cmds-helper.c10
-rw-r--r--src/testing/testing_api_cmd_barrier.c2
-rw-r--r--src/testing/testing_api_cmd_barrier_reached.c2
-rw-r--r--src/testing/testing_api_cmd_batch.c2
-rw-r--r--src/testing/testing_api_cmd_block_until_external_trigger.c2
-rw-r--r--src/testing/testing_api_cmd_finish.c2
-rw-r--r--src/testing/testing_api_cmd_local_test_finished.c2
-rw-r--r--src/testing/testing_api_cmd_local_test_prepared.c2
-rw-r--r--src/testing/testing_api_cmd_netjail_start.c2
-rw-r--r--src/testing/testing_api_cmd_netjail_start_testsystem.c2
-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.c2
-rw-r--r--src/testing/testing_api_cmd_system_create.c2
-rw-r--r--src/testing/testing_api_cmd_system_destroy.c2
-rw-r--r--src/testing/testing_api_loop.c3
16 files changed, 21 insertions, 20 deletions
diff --git a/src/testing/gnunet-cmds-helper.c b/src/testing/gnunet-cmds-helper.c
index 591ddd499..f87a055c3 100644
--- a/src/testing/gnunet-cmds-helper.c
+++ b/src/testing/gnunet-cmds-helper.c
@@ -385,15 +385,19 @@ tokenizer_cb (void *cls, const struct GNUNET_MessageHeader *message)
385 LOG (GNUNET_ERROR_TYPE_ERROR, 385 LOG (GNUNET_ERROR_TYPE_ERROR,
386 "subnet node n: %s\n", 386 "subnet node n: %s\n",
387 plugin->n); 387 plugin->n);
388 // FIXME: Free?
389 node_ip = GNUNET_malloc (strlen (NODE_BASE_IP) + strlen (plugin->m) + 1); 388 node_ip = GNUNET_malloc (strlen (NODE_BASE_IP) + strlen (plugin->m) + 1);
390 strcat (node_ip, NODE_BASE_IP); 389 strcat (node_ip, NODE_BASE_IP);
391 } 390 }
392 strcat (node_ip, plugin->m); 391 strcat (node_ip, plugin->m);
393 392
394 plugin->api->start_testcase (&write_message, router_ip, node_ip, plugin->m, 393 plugin->api->start_testcase (&write_message, router_ip, node_ip, plugin->m,
394
395 plugin->n, plugin->local_m, ni->topology_data, 395 plugin->n, plugin->local_m, ni->topology_data,
396 ni->read_file, &finished_cb); 396 ni->read_file, &finished_cb);
397 GNUNET_free (node_ip);
398 GNUNET_free (binary);
399 GNUNET_free (router_ip);
400 GNUNET_free (plugin_name);
397 401
398 msg_length = sizeof(struct GNUNET_TESTING_CommandHelperReply); 402 msg_length = sizeof(struct GNUNET_TESTING_CommandHelperReply);
399 reply = GNUNET_new (struct GNUNET_TESTING_CommandHelperReply); 403 reply = GNUNET_new (struct GNUNET_TESTING_CommandHelperReply);
@@ -402,10 +406,6 @@ tokenizer_cb (void *cls, const struct GNUNET_MessageHeader *message)
402 406
403 write_message ((struct GNUNET_MessageHeader *) reply, msg_length); 407 write_message ((struct GNUNET_MessageHeader *) reply, msg_length);
404 408
405 GNUNET_free (binary);
406 GNUNET_free (router_ip);
407 GNUNET_free (plugin_name);
408
409 return GNUNET_OK; 409 return GNUNET_OK;
410 } 410 }
411 else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_ADVANCED == ntohs ( 411 else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_ADVANCED == ntohs (
diff --git a/src/testing/testing_api_cmd_barrier.c b/src/testing/testing_api_cmd_barrier.c
index b0293f2c7..ad75f8297 100644
--- a/src/testing/testing_api_cmd_barrier.c
+++ b/src/testing/testing_api_cmd_barrier.c
@@ -245,7 +245,7 @@ GNUNET_TESTING_cmd_barrier_create (const char *label,
245 { 245 {
246 struct GNUNET_TESTING_Command cmd = { 246 struct GNUNET_TESTING_Command cmd = {
247 .cls = bs, 247 .cls = bs,
248 .label = label, 248 .label = GNUNET_strdup (label),
249 .run = &barrier_run, 249 .run = &barrier_run,
250 .cleanup = &barrier_cleanup, 250 .cleanup = &barrier_cleanup,
251 .traits = &barrier_traits 251 .traits = &barrier_traits
diff --git a/src/testing/testing_api_cmd_barrier_reached.c b/src/testing/testing_api_cmd_barrier_reached.c
index 7e6f58fc1..43bf86398 100644
--- a/src/testing/testing_api_cmd_barrier_reached.c
+++ b/src/testing/testing_api_cmd_barrier_reached.c
@@ -202,7 +202,7 @@ GNUNET_TESTING_cmd_barrier_reached (
202 { 202 {
203 struct GNUNET_TESTING_Command cmd = { 203 struct GNUNET_TESTING_Command cmd = {
204 .cls = brs, 204 .cls = brs,
205 .label = label, 205 .label = GNUNET_strdup (label),
206 .run = &barrier_reached_run, 206 .run = &barrier_reached_run,
207 .ac = &brs->ac, 207 .ac = &brs->ac,
208 .cleanup = &barrier_reached_cleanup, 208 .cleanup = &barrier_reached_cleanup,
diff --git a/src/testing/testing_api_cmd_batch.c b/src/testing/testing_api_cmd_batch.c
index 080a4880d..e7ecbf28d 100644
--- a/src/testing/testing_api_cmd_batch.c
+++ b/src/testing/testing_api_cmd_batch.c
@@ -173,7 +173,7 @@ GNUNET_TESTING_cmd_batch (const char *label,
173 { 173 {
174 struct GNUNET_TESTING_Command cmd = { 174 struct GNUNET_TESTING_Command cmd = {
175 .cls = bs, 175 .cls = bs,
176 .label = label, 176 .label = GNUNET_strdup (label),
177 .run = &batch_run, 177 .run = &batch_run,
178 .cleanup = &batch_cleanup, 178 .cleanup = &batch_cleanup,
179 .traits = &batch_traits 179 .traits = &batch_traits
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 347791b7a..b4f088077 100644
--- a/src/testing/testing_api_cmd_block_until_external_trigger.c
+++ b/src/testing/testing_api_cmd_block_until_external_trigger.c
@@ -111,7 +111,7 @@ GNUNET_TESTING_cmd_block_until_external_trigger (
111 { 111 {
112 struct GNUNET_TESTING_Command cmd = { 112 struct GNUNET_TESTING_Command cmd = {
113 .cls = bs, 113 .cls = bs,
114 .label = label, 114 .label = GNUNET_strdup (label),
115 .run = &block_until_all_peers_started_run, 115 .run = &block_until_all_peers_started_run,
116 .ac = &bs->ac, 116 .ac = &bs->ac,
117 .cleanup = &block_until_all_peers_started_cleanup, 117 .cleanup = &block_until_all_peers_started_cleanup,
diff --git a/src/testing/testing_api_cmd_finish.c b/src/testing/testing_api_cmd_finish.c
index 47199d3d6..cad5edc67 100644
--- a/src/testing/testing_api_cmd_finish.c
+++ b/src/testing/testing_api_cmd_finish.c
@@ -178,7 +178,7 @@ GNUNET_TESTING_cmd_finish (const char *finish_label,
178 { 178 {
179 struct GNUNET_TESTING_Command cmd = { 179 struct GNUNET_TESTING_Command cmd = {
180 .cls = finish_state, 180 .cls = finish_state,
181 .label = finish_label, 181 .label = GNUNET_strdup (finish_label),
182 .run = &run_finish, 182 .run = &run_finish,
183 .ac = &finish_state->ac, 183 .ac = &finish_state->ac,
184 .cleanup = &cleanup_finish 184 .cleanup = &cleanup_finish
diff --git a/src/testing/testing_api_cmd_local_test_finished.c b/src/testing/testing_api_cmd_local_test_finished.c
index 709c6b62f..7eca7e0d3 100644
--- a/src/testing/testing_api_cmd_local_test_finished.c
+++ b/src/testing/testing_api_cmd_local_test_finished.c
@@ -110,7 +110,7 @@ GNUNET_TESTING_cmd_local_test_finished (
110 { 110 {
111 struct GNUNET_TESTING_Command cmd = { 111 struct GNUNET_TESTING_Command cmd = {
112 .cls = lfs, 112 .cls = lfs,
113 .label = label, 113 .label = GNUNET_strdup (label),
114 .run = &local_test_finished_run, 114 .run = &local_test_finished_run,
115 .cleanup = &local_test_finished_cleanup, 115 .cleanup = &local_test_finished_cleanup,
116 }; 116 };
diff --git a/src/testing/testing_api_cmd_local_test_prepared.c b/src/testing/testing_api_cmd_local_test_prepared.c
index 0b88586e8..a4082f0e3 100644
--- a/src/testing/testing_api_cmd_local_test_prepared.c
+++ b/src/testing/testing_api_cmd_local_test_prepared.c
@@ -104,7 +104,7 @@ GNUNET_TESTING_cmd_local_test_prepared (const char *label,
104 104
105 struct GNUNET_TESTING_Command cmd = { 105 struct GNUNET_TESTING_Command cmd = {
106 .cls = lfs, 106 .cls = lfs,
107 .label = label, 107 .label = GNUNET_strdup (label),
108 .run = &local_test_prepared_run, 108 .run = &local_test_prepared_run,
109 .ac = &lfs->ac, 109 .ac = &lfs->ac,
110 .cleanup = &local_test_prepared_cleanup, 110 .cleanup = &local_test_prepared_cleanup,
diff --git a/src/testing/testing_api_cmd_netjail_start.c b/src/testing/testing_api_cmd_netjail_start.c
index 6cd648c3a..8b239275b 100644
--- a/src/testing/testing_api_cmd_netjail_start.c
+++ b/src/testing/testing_api_cmd_netjail_start.c
@@ -225,7 +225,7 @@ GNUNET_TESTING_cmd_netjail_start (const char *label,
225 { 225 {
226 struct GNUNET_TESTING_Command cmd = { 226 struct GNUNET_TESTING_Command cmd = {
227 .cls = ns, 227 .cls = ns,
228 .label = label, 228 .label = GNUNET_strdup (label),
229 .run = &netjail_start_run, 229 .run = &netjail_start_run,
230 .ac = &ns->ac, 230 .ac = &ns->ac,
231 .cleanup = &netjail_start_cleanup 231 .cleanup = &netjail_start_cleanup
diff --git a/src/testing/testing_api_cmd_netjail_start_testsystem.c b/src/testing/testing_api_cmd_netjail_start_testsystem.c
index 4b2fbcc56..d33284b78 100644
--- a/src/testing/testing_api_cmd_netjail_start_testsystem.c
+++ b/src/testing/testing_api_cmd_netjail_start_testsystem.c
@@ -827,7 +827,7 @@ GNUNET_TESTING_cmd_netjail_start_testing_system (
827 827
828 struct GNUNET_TESTING_Command cmd = { 828 struct GNUNET_TESTING_Command cmd = {
829 .cls = ns, 829 .cls = ns,
830 .label = label, 830 .label = GNUNET_strdup (label),
831 .run = &netjail_exec_run, 831 .run = &netjail_exec_run,
832 .ac = &ns->ac, 832 .ac = &ns->ac,
833 .cleanup = &netjail_exec_cleanup, 833 .cleanup = &netjail_exec_cleanup,
diff --git a/src/testing/testing_api_cmd_netjail_stop.c b/src/testing/testing_api_cmd_netjail_stop.c
index f1b2260ab..05435f63c 100644
--- a/src/testing/testing_api_cmd_netjail_stop.c
+++ b/src/testing/testing_api_cmd_netjail_stop.c
@@ -192,7 +192,7 @@ GNUNET_TESTING_cmd_netjail_stop (const char *label,
192 { 192 {
193 struct GNUNET_TESTING_Command cmd = { 193 struct GNUNET_TESTING_Command cmd = {
194 .cls = ns, 194 .cls = ns,
195 .label = label, 195 .label = GNUNET_strdup (label),
196 .run = &netjail_stop_run, 196 .run = &netjail_stop_run,
197 .ac = &ns->ac, 197 .ac = &ns->ac,
198 .cleanup = &netjail_stop_cleanup 198 .cleanup = &netjail_stop_cleanup
diff --git a/src/testing/testing_api_cmd_netjail_stop_testsystem.c b/src/testing/testing_api_cmd_netjail_stop_testsystem.c
index 2e42056dc..69455c909 100644
--- a/src/testing/testing_api_cmd_netjail_stop_testsystem.c
+++ b/src/testing/testing_api_cmd_netjail_stop_testsystem.c
@@ -149,7 +149,7 @@ GNUNET_TESTING_cmd_stop_testing_system (
149 149
150 struct GNUNET_TESTING_Command cmd = { 150 struct GNUNET_TESTING_Command cmd = {
151 .cls = shs, 151 .cls = shs,
152 .label = label, 152 .label = GNUNET_strdup (label),
153 .run = &stop_testing_system_run, 153 .run = &stop_testing_system_run,
154 .cleanup = &stop_testing_system_cleanup, 154 .cleanup = &stop_testing_system_cleanup,
155 }; 155 };
diff --git a/src/testing/testing_api_cmd_send_peer_ready.c b/src/testing/testing_api_cmd_send_peer_ready.c
index 1a2607047..f277b8dbd 100644
--- a/src/testing/testing_api_cmd_send_peer_ready.c
+++ b/src/testing/testing_api_cmd_send_peer_ready.c
@@ -116,7 +116,7 @@ GNUNET_TESTING_cmd_send_peer_ready (const char *label,
116 { 116 {
117 struct GNUNET_TESTING_Command cmd = { 117 struct GNUNET_TESTING_Command cmd = {
118 .cls = sprs, 118 .cls = sprs,
119 .label = label, 119 .label = GNUNET_strdup (label),
120 .run = &send_peer_ready_run, 120 .run = &send_peer_ready_run,
121 .cleanup = &send_peer_ready_cleanup, 121 .cleanup = &send_peer_ready_cleanup,
122 .traits = &send_peer_ready_traits 122 .traits = &send_peer_ready_traits
diff --git a/src/testing/testing_api_cmd_system_create.c b/src/testing/testing_api_cmd_system_create.c
index 221bbb8f6..4199eccd6 100644
--- a/src/testing/testing_api_cmd_system_create.c
+++ b/src/testing/testing_api_cmd_system_create.c
@@ -119,7 +119,7 @@ GNUNET_TESTING_cmd_system_create (const char *label,
119 119
120 struct GNUNET_TESTING_Command cmd = { 120 struct GNUNET_TESTING_Command cmd = {
121 .cls = tss, 121 .cls = tss,
122 .label = label, 122 .label = GNUNET_strdup (label),
123 .run = &system_create_run, 123 .run = &system_create_run,
124 .cleanup = &system_create_cleanup, 124 .cleanup = &system_create_cleanup,
125 .traits = &system_create_traits 125 .traits = &system_create_traits
diff --git a/src/testing/testing_api_cmd_system_destroy.c b/src/testing/testing_api_cmd_system_destroy.c
index 5a2440766..ebb975fc3 100644
--- a/src/testing/testing_api_cmd_system_destroy.c
+++ b/src/testing/testing_api_cmd_system_destroy.c
@@ -107,7 +107,7 @@ GNUNET_TESTING_cmd_system_destroy (const char *label,
107 { 107 {
108 struct GNUNET_TESTING_Command cmd = { 108 struct GNUNET_TESTING_Command cmd = {
109 .cls = tss, 109 .cls = tss,
110 .label = label, 110 .label = GNUNET_strdup (label),
111 .run = &system_destroy_run, 111 .run = &system_destroy_run,
112 .cleanup = &system_destroy_cleanup, 112 .cleanup = &system_destroy_cleanup,
113 .traits = &system_destroy_traits 113 .traits = &system_destroy_traits
diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c
index 420e1cfcc..01af7da2a 100644
--- a/src/testing/testing_api_loop.c
+++ b/src/testing/testing_api_loop.c
@@ -41,7 +41,7 @@ struct GNUNET_TESTING_Interpreter
41 * Send handle for sending messages to netjail nodes. 41 * Send handle for sending messages to netjail nodes.
42 */ 42 */
43 struct GNUNET_HELPER_SendHandle *sh; 43 struct GNUNET_HELPER_SendHandle *sh;
44 44
45 /** 45 /**
46 * Array with handles of helper processes for communication with netjails. 46 * Array with handles of helper processes for communication with netjails.
47 */ 47 */
@@ -271,6 +271,7 @@ finish_test (void *cls)
271 "Cleaning up cmd %s\n", 271 "Cleaning up cmd %s\n",
272 cmd->label); 272 cmd->label);
273 cmd->cleanup (cmd->cls); 273 cmd->cleanup (cmd->cls);
274 GNUNET_free (cmd->label);
274 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 275 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
275 "Cleaned up cmd %s\n", 276 "Cleaned up cmd %s\n",
276 cmd->label); 277 cmd->label);