diff options
author | t3sserakt <t3ss@posteo.de> | 2021-08-16 09:20:39 +0200 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2021-08-16 09:20:39 +0200 |
commit | 58b837048d27e04db8f5c02d6559fe7880c6cdb3 (patch) | |
tree | 9cc721abf87ca923f3fdb17f086774aaad793f98 | |
parent | 564a1945e84430e18c0c11e04492ed0fe5126ea2 (diff) | |
download | gnunet-58b837048d27e04db8f5c02d6559fe7880c6cdb3.tar.gz gnunet-58b837048d27e04db8f5c02d6559fe7880c6cdb3.zip |
- small changes to simple send
-rw-r--r-- | src/include/gnunet_testbed_ng_service.h | 3 | ||||
-rw-r--r-- | src/testbed/testbed_api_cmd_netjail_start.c | 18 | ||||
-rw-r--r-- | src/testbed/testbed_api_cmd_netjail_start_testbed.c | 31 | ||||
-rw-r--r-- | src/testbed/testbed_api_cmd_netjail_stop.c | 18 | ||||
-rw-r--r-- | src/transport/Makefile.am | 28 | ||||
-rw-r--r-- | src/transport/plugin_cmd_simple_send.c | 15 | ||||
-rw-r--r-- | src/transport/test_transport_api_cmd_simple_send.c | 11 |
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 | |||
233 | GNUNET_TESTBED_cmd_netjail_start_testbed (const char *label, | 233 | GNUNET_TESTBED_cmd_netjail_start_testbed (const char *label, |
234 | char *local_m, | 234 | char *local_m, |
235 | char *global_n, | 235 | char *global_n, |
236 | char *plugin_name); | 236 | char *plugin_name, |
237 | unsigned int *rv); | ||
237 | 238 | ||
238 | 239 | ||
239 | /** | 240 | /** |
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, | |||
139 | ns->local_m, | 139 | ns->local_m, |
140 | ns->global_n, | 140 | ns->global_n, |
141 | NULL}; | 141 | NULL}; |
142 | unsigned int helper_check = GNUNET_OS_check_helper_binary (NETJAIL_START_SCRIPT, | ||
143 | GNUNET_YES, | ||
144 | NULL); | ||
145 | |||
146 | if (GNUNET_NO == helper_check) | ||
147 | { | ||
148 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
149 | "No SUID for %s!\n", | ||
150 | NETJAIL_START_SCRIPT); | ||
151 | GNUNET_TESTING_interpreter_fail (); | ||
152 | } | ||
153 | else if (GNUNET_NO == helper_check) | ||
154 | { | ||
155 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
156 | "%s not found!\n", | ||
157 | NETJAIL_START_SCRIPT); | ||
158 | GNUNET_TESTING_interpreter_fail (); | ||
159 | } | ||
142 | 160 | ||
143 | ns->start_proc = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR, | 161 | ns->start_proc = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR, |
144 | NULL, | 162 | 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 | |||
54 | struct NetJailState | 54 | struct NetJailState |
55 | { | 55 | { |
56 | 56 | ||
57 | unsigned int *rv; | ||
58 | |||
57 | struct HelperMessage *hp_messages_head; | 59 | struct HelperMessage *hp_messages_head; |
58 | 60 | ||
59 | struct HelperMessage *hp_messages_tail; | 61 | struct HelperMessage *hp_messages_tail; |
@@ -285,8 +287,9 @@ helper_mst (void *cls, const struct GNUNET_MessageHeader *message) | |||
285 | static void | 287 | static void |
286 | exp_cb (void *cls) | 288 | exp_cb (void *cls) |
287 | { | 289 | { |
290 | struct NetJailState *ns = cls; | ||
288 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called exp_cb.\n"); | 291 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called exp_cb.\n"); |
289 | GNUNET_TESTING_interpreter_fail (); | 292 | *ns->rv = 1; |
290 | } | 293 | } |
291 | 294 | ||
292 | 295 | ||
@@ -334,6 +337,9 @@ start_testbed (struct NetJailState *ns, struct | |||
334 | NULL}; | 337 | NULL}; |
335 | unsigned int m = atoi (m_char); | 338 | unsigned int m = atoi (m_char); |
336 | unsigned int n = atoi (n_char); | 339 | unsigned int n = atoi (n_char); |
340 | unsigned int helper_check = GNUNET_OS_check_helper_binary (NETJAIL_EXEC_SCRIPT, | ||
341 | GNUNET_YES, | ||
342 | NULL); | ||
337 | 343 | ||
338 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 344 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
339 | "m: %d n: %d\n", | 345 | "m: %d n: %d\n", |
@@ -364,6 +370,23 @@ start_testbed (struct NetJailState *ns, struct | |||
364 | "test_testbed_api.conf"); | 370 | "test_testbed_api.conf"); |
365 | }*/ | 371 | }*/ |
366 | 372 | ||
373 | |||
374 | |||
375 | if (GNUNET_NO == helper_check) | ||
376 | { | ||
377 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
378 | "No SUID for %s!\n", | ||
379 | NETJAIL_EXEC_SCRIPT); | ||
380 | *ns->rv = 1; | ||
381 | } | ||
382 | else if (GNUNET_NO == helper_check) | ||
383 | { | ||
384 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
385 | "%s not found!\n", | ||
386 | NETJAIL_EXEC_SCRIPT); | ||
387 | *ns->rv = 1; | ||
388 | } | ||
389 | |||
367 | GNUNET_array_append (ns->helper, ns->n_helper, GNUNET_HELPER_start ( | 390 | GNUNET_array_append (ns->helper, ns->n_helper, GNUNET_HELPER_start ( |
368 | GNUNET_YES, | 391 | GNUNET_YES, |
369 | NETJAIL_EXEC_SCRIPT, | 392 | NETJAIL_EXEC_SCRIPT, |
@@ -405,7 +428,7 @@ start_testbed (struct NetJailState *ns, struct | |||
405 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 428 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
406 | "Send handle is NULL!\n"); | 429 | "Send handle is NULL!\n"); |
407 | GNUNET_free (msg); | 430 | GNUNET_free (msg); |
408 | GNUNET_TESTING_interpreter_fail (); | 431 | *ns->rv = 1; |
409 | } | 432 | } |
410 | } | 433 | } |
411 | 434 | ||
@@ -524,7 +547,8 @@ struct GNUNET_TESTING_Command | |||
524 | GNUNET_TESTBED_cmd_netjail_start_testbed (const char *label, | 547 | GNUNET_TESTBED_cmd_netjail_start_testbed (const char *label, |
525 | char *local_m, | 548 | char *local_m, |
526 | char *global_n, | 549 | char *global_n, |
527 | char *plugin_name) | 550 | char *plugin_name, |
551 | unsigned int *rv) | ||
528 | { | 552 | { |
529 | struct NetJailState *ns; | 553 | struct NetJailState *ns; |
530 | 554 | ||
@@ -532,6 +556,7 @@ GNUNET_TESTBED_cmd_netjail_start_testbed (const char *label, | |||
532 | ns->local_m = local_m; | 556 | ns->local_m = local_m; |
533 | ns->global_n = global_n; | 557 | ns->global_n = global_n; |
534 | ns->plugin_name = plugin_name; | 558 | ns->plugin_name = plugin_name; |
559 | ns->rv = rv; | ||
535 | 560 | ||
536 | struct GNUNET_TESTING_Command cmd = { | 561 | struct GNUNET_TESTING_Command cmd = { |
537 | .cls = ns, | 562 | .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, | |||
135 | ns->local_m, | 135 | ns->local_m, |
136 | ns->global_n, | 136 | ns->global_n, |
137 | NULL}; | 137 | NULL}; |
138 | unsigned int helper_check = GNUNET_OS_check_helper_binary (NETJAIL_STOP_SCRIPT, | ||
139 | GNUNET_YES, | ||
140 | NULL); | ||
141 | |||
142 | if (GNUNET_NO == helper_check) | ||
143 | { | ||
144 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
145 | "No SUID for %s!\n", | ||
146 | NETJAIL_STOP_SCRIPT); | ||
147 | GNUNET_TESTING_interpreter_fail (); | ||
148 | } | ||
149 | else if (GNUNET_NO == helper_check) | ||
150 | { | ||
151 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
152 | "%s not found!\n", | ||
153 | NETJAIL_STOP_SCRIPT); | ||
154 | GNUNET_TESTING_interpreter_fail (); | ||
155 | } | ||
138 | 156 | ||
139 | ns->stop_proc = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR, | 157 | ns->stop_proc = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR, |
140 | NULL, | 158 | 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 = \ | |||
398 | $(HTTP_SERVER_PLUGIN_LA) \ | 398 | $(HTTP_SERVER_PLUGIN_LA) \ |
399 | $(HTTPS_SERVER_PLUGIN_LA) \ | 399 | $(HTTPS_SERVER_PLUGIN_LA) \ |
400 | $(WLAN_PLUGIN_LA) \ | 400 | $(WLAN_PLUGIN_LA) \ |
401 | $(BT_PLUGIN_LA) | 401 | $(BT_PLUGIN_LA) \ |
402 | # libgnunet_plugin_cmd_simple_send.la | 402 | libgnunet_plugin_cmd_simple_send.la |
403 | 403 | ||
404 | #libgnunet_plugin_cmd_simple_send_la_SOURCES = \ | 404 | libgnunet_plugin_cmd_simple_send_la_SOURCES = \ |
405 | # plugin_cmd_simple_send.c | 405 | plugin_cmd_simple_send.c |
406 | #libgnunet_plugin_cmd_simple_send_la_LIBADD = \ | 406 | libgnunet_plugin_cmd_simple_send_la_LIBADD = \ |
407 | # $(top_builddir)/src/util/libgnunetutil.la \ | 407 | $(top_builddir)/src/util/libgnunetutil.la \ |
408 | # $(top_builddir)/src/testing/libgnunettesting.la \ | 408 | $(top_builddir)/src/testing/libgnunettesting.la \ |
409 | # $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 409 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
410 | # $(top_builddir)/src/testbed/libgnunettestbed.la \ | 410 | $(top_builddir)/src/testbed/libgnunettestbed.la \ |
411 | # libgnunettransporttesting2.la \ | 411 | libgnunettransporttesting2.la \ |
412 | # $(LTLIBINTL) | 412 | $(LTLIBINTL) |
413 | #libgnunet_plugin_cmd_simple_send_la_LDFLAGS = \ | 413 | libgnunet_plugin_cmd_simple_send_la_LDFLAGS = \ |
414 | # $(GN_PLUGIN_LDFLAGS) | 414 | $(GN_PLUGIN_LDFLAGS) |
415 | 415 | ||
416 | if HAVE_EXPERIMENTAL | 416 | if HAVE_EXPERIMENTAL |
417 | plugin_LTLIBRARIES += libgnunet_plugin_transport_udp.la | 417 | 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, | |||
98 | n); | 98 | n); |
99 | 99 | ||
100 | LOG (GNUNET_ERROR_TYPE_ERROR, | 100 | LOG (GNUNET_ERROR_TYPE_ERROR, |
101 | "cfgname: %s\n", | 101 | "plugin cfgname: %s\n", |
102 | cfgname); | 102 | cfgname); |
103 | 103 | ||
104 | LOG (GNUNET_ERROR_TYPE_ERROR, | 104 | LOG (GNUNET_ERROR_TYPE_ERROR, |
105 | "node ip: %s\n", | 105 | "node ip: %s\n", |
106 | node_ip); | 106 | node_ip); |
107 | 107 | ||
108 | testdir = GNUNET_malloc (strlen (BASE_DIR) + strlen (m) + strlen (n) | 108 | testdir = GNUNET_malloc (strlen (BASE_DIR) + strlen (m) + strlen (n) |
109 | + 1); | 109 | + 1); |
110 | 110 | ||
@@ -142,11 +142,12 @@ start_testcase (TESTBED_CMD_HELPER_write_cb write_message, char *router_ip, | |||
142 | "start-peer-1", | 142 | "start-peer-1", |
143 | "this is useless"), | 143 | "this is useless"), |
144 | GNUNET_TRANSPORT_cmd_send_simple ("send-simple-1", | 144 | GNUNET_TRANSPORT_cmd_send_simple ("send-simple-1", |
145 | m, | 145 | m, |
146 | n, | 146 | n, |
147 | 0, | 147 | (atoi (n) - 1) * atoi (local_m) + atoi ( |
148 | "start-peer-1", | 148 | m), |
149 | "this is useless"), | 149 | "start-peer-1", |
150 | "this is useless"), | ||
150 | GNUNET_TESTING_cmd_local_test_finished ("local-test-finished-1", | 151 | GNUNET_TESTING_cmd_local_test_finished ("local-test-finished-1", |
151 | write_message) | 152 | write_message) |
152 | }; | 153 | }; |
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 @@ | |||
28 | #include "gnunet_testbed_ng_service.h" | 28 | #include "gnunet_testbed_ng_service.h" |
29 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
30 | 30 | ||
31 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120) | ||
32 | |||
33 | static unsigned int rv = 0; | ||
34 | |||
31 | 35 | ||
32 | /** | 36 | /** |
33 | * Main function to run the test cases. | 37 | * Main function to run the test cases. |
@@ -45,7 +49,8 @@ run (void *cls) | |||
45 | GNUNET_TESTBED_cmd_netjail_start_testbed ("netjail-start-testbed-1", | 49 | GNUNET_TESTBED_cmd_netjail_start_testbed ("netjail-start-testbed-1", |
46 | "2", | 50 | "2", |
47 | "1", | 51 | "1", |
48 | "libgnunet_plugin_cmd_simple_send"), | 52 | "libgnunet_plugin_cmd_simple_send", |
53 | &rv), | ||
49 | GNUNET_TESTBED_cmd_stop_testbed ("stop-testbed", | 54 | GNUNET_TESTBED_cmd_stop_testbed ("stop-testbed", |
50 | "netjail-start-testbed-1", | 55 | "netjail-start-testbed-1", |
51 | "2", | 56 | "2", |
@@ -58,7 +63,7 @@ run (void *cls) | |||
58 | 63 | ||
59 | GNUNET_TESTING_run (NULL, | 64 | GNUNET_TESTING_run (NULL, |
60 | commands, | 65 | commands, |
61 | GNUNET_TIME_UNIT_FOREVER_REL); | 66 | TIMEOUT); |
62 | } | 67 | } |
63 | 68 | ||
64 | 69 | ||
@@ -66,8 +71,6 @@ int | |||
66 | main (int argc, | 71 | main (int argc, |
67 | char *const *argv) | 72 | char *const *argv) |
68 | { | 73 | { |
69 | int rv = 0; | ||
70 | |||
71 | GNUNET_log_setup ("test-netjail", | 74 | GNUNET_log_setup ("test-netjail", |
72 | "DEBUG", | 75 | "DEBUG", |
73 | NULL); | 76 | NULL); |