[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 02/02: Testing: Make compile.
From: |
gnunet |
Subject: |
[gnunet] 02/02: Testing: Make compile. |
Date: |
Sun, 19 May 2024 14:18:18 +0200 |
This is an automated email from the git hooks/post-receive script.
t3sserakt pushed a commit to branch master
in repository gnunet.
commit 05d57a7103e1fe6ca6a7ac887703d16ece1a5ed9
Author: t3sserakt <t3ss@posteo.de>
AuthorDate: Sun May 19 14:13:42 2024 +0200
Testing: Make compile.
---
src/lib/testing/netjail.c | 2 +-
src/lib/testing/netjail.h | 8 ++--
.../testing/testing_api_cmd_get_topo_from_file.c | 45 +++++++++++++++++++++-
src/service/testbed/testing.c | 2 +-
4 files changed, 49 insertions(+), 8 deletions(-)
diff --git a/src/lib/testing/netjail.c b/src/lib/testing/netjail.c
index 4bf6b851f..f3b670311 100644
--- a/src/lib/testing/netjail.c
+++ b/src/lib/testing/netjail.c
@@ -818,7 +818,7 @@ parse_ac (struct GNUNET_TESTING_NetjailNode *p_node, const
char *token)
* @return The GNUNET_TESTING_NetjailTopology
*/
struct GNUNET_TESTING_NetjailTopology *
-GNUNET_TESTING_get_topo_from_string (const char *input)
+GNUNET_TESTING_get_topo_from_string_ (const char *input)
{
char *token;
char *key = NULL;
diff --git a/src/lib/testing/netjail.h b/src/lib/testing/netjail.h
index 5cdb3e303..f8445a89f 100644
--- a/src/lib/testing/netjail.h
+++ b/src/lib/testing/netjail.h
@@ -346,10 +346,10 @@ GNUNET_TESTING_calculate_num (
* Call #op on all simple traits.
*/
#define GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS(op, prefix)
\
- op (prefix, get_topology, const struct GNUNET_TESTING_NetjailTopology)
\
- op (prefix, get_topology_string, const char *)
\
- op (prefix, async_context, struct GNUNET_TESTING_AsyncContext)
\
- op (prefix, helper_handles, const struct GNUNET_HELPER_Handle *)
+ op (prefix, get_topology, const struct GNUNET_TESTING_NetjailTopology)
\
+ op (prefix, get_topology_string, char) \
+ op (prefix, async_context, struct GNUNET_TESTING_AsyncContext)
\
+ op (prefix, helper_handles, const struct GNUNET_HELPER_Handle *)
GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT,
GNUNET_TESTING)
diff --git a/src/lib/testing/testing_api_cmd_get_topo_from_file.c
b/src/lib/testing/testing_api_cmd_get_topo_from_file.c
index 3fcc96862..e38b81f24 100644
--- a/src/lib/testing/testing_api_cmd_get_topo_from_file.c
+++ b/src/lib/testing/testing_api_cmd_get_topo_from_file.c
@@ -84,6 +84,47 @@ traits (void *cls,
index);
}
+static char *
+get_topo_string_from_file (char *topology_data_file)
+{
+ uint64_t fs;
+ char *data;
+
+ if (GNUNET_YES !=
+ GNUNET_DISK_file_test (topology_data_file))
+ {
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ "Topology file %s not found\n",
+ topology_data_file);
+ GNUNET_assert (0);
+ }
+ if (GNUNET_OK !=
+ GNUNET_DISK_file_size (topology_data_file,
+ &fs,
+ GNUNET_YES,
+ GNUNET_YES))
+ {
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ "Could not determine size of topology file %s\n",
+ topology_data_file);
+ GNUNET_assert (0);
+ }
+ data = GNUNET_malloc_large (fs + 1);
+ GNUNET_assert (NULL != data);
+ if (fs !=
+ GNUNET_DISK_fn_read (topology_data_file,
+ data,
+ fs))
+ {
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ "Topology file %s cannot be read\n",
+ topology_data_file);
+ GNUNET_free (data);
+ return NULL;
+ }
+ return data;
+}
+
/**
* The run method starts the script which setup the network namespaces.
*
@@ -96,8 +137,8 @@ run (void *cls,
{
struct TopologyState *ts = cls;
- ts->topology_string = GNUNET_TESTING_get_topo_string_from_file
(ts->file_name);
- ts->topology = GNUNET_TESTING_get_topo_from_string
(ts->file_nametopology_string);
+ ts->topology_string = get_topo_string_from_file (ts->file_name);
+ ts->topology = GNUNET_TESTING_get_topo_from_string (ts->topology_string);
}
struct GNUNET_TESTING_Command
diff --git a/src/service/testbed/testing.c b/src/service/testbed/testing.c
index 46869011a..5e0c0724e 100644
--- a/src/service/testbed/testing.c
+++ b/src/service/testbed/testing.c
@@ -2828,7 +2828,7 @@ GNUNET_TESTING_get_topo_from_file (const char *filename)
char *data;
struct GNUNET_TESTING_NetjailTopology *topo;
- data = GNUNET_TESTING_get_topo_string+from_file (filename);
+ data = GNUNET_TESTING_get_topo_string_from_file (filename);
topo = GNUNET_TESTING_get_topo_from_string (data);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.