[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: TESTING: Properly handle label allocatio
From: |
gnunet |
Subject: |
[gnunet] branch master updated: TESTING: Properly handle label allocations |
Date: |
Thu, 08 Dec 2022 09:52:48 +0100 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new 1029772b3 TESTING: Properly handle label allocations
1029772b3 is described below
commit 1029772b39c7aab734c43df1188180764ff5c34b
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Thu Dec 8 17:52:42 2022 +0900
TESTING: Properly handle label allocations
---
src/include/gnunet_testing_ng_lib.h | 4 ++--
src/testing/gnunet-cmds-helper.c | 10 +++++-----
src/testing/testing_api_cmd_barrier.c | 2 +-
src/testing/testing_api_cmd_barrier_reached.c | 2 +-
src/testing/testing_api_cmd_batch.c | 2 +-
src/testing/testing_api_cmd_block_until_external_trigger.c | 2 +-
src/testing/testing_api_cmd_finish.c | 2 +-
src/testing/testing_api_cmd_local_test_finished.c | 2 +-
src/testing/testing_api_cmd_local_test_prepared.c | 2 +-
src/testing/testing_api_cmd_netjail_start.c | 2 +-
src/testing/testing_api_cmd_netjail_start_testsystem.c | 2 +-
src/testing/testing_api_cmd_netjail_stop.c | 2 +-
src/testing/testing_api_cmd_netjail_stop_testsystem.c | 2 +-
src/testing/testing_api_cmd_send_peer_ready.c | 2 +-
src/testing/testing_api_cmd_system_create.c | 2 +-
src/testing/testing_api_cmd_system_destroy.c | 2 +-
src/testing/testing_api_loop.c | 3 ++-
src/transport/test_transport_plugin_cmd_udp_backchannel.c | 11 ++++++-----
src/transport/transport-testing-cmds.h | 9 ++++++---
src/transport/transport_api_cmd_backchannel_check.c | 2 +-
src/transport/transport_api_cmd_connecting_peers.c | 2 +-
src/transport/transport_api_cmd_start_peer.c | 11 +++++++----
src/transport/transport_api_cmd_stop_peer.c | 2 +-
23 files changed, 45 insertions(+), 37 deletions(-)
diff --git a/src/include/gnunet_testing_ng_lib.h
b/src/include/gnunet_testing_ng_lib.h
index db89e1a8e..88910f65f 100644
--- a/src/include/gnunet_testing_ng_lib.h
+++ b/src/include/gnunet_testing_ng_lib.h
@@ -108,7 +108,7 @@ struct GNUNET_TESTING_Command
/**
* Label for the command.
*/
- const char *label;
+ char *label;
/**
* Runs the command. Note that upon return, the interpreter
@@ -434,7 +434,7 @@ GNUNET_TESTING_get_barrier (struct
GNUNET_TESTING_Interpreter *is,
*
* @param is The interpreter.
* @param barrier The barrier to add.
- */
+ */
void
GNUNET_TESTING_barrier_add (struct GNUNET_TESTING_Interpreter *is,
struct GNUNET_TESTING_Barrier *barrier);
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)
LOG (GNUNET_ERROR_TYPE_ERROR,
"subnet node n: %s\n",
plugin->n);
- // FIXME: Free?
node_ip = GNUNET_malloc (strlen (NODE_BASE_IP) + strlen (plugin->m) + 1);
strcat (node_ip, NODE_BASE_IP);
}
strcat (node_ip, plugin->m);
plugin->api->start_testcase (&write_message, router_ip, node_ip, plugin->m,
+
plugin->n, plugin->local_m, ni->topology_data,
ni->read_file, &finished_cb);
+ GNUNET_free (node_ip);
+ GNUNET_free (binary);
+ GNUNET_free (router_ip);
+ GNUNET_free (plugin_name);
msg_length = sizeof(struct GNUNET_TESTING_CommandHelperReply);
reply = GNUNET_new (struct GNUNET_TESTING_CommandHelperReply);
@@ -402,10 +406,6 @@ tokenizer_cb (void *cls, const struct GNUNET_MessageHeader
*message)
write_message ((struct GNUNET_MessageHeader *) reply, msg_length);
- GNUNET_free (binary);
- GNUNET_free (router_ip);
- GNUNET_free (plugin_name);
-
return GNUNET_OK;
}
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,
{
struct GNUNET_TESTING_Command cmd = {
.cls = bs,
- .label = label,
+ .label = GNUNET_strdup (label),
.run = &barrier_run,
.cleanup = &barrier_cleanup,
.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 (
{
struct GNUNET_TESTING_Command cmd = {
.cls = brs,
- .label = label,
+ .label = GNUNET_strdup (label),
.run = &barrier_reached_run,
.ac = &brs->ac,
.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,
{
struct GNUNET_TESTING_Command cmd = {
.cls = bs,
- .label = label,
+ .label = GNUNET_strdup (label),
.run = &batch_run,
.cleanup = &batch_cleanup,
.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 (
{
struct GNUNET_TESTING_Command cmd = {
.cls = bs,
- .label = label,
+ .label = GNUNET_strdup (label),
.run = &block_until_all_peers_started_run,
.ac = &bs->ac,
.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,
{
struct GNUNET_TESTING_Command cmd = {
.cls = finish_state,
- .label = finish_label,
+ .label = GNUNET_strdup (finish_label),
.run = &run_finish,
.ac = &finish_state->ac,
.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 (
{
struct GNUNET_TESTING_Command cmd = {
.cls = lfs,
- .label = label,
+ .label = GNUNET_strdup (label),
.run = &local_test_finished_run,
.cleanup = &local_test_finished_cleanup,
};
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,
struct GNUNET_TESTING_Command cmd = {
.cls = lfs,
- .label = label,
+ .label = GNUNET_strdup (label),
.run = &local_test_prepared_run,
.ac = &lfs->ac,
.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,
{
struct GNUNET_TESTING_Command cmd = {
.cls = ns,
- .label = label,
+ .label = GNUNET_strdup (label),
.run = &netjail_start_run,
.ac = &ns->ac,
.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 (
struct GNUNET_TESTING_Command cmd = {
.cls = ns,
- .label = label,
+ .label = GNUNET_strdup (label),
.run = &netjail_exec_run,
.ac = &ns->ac,
.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,
{
struct GNUNET_TESTING_Command cmd = {
.cls = ns,
- .label = label,
+ .label = GNUNET_strdup (label),
.run = &netjail_stop_run,
.ac = &ns->ac,
.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 (
struct GNUNET_TESTING_Command cmd = {
.cls = shs,
- .label = label,
+ .label = GNUNET_strdup (label),
.run = &stop_testing_system_run,
.cleanup = &stop_testing_system_cleanup,
};
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,
{
struct GNUNET_TESTING_Command cmd = {
.cls = sprs,
- .label = label,
+ .label = GNUNET_strdup (label),
.run = &send_peer_ready_run,
.cleanup = &send_peer_ready_cleanup,
.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,
struct GNUNET_TESTING_Command cmd = {
.cls = tss,
- .label = label,
+ .label = GNUNET_strdup (label),
.run = &system_create_run,
.cleanup = &system_create_cleanup,
.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,
{
struct GNUNET_TESTING_Command cmd = {
.cls = tss,
- .label = label,
+ .label = GNUNET_strdup (label),
.run = &system_destroy_run,
.cleanup = &system_destroy_cleanup,
.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
* Send handle for sending messages to netjail nodes.
*/
struct GNUNET_HELPER_SendHandle *sh;
-
+
/**
* Array with handles of helper processes for communication with netjails.
*/
@@ -271,6 +271,7 @@ finish_test (void *cls)
"Cleaning up cmd %s\n",
cmd->label);
cmd->cleanup (cmd->cls);
+ GNUNET_free (cmd->label);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Cleaned up cmd %s\n",
cmd->label);
diff --git a/src/transport/test_transport_plugin_cmd_udp_backchannel.c
b/src/transport/test_transport_plugin_cmd_udp_backchannel.c
index 81445b25e..1bc965848 100644
--- a/src/transport/test_transport_plugin_cmd_udp_backchannel.c
+++ b/src/transport/test_transport_plugin_cmd_udp_backchannel.c
@@ -90,7 +90,7 @@ get_waiting_for_barriers ()
{
struct GNUNET_TESTING_Barrier *barrier;
- //No Barrier
+ // No Barrier
return NULL;
}
@@ -98,7 +98,8 @@ get_waiting_for_barriers ()
static void
barrier_advanced (const char *barrier_name)
{
- struct GNUNET_TESTING_Barrier *barrier = GNUNET_TESTING_get_barrier (is,
barrier_name);
+ struct GNUNET_TESTING_Barrier *barrier = GNUNET_TESTING_get_barrier (is,
+
barrier_name);
GNUNET_TESTING_finish_attached_cmds (is, barrier);
}
@@ -329,9 +330,9 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message,
ts->write_message = write_message;
is = GNUNET_TESTING_run (commands,
- TIMEOUT,
- &handle_result,
- ts);
+ TIMEOUT,
+ &handle_result,
+ ts);
}
diff --git a/src/transport/transport-testing-cmds.h
b/src/transport/transport-testing-cmds.h
index 680162563..26933a575 100644
--- a/src/transport/transport-testing-cmds.h
+++ b/src/transport/transport-testing-cmds.h
@@ -109,20 +109,22 @@ struct StartPeerState
/**
* The ip of a node.
*/
- const char *node_ip;
+ char *node_ip;
/**
* Receive callback
*/
struct GNUNET_MQ_MessageHandler *handlers;
- const char *cfgname;
+ //FIXME documentation
+ char *cfgname;
/**
* Peer's configuration
*/
struct GNUNET_CONFIGURATION_Handle *cfg;
+ //FIXME documentation
struct GNUNET_TESTING_Peer *peer;
/**
@@ -165,13 +167,14 @@ struct StartPeerState
*/
size_t hello_size;
+ /** All of the below: FIXME documentation */
char *m;
char *n;
char *local_m;
- const char *system_label;
+ char *system_label;
/**
* An unique number to identify the peer
diff --git a/src/transport/transport_api_cmd_backchannel_check.c
b/src/transport/transport_api_cmd_backchannel_check.c
index 0376275a3..e67d9a79c 100644
--- a/src/transport/transport_api_cmd_backchannel_check.c
+++ b/src/transport/transport_api_cmd_backchannel_check.c
@@ -547,7 +547,7 @@ GNUNET_TRANSPORT_cmd_backchannel_check (const char *label,
struct GNUNET_TESTING_Command cmd = {
.cls = cs,
- .label = label,
+ .label = GNUNET_strdup (label),
.run = &backchannel_check_run,
.ac = &cs->ac,
.cleanup = &backchannel_check_cleanup,
diff --git a/src/transport/transport_api_cmd_connecting_peers.c
b/src/transport/transport_api_cmd_connecting_peers.c
index a6006f698..d610bbcb7 100644
--- a/src/transport/transport_api_cmd_connecting_peers.c
+++ b/src/transport/transport_api_cmd_connecting_peers.c
@@ -254,7 +254,7 @@ GNUNET_TRANSPORT_cmd_connect_peers (const char *label,
{
struct GNUNET_TESTING_Command cmd = {
.cls = cps,
- .label = label,
+ .label = GNUNET_strdup (label),
.run = &connect_peers_run,
.ac = &cps->ac,
.cleanup = &connect_peers_cleanup,
diff --git a/src/transport/transport_api_cmd_start_peer.c
b/src/transport/transport_api_cmd_start_peer.c
index 5dfb820e0..7de1d842e 100644
--- a/src/transport/transport_api_cmd_start_peer.c
+++ b/src/transport/transport_api_cmd_start_peer.c
@@ -386,6 +386,9 @@ start_peer_cleanup (void *cls)
GNUNET_CONFIGURATION_destroy (sps->cfg);
sps->cfg = NULL;
}
+ GNUNET_free (sps->cfgname);
+ GNUNET_free (sps->node_ip);
+ GNUNET_free (sps->system_label);
GNUNET_free (sps->hello);
GNUNET_free (sps->connected_peers_map);
GNUNET_free (sps);
@@ -449,10 +452,10 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label,
sps = GNUNET_new (struct StartPeerState);
sps->no = no;
- sps->system_label = system_label;
+ sps->system_label = GNUNET_strdup (system_label);
sps->connected_peers_map = connected_peers_map;
- sps->cfgname = cfgname;
- sps->node_ip = node_ip;
+ sps->cfgname = GNUNET_strdup (cfgname);
+ sps->node_ip = GNUNET_strdup (node_ip);
sps->notify_connect = notify_connect;
sps->broadcast = broadcast;
@@ -469,7 +472,7 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label,
struct GNUNET_TESTING_Command cmd = {
.cls = sps,
- .label = label,
+ .label = GNUNET_strdup (label),
.run = &start_peer_run,
.ac = &sps->ac,
.cleanup = &start_peer_cleanup,
diff --git a/src/transport/transport_api_cmd_stop_peer.c
b/src/transport/transport_api_cmd_stop_peer.c
index 4ca730add..04c822155 100644
--- a/src/transport/transport_api_cmd_stop_peer.c
+++ b/src/transport/transport_api_cmd_stop_peer.c
@@ -146,7 +146,7 @@ GNUNET_TRANSPORT_cmd_stop_peer (const char *label,
{
struct GNUNET_TESTING_Command cmd = {
.cls = sps,
- .label = label,
+ .label = GNUNET_strdup (label),
.run = &stop_peer_run,
.cleanup = &stop_peer_cleanup,
.traits = &stop_peer_traits
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: TESTING: Properly handle label allocations,
gnunet <=