[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 02/02: testing: try to replicate failing arm probnat test towar
From: |
gnunet |
Subject: |
[gnunet] 02/02: testing: try to replicate failing arm probnat test towards transport hello world test |
Date: |
Sat, 21 Dec 2024 17:12:44 +0100 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
commit b3daaaca459f70b6a1ddce025dfa0b90fc565eb4
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Sat Dec 21 17:12:38 2024 +0100
testing: try to replicate failing arm probnat test towards transport hello
world test
---
src/service/transport/Makefile.am | 19 ++--
.../transport/test_transport_plugin_simple_send.c | 81 ++++++++++++++
.../transport/test_transport_simple_send.sh | 4 +-
.../transport/test_transport_simple_send_host.conf | 41 +++++++
.../test_transport_simple_send_peer1.conf | 55 ++++++++++
.../test_transport_simple_send_peer2.conf | 54 ++++++++++
.../transport/test_transport_simple_send_topo.conf | 18 ++--
.../transport/test_transport_start_with_config.c | 120 ---------------------
8 files changed, 256 insertions(+), 136 deletions(-)
diff --git a/src/service/transport/Makefile.am
b/src/service/transport/Makefile.am
index 399583b98..7a7c00029 100644
--- a/src/service/transport/Makefile.am
+++ b/src/service/transport/Makefile.am
@@ -27,6 +27,17 @@ lib_LTLIBRARIES = \
libgnunettransportmonitor.la \
$(TESTING_LIBS)
+libgnunet_test_transport_plugin_simple_send_la_SOURCES = \
+ test_transport_plugin_simple_send.c
+libgnunet_test_transport_plugin_simple_send_la_LIBADD = \
+ $(top_builddir)/src/service/arm/libgnunettestingarm.la \
+ $(top_builddir)/src/lib/testing/libgnunettesting.la \
+ $(top_builddir)/src/service/testbed/libgnunettestbed.la \
+ $(top_builddir)/src/service/testbed/libgnunettestingtestbed.la \
+ $(top_builddir)/src/service/arm/libgnunetarm.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
+ $(LTLIBINTL)
+
libgnunettestingtransport_la_SOURCES = \
testing_transport_traits.c transport-testing-cmds.h \
transport-testing-communicator.c transport-testing-communicator.h
@@ -210,13 +221,7 @@ gnunet_service_transport_LDADD = \
$(GN_LIBINTL)
plugin_LTLIBRARIES = \
- #libgnunet_test_transport_plugin_cmd_nat_mapping.la \
- libgnunet_test_transport_plugin_cmd_simple_send_performance.la \
- libgnunet_test_transport_plugin_cmd_nat_upnp.la \
- libgnunet_test_transport_plugin_cmd_simple_send.la \
- libgnunet_test_transport_plugin_cmd_simple_send_broadcast.la \
- libgnunet_test_transport_plugin_cmd_simple_send_dv.la \
- libgnunet_test_transport_plugin_cmd_udp_backchannel.la
+ libgnunet_test_transport_plugin_simple_send.la
#libgnunet_test_transport_plugin_cmd_nat_mapping_la_SOURCES = \
# test_transport_plugin_cmd_nat_mapping.c
diff --git a/src/service/transport/test_transport_plugin_simple_send.c
b/src/service/transport/test_transport_plugin_simple_send.c
new file mode 100644
index 000000000..2aa032480
--- /dev/null
+++ b/src/service/transport/test_transport_plugin_simple_send.c
@@ -0,0 +1,81 @@
+/*
+ This file is part of GNUnet
+ Copyright (C) 2021 GNUnet e.V.
+
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ SPDX-License-Identifier: AGPL3.0-or-later
+ */
+
+/**
+ * @file service/transport/test_plugin_transport_simple_send.c
+ * @brief a plugin to test simple sending of message.
+ * @author schanzen
+ */
+#include "platform.h"
+#include "gnunet_testing_lib.h"
+#include "gnunet_testing_arm_lib.h"
+#include "gnunet_testing_testbed_lib.h"
+
+#define MY_CONF_PREFIX "test_transport_simple_send"
+
+static const char*
+get_conf_name (const char *my_node_id)
+{
+ const char *conf_name;
+ const char *dash;
+
+ dash = strchr (my_node_id, '-');
+ GNUNET_assert (NULL != dash);
+ dash++;
+
+ if (0 == strcmp ("000000", dash))
+ conf_name = MY_CONF_PREFIX"_host.conf";
+ else if (0 == strcmp ("000003", dash))
+ conf_name = MY_CONF_PREFIX"_peer1.conf";
+ else if (0 == strcmp ("000006", dash))
+ conf_name = MY_CONF_PREFIX"_peer1.conf";
+ else
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Getting conf for id %s failed \n",
+ my_node_id);
+ GNUNET_assert (0);
+ }
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Using conf %s",
+ conf_name);
+ return conf_name;
+}
+
+GNUNET_TESTING_MAKE_PLUGIN (
+ libgnunet_test_transport,
+ simple_send,
+ GNUNET_TESTBED_cmd_system_create ("system",
+ my_node_id),
+ GNUNET_TESTING_ARM_cmd_start_peer ("start",
+ "system",
+ get_conf_name (my_node_id)),
+ GNUNET_TESTING_cmd_exec_va ("sleep",
+ GNUNET_OS_PROCESS_EXITED,
+ 0,
+ "sleep",
+ "3000",
+ NULL),
+ GNUNET_TESTING_cmd_stop_peer ("stop",
+ "start")
+ )
+
+/* end of test_plugin_transport_simple_send.c */
diff --git a/src/service/transport/test_transport_simple_send.sh
b/src/service/transport/test_transport_simple_send.sh
index af7515753..5cd7e2192 100755
--- a/src/service/transport/test_transport_simple_send.sh
+++ b/src/service/transport/test_transport_simple_send.sh
@@ -1,4 +1,2 @@
#!/bin/bash
-exec netjail_test_master.sh ./test_transport_start_with_config
test_transport_simple_send_topo.conf
-
-# exec netjail_test_master.sh gnunet-testing-netjail-launcher
test_transport_simple_send_topo.conf
+exec ../../../scripts/netjail/netjail_test_master.sh
gnunet-testing-netjail-launcher test_transport_simple_send_topo.conf
diff --git a/src/service/transport/test_transport_simple_send_host.conf
b/src/service/transport/test_transport_simple_send_host.conf
new file mode 100644
index 000000000..a4c1995d7
--- /dev/null
+++ b/src/service/transport/test_transport_simple_send_host.conf
@@ -0,0 +1,41 @@
+@INLINE@ ../transport/template_tng_cfg_peer1.conf
+
+[PEER]
+#PRIVATE_KEY = $GNUNET_RUNTIME_DIR/private_host.key
+
+[transport]
+BINARY = gnunet-service-transport
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes
--log-file=$GNUNET_TEST_HOME/vg_peer1-%p
+
+[communicator-tcp]
+BINARY = gnunet-communicator-tcp
+BINDTO = 60002
+DISABLE_V6 = YES
+IMMEDIATE_START = YES
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes
--log-file=$GNUNET_TEST_HOME/vg_ctpeer1-%p
+#PREFIX = xterm -geometry 100x85 -T peer1 -e gdb --args
+
+[communicator-udp]
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes
--log-file=$GNUNET_TEST_HOME/vg_cupeer1-%p
+BINARY = gnunet-communicator-udp
+BINDTO = 60002
+DISABLE_V6 = YES
+IMMEDIATE_START = YES
+
+[peerstore]
+IMMEDIATE_START = YES
+USE_INCLUDED_HELLOS = YES
+
+[topology]
+IMMEDIATE_START = YES
+
+[dht]
+IMMEDIATE_START = YES
+
+[fs]
+IMMEDIATE_START = YES
+
+[hostlist]
+IMMEDIATE_START = YES
+OPTIONS = -p
+EXTERNAL_DNS_NAME = 192.168.1.1
\ No newline at end of file
diff --git a/src/service/transport/test_transport_simple_send_peer1.conf
b/src/service/transport/test_transport_simple_send_peer1.conf
new file mode 100644
index 000000000..352a647a3
--- /dev/null
+++ b/src/service/transport/test_transport_simple_send_peer1.conf
@@ -0,0 +1,55 @@
+@INLINE@ ../transport/template_tng_cfg_peer1.conf
+
+[PEER]
+#PRIVATE_KEY = $GNUNET_RUNTIME_DIR/private_peer1.key
+
+[transport]
+BINARY = gnunet-service-transport
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes
--log-file=vg_peer1-%p
+USE_BURST_NAT = YES
+
+[communicator-tcp]
+BINARY = gnunet-communicator-tcp
+BINDTO = 60002
+DISABLE_V6 = YES
+IMMEDIATE_START = YES
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes
--log-file=$GNUNET_TEST_HOME/vg_ctpeer1-%p
+#PREFIX = xterm -geometry 100x85 -T peer1 -e gdb --args
+
+[communicator-udp]
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes
--log-file=vg_cupeer1-%p
+BINARY = gnunet-communicator-udp
+BINDTO = 60002
+DISABLE_V6 = YES
+IMMEDIATE_START = YES
+
+[peerstore]
+IMMEDIATE_START = YES
+USE_INCLUDED_HELLOS = YES
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes
--log-file=$GNUNET_TEST_HOME/vg_peer1-%p
+
+[topology]
+IMMEDIATE_START = YES
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes
--log-file=$GNUNET_TEST_HOME/vg_peer1-transport-%p
+
+[dht]
+IMMEDIATE_START = YES
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes
--log-file=$GNUNET_TEST_HOME/vg_peer1-%p
+
+[fs]
+IMMEDIATE_START = YES
+
+[hostlist]
+IMMEDIATE_START = YES
+SERVERS = http://192.168.1.1:8080/
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes
--log-file=$GNUNET_TEST_HOME/vg_peer1-%p
+
+[core]
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes
--log-file=$GNUNET_TEST_HOME/vg_peer1-transport-%p
+
+[cadet]
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes
--log-file=$GNUNET_TEST_HOME/vg_peer1-transport-%p
+
+[nat]
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes
--log-file=vg_napeer1-%p
+
diff --git a/src/service/transport/test_transport_simple_send_peer2.conf
b/src/service/transport/test_transport_simple_send_peer2.conf
new file mode 100644
index 000000000..43c5ddd8b
--- /dev/null
+++ b/src/service/transport/test_transport_simple_send_peer2.conf
@@ -0,0 +1,54 @@
+@INLINE@ ../transport/template_tng_cfg_peer1.conf
+
+[PEER]
+#PRIVATE_KEY = $GNUNET_RUNTIME_DIR/private_peer2.key
+
+[transport]
+BINARY = gnunet-service-transport
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes
--log-file=vg_peer2-%p
+USE_BURST_NAT = YES
+
+[communicator-tcp]
+BINARY = gnunet-communicator-tcp
+BINDTO = 60002
+DISABLE_V6 = YES
+IMMEDIATE_START = YES
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes
--log-file=$GNUNET_TEST_HOME/vg_ctpeer1-%p
+#PREFIX = xterm -geometry 100x85 -T peer1 -e gdb --args
+
+[communicator-udp]
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes
--log-file=vg_cupeer2-%p
+BINARY = gnunet-communicator-udp
+BINDTO = 60002
+DISABLE_V6 = YES
+IMMEDIATE_START = YES
+
+[peerstore]
+IMMEDIATE_START = YES
+USE_INCLUDED_HELLOS = YES
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes
--log-file=$GNUNET_TEST_HOME/vg_peer1-%p
+
+[topology]
+IMMEDIATE_START = YES
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes
--log-file=$GNUNET_TEST_HOME/vg_peer1-transport-%p
+
+[dht]
+IMMEDIATE_START = YES
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes
--log-file=$GNUNET_TEST_HOME/vg_peer1-%p
+
+[fs]
+IMMEDIATE_START = YES
+
+[hostlist]
+IMMEDIATE_START = YES
+SERVERS = http://192.168.1.1:8080/
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes
--log-file=$GNUNET_TEST_HOME/vg_peer1-%p
+
+[core]
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes
--log-file=$GNUNET_TEST_HOME/vg_peer1-transport-%p
+
+[cadet]
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes
--log-file=$GNUNET_TEST_HOME/vg_peer1-transport-%p
+
+[nat]
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes
--log-file=vg_napeer2-%p
\ No newline at end of file
diff --git a/src/service/transport/test_transport_simple_send_topo.conf
b/src/service/transport/test_transport_simple_send_topo.conf
index 2c16201f5..64a0efe81 100644
--- a/src/service/transport/test_transport_simple_send_topo.conf
+++ b/src/service/transport/test_transport_simple_send_topo.conf
@@ -1,6 +1,12 @@
-M:2
-N:1
-X:0
-T:libgnunet_test_transport_plugin_cmd_simple_send
-P:1:1|{connect:{P:1:2:tcp}}
-P:1:2|{connect:{P:1:1:tcp}}
\ No newline at end of file
+[DEFAULTS]
+SUBNETS = 1
+CARRIER_SETUP_PROGRAMMS = iptables -A INPUT -p icmp -j DROP;tc qdisc add dev
$UPLINK root netm delay 100ms 10ms;
+SUBNET_SETUP_PROGRAMMS = iptables -A INPUT -p icmp -j DROP;tc qdisc add dev
$UPLINK root netm delay 100ms 10ms;
+PEER_SETUP_PROGRAMMS = iptables -A INPUT -p icmp -j DROP;tc qdisc add dev
$UPLINK root netm delay 100ms 10ms;
+TESTBED_PLUGIN = libgnunet_test_transport_plugin_simple_send
+CARRIER_PEERS = 0
+SUBNET_PEERS = 1
+
+[BACKBONE]
+CARRIERS = 2
+BACKBONE_PEERS = 1
diff --git a/src/service/transport/test_transport_start_with_config.c
b/src/service/transport/test_transport_start_with_config.c
deleted file mode 100644
index 2c00dde8a..000000000
--- a/src/service/transport/test_transport_start_with_config.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- This file is part of GNUnet
- Copyright (C) 2021 GNUnet e.V.
-
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/test_transport_start_with_config.c
- * @brief Generic program to start testcases in an configurable topology.
- * @author t3sserakt
- */
-#include "platform.h"
-#include "gnunet_testing_lib.h"
-#include "gnunet_util_lib.h"
-
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600)
-
-
-int
-main (int argc,
- char *const *argv)
-{
- char *topology_data;
- char *topology_data_script;
- struct GNUNET_TESTING_NetjailTopology *topology;
- unsigned int read_file = GNUNET_YES;
- int ret;
- char *rest = NULL;
- char *token;
- size_t single_line_len;
- size_t data_len;
-
- GNUNET_log_setup ("test-netjail",
- "INFO",
- NULL);
-
- if (0 == strcmp ("-s", argv[1]))
- {
- data_len = strlen (argv[2]);
- topology_data = GNUNET_malloc (data_len);
- topology_data_script = GNUNET_malloc (data_len);
- token = strtok_r (argv[2], "\n", &rest);
- while (NULL != token)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "token1 %s\n",
- token);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "token2 %s\n",
- token);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "topology_data %s\n",
- topology_data);
- strcat (topology_data_script, token);
- strcat (topology_data_script, " ");
- strcat (topology_data, token);
- strcat (topology_data, "\n");
- token = strtok_r (NULL, "\n", &rest);
- }
- single_line_len = strlen (topology_data);
- topology_data_script [single_line_len - 1] = '\0';
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "read from string\n");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "topology_data %s\n",
- topology_data);
- read_file = GNUNET_NO;
- topology = GNUNET_TESTING_get_topo_from_string (topology_data);
- }
- else
- {
- topology_data = argv[1];
- topology_data_script = argv[1];
- topology = GNUNET_TESTING_get_topo_from_file (topology_data);
- }
-
- struct GNUNET_TESTING_Command commands[] = {
- GNUNET_TESTING_cmd_netjail_start ("netjail-start",
- topology_data_script,
- &read_file),
- GNUNET_TESTING_cmd_netjail_start_cmds_helper ("netjail-start-testbed",
- topology,
- &read_file,
- topology_data_script,
- TIMEOUT),
- GNUNET_TESTING_cmd_stop_cmds_helper ("stop-testbed",
- "netjail-start-testbed",
- topology),
- GNUNET_TESTING_cmd_netjail_stop ("netjail-stop",
- topology_data_script,
- &read_file),
- GNUNET_TESTING_cmd_end ()
- };
-
- ret = GNUNET_TESTING_main (commands,
- TIMEOUT);
-
- if (0 == strcmp ("-s", argv[1]))
- {
- GNUNET_free (topology_data_script);
- GNUNET_free (topology_data);
- }
- GNUNET_TESTING_free_topology (topology);
-
- return ret;
-}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.