summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2021-08-16 09:20:39 +0200
committert3sserakt <t3ss@posteo.de>2021-08-16 09:20:39 +0200
commit58b837048d27e04db8f5c02d6559fe7880c6cdb3 (patch)
tree9cc721abf87ca923f3fdb17f086774aaad793f98 /src
parent564a1945e84430e18c0c11e04492ed0fe5126ea2 (diff)
- small changes to simple send
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_testbed_ng_service.h3
-rw-r--r--src/testbed/testbed_api_cmd_netjail_start.c18
-rw-r--r--src/testbed/testbed_api_cmd_netjail_start_testbed.c31
-rw-r--r--src/testbed/testbed_api_cmd_netjail_stop.c18
-rw-r--r--src/transport/Makefile.am28
-rw-r--r--src/transport/plugin_cmd_simple_send.c15
-rw-r--r--src/transport/test_transport_api_cmd_simple_send.c11
7 files changed, 95 insertions, 29 deletions
diff --git a/src/include/gnunet_testbed_ng_service.h b/src/include/gnunet_testbed_ng_service.h
index 49e9f56bc..2ff5228cf 100644
--- a/src/include/gnunet_testbed_ng_service.h
+++ b/src/include/gnunet_testbed_ng_service.h
@@ -233,7 +233,8 @@ struct GNUNET_TESTING_Command
GNUNET_TESTBED_cmd_netjail_start_testbed (const char *label,
char *local_m,
char *global_n,
- char *plugin_name);
+ char *plugin_name,
+ unsigned int *rv);
/**
diff --git a/src/testbed/testbed_api_cmd_netjail_start.c b/src/testbed/testbed_api_cmd_netjail_start.c
index bc035abe7..8edfb8b62 100644
--- a/src/testbed/testbed_api_cmd_netjail_start.c
+++ b/src/testbed/testbed_api_cmd_netjail_start.c
@@ -139,6 +139,24 @@ netjail_start_run (void *cls,
ns->local_m,
ns->global_n,
NULL};
+ unsigned int helper_check = GNUNET_OS_check_helper_binary (NETJAIL_START_SCRIPT,
+ GNUNET_YES,
+ NULL);
+
+ if (GNUNET_NO == helper_check)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "No SUID for %s!\n",
+ NETJAIL_START_SCRIPT);
+ GNUNET_TESTING_interpreter_fail ();
+ }
+ else if (GNUNET_NO == helper_check)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%s not found!\n",
+ NETJAIL_START_SCRIPT);
+ GNUNET_TESTING_interpreter_fail ();
+ }
ns->start_proc = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR,
NULL,
diff --git a/src/testbed/testbed_api_cmd_netjail_start_testbed.c b/src/testbed/testbed_api_cmd_netjail_start_testbed.c
index 2b81c05d1..db9cf7508 100644
--- a/src/testbed/testbed_api_cmd_netjail_start_testbed.c
+++ b/src/testbed/testbed_api_cmd_netjail_start_testbed.c
@@ -54,6 +54,8 @@ struct HelperMessage
struct NetJailState
{
+ unsigned int *rv;
+
struct HelperMessage *hp_messages_head;
struct HelperMessage *hp_messages_tail;
@@ -285,8 +287,9 @@ helper_mst (void *cls, const struct GNUNET_MessageHeader *message)
static void
exp_cb (void *cls)
{
+ struct NetJailState *ns = cls;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called exp_cb.\n");
- GNUNET_TESTING_interpreter_fail ();
+ *ns->rv = 1;
}
@@ -334,6 +337,9 @@ start_testbed (struct NetJailState *ns, struct
NULL};
unsigned int m = atoi (m_char);
unsigned int n = atoi (n_char);
+ unsigned int helper_check = GNUNET_OS_check_helper_binary (NETJAIL_EXEC_SCRIPT,
+ GNUNET_YES,
+ NULL);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"m: %d n: %d\n",
@@ -364,6 +370,23 @@ start_testbed (struct NetJailState *ns, struct
"test_testbed_api.conf");
}*/
+
+
+ if (GNUNET_NO == helper_check)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "No SUID for %s!\n",
+ NETJAIL_EXEC_SCRIPT);
+ *ns->rv = 1;
+ }
+ else if (GNUNET_NO == helper_check)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%s not found!\n",
+ NETJAIL_EXEC_SCRIPT);
+ *ns->rv = 1;
+ }
+
GNUNET_array_append (ns->helper, ns->n_helper, GNUNET_HELPER_start (
GNUNET_YES,
NETJAIL_EXEC_SCRIPT,
@@ -405,7 +428,7 @@ start_testbed (struct NetJailState *ns, struct
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Send handle is NULL!\n");
GNUNET_free (msg);
- GNUNET_TESTING_interpreter_fail ();
+ *ns->rv = 1;
}
}
@@ -524,7 +547,8 @@ struct GNUNET_TESTING_Command
GNUNET_TESTBED_cmd_netjail_start_testbed (const char *label,
char *local_m,
char *global_n,
- char *plugin_name)
+ char *plugin_name,
+ unsigned int *rv)
{
struct NetJailState *ns;
@@ -532,6 +556,7 @@ GNUNET_TESTBED_cmd_netjail_start_testbed (const char *label,
ns->local_m = local_m;
ns->global_n = global_n;
ns->plugin_name = plugin_name;
+ ns->rv = rv;
struct GNUNET_TESTING_Command cmd = {
.cls = ns,
diff --git a/src/testbed/testbed_api_cmd_netjail_stop.c b/src/testbed/testbed_api_cmd_netjail_stop.c
index c0fc33ff9..947384fed 100644
--- a/src/testbed/testbed_api_cmd_netjail_stop.c
+++ b/src/testbed/testbed_api_cmd_netjail_stop.c
@@ -135,6 +135,24 @@ netjail_stop_run (void *cls,
ns->local_m,
ns->global_n,
NULL};
+ unsigned int helper_check = GNUNET_OS_check_helper_binary (NETJAIL_STOP_SCRIPT,
+ GNUNET_YES,
+ NULL);
+
+ if (GNUNET_NO == helper_check)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "No SUID for %s!\n",
+ NETJAIL_STOP_SCRIPT);
+ GNUNET_TESTING_interpreter_fail ();
+ }
+ else if (GNUNET_NO == helper_check)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%s not found!\n",
+ NETJAIL_STOP_SCRIPT);
+ GNUNET_TESTING_interpreter_fail ();
+ }
ns->stop_proc = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR,
NULL,
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index 55a338729..e19ebd8e9 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -398,20 +398,20 @@ plugin_LTLIBRARIES = \
$(HTTP_SERVER_PLUGIN_LA) \
$(HTTPS_SERVER_PLUGIN_LA) \
$(WLAN_PLUGIN_LA) \
- $(BT_PLUGIN_LA)
-# libgnunet_plugin_cmd_simple_send.la
-
-#libgnunet_plugin_cmd_simple_send_la_SOURCES = \
-# plugin_cmd_simple_send.c
-#libgnunet_plugin_cmd_simple_send_la_LIBADD = \
-# $(top_builddir)/src/util/libgnunetutil.la \
-# $(top_builddir)/src/testing/libgnunettesting.la \
-# $(top_builddir)/src/statistics/libgnunetstatistics.la \
-# $(top_builddir)/src/testbed/libgnunettestbed.la \
-# libgnunettransporttesting2.la \
-# $(LTLIBINTL)
-#libgnunet_plugin_cmd_simple_send_la_LDFLAGS = \
-# $(GN_PLUGIN_LDFLAGS)
+ $(BT_PLUGIN_LA) \
+ libgnunet_plugin_cmd_simple_send.la
+
+libgnunet_plugin_cmd_simple_send_la_SOURCES = \
+ plugin_cmd_simple_send.c
+libgnunet_plugin_cmd_simple_send_la_LIBADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/statistics/libgnunetstatistics.la \
+ $(top_builddir)/src/testbed/libgnunettestbed.la \
+ libgnunettransporttesting2.la \
+ $(LTLIBINTL)
+libgnunet_plugin_cmd_simple_send_la_LDFLAGS = \
+ $(GN_PLUGIN_LDFLAGS)
if HAVE_EXPERIMENTAL
plugin_LTLIBRARIES += libgnunet_plugin_transport_udp.la
diff --git a/src/transport/plugin_cmd_simple_send.c b/src/transport/plugin_cmd_simple_send.c
index e2407c8c0..2a4a8c137 100644
--- a/src/transport/plugin_cmd_simple_send.c
+++ b/src/transport/plugin_cmd_simple_send.c
@@ -98,13 +98,13 @@ start_testcase (TESTBED_CMD_HELPER_write_cb write_message, char *router_ip,
n);
LOG (GNUNET_ERROR_TYPE_ERROR,
- "cfgname: %s\n",
+ "plugin cfgname: %s\n",
cfgname);
LOG (GNUNET_ERROR_TYPE_ERROR,
"node ip: %s\n",
node_ip);
-
+
testdir = GNUNET_malloc (strlen (BASE_DIR) + strlen (m) + strlen (n)
+ 1);
@@ -142,11 +142,12 @@ start_testcase (TESTBED_CMD_HELPER_write_cb write_message, char *router_ip,
"start-peer-1",
"this is useless"),
GNUNET_TRANSPORT_cmd_send_simple ("send-simple-1",
- m,
- n,
- 0,
- "start-peer-1",
- "this is useless"),
+ m,
+ n,
+ (atoi (n) - 1) * atoi (local_m) + atoi (
+ m),
+ "start-peer-1",
+ "this is useless"),
GNUNET_TESTING_cmd_local_test_finished ("local-test-finished-1",
write_message)
};
diff --git a/src/transport/test_transport_api_cmd_simple_send.c b/src/transport/test_transport_api_cmd_simple_send.c
index 9ae8fcc2b..26da53c47 100644
--- a/src/transport/test_transport_api_cmd_simple_send.c
+++ b/src/transport/test_transport_api_cmd_simple_send.c
@@ -28,6 +28,10 @@
#include "gnunet_testbed_ng_service.h"
#include "gnunet_util_lib.h"
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120)
+
+static unsigned int rv = 0;
+
/**
* Main function to run the test cases.
@@ -45,7 +49,8 @@ run (void *cls)
GNUNET_TESTBED_cmd_netjail_start_testbed ("netjail-start-testbed-1",
"2",
"1",
- "libgnunet_plugin_cmd_simple_send"),
+ "libgnunet_plugin_cmd_simple_send",
+ &rv),
GNUNET_TESTBED_cmd_stop_testbed ("stop-testbed",
"netjail-start-testbed-1",
"2",
@@ -58,7 +63,7 @@ run (void *cls)
GNUNET_TESTING_run (NULL,
commands,
- GNUNET_TIME_UNIT_FOREVER_REL);
+ TIMEOUT);
}
@@ -66,8 +71,6 @@ int
main (int argc,
char *const *argv)
{
- int rv = 0;
-
GNUNET_log_setup ("test-netjail",
"DEBUG",
NULL);