aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/testing/netjail_core.sh11
-rwxr-xr-xsrc/testing/netjail_exec.sh2
-rw-r--r--src/transport/Makefile.am10
-rw-r--r--src/transport/test_transport_api_cmd_simple_send.c86
4 files changed, 16 insertions, 93 deletions
diff --git a/src/testing/netjail_core.sh b/src/testing/netjail_core.sh
index f49d4b312..cf350d3fa 100755
--- a/src/testing/netjail_core.sh
+++ b/src/testing/netjail_core.sh
@@ -1,7 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2# 2#
3 3
4JAILOR=${SUDO_USER:?must run in sudo} 4
5 5
6# running with `sudo` is required to be 6# running with `sudo` is required to be
7# able running the actual commands as the 7# able running the actual commands as the
@@ -90,6 +90,7 @@ netjail_node_add_default() {
90} 90}
91 91
92netjail_node_exec() { 92netjail_node_exec() {
93 JAILOR=${SUDO_USER:?must run in sudo}
93 NODE=$1 94 NODE=$1
94 FD_IN=$2 95 FD_IN=$2
95 FD_OUT=$3 96 FD_OUT=$3
@@ -99,9 +100,17 @@ netjail_node_exec() {
99} 100}
100 101
101netjail_node_exec_without_fds() { 102netjail_node_exec_without_fds() {
103 JAILOR=${SUDO_USER:?must run in sudo}
102 NODE=$1 104 NODE=$1
103 shift 1 105 shift 1
104 106
105 ip netns exec $NODE sudo -u $JAILOR -- $@ 107 ip netns exec $NODE sudo -u $JAILOR -- $@
106} 108}
107 109
110netjail_node_exec_without_fds_and_sudo() {
111 NODE=$1
112 shift 1
113
114 ip netns exec $NODE $@
115}
116
diff --git a/src/testing/netjail_exec.sh b/src/testing/netjail_exec.sh
index c20a8c117..17a7caaac 100755
--- a/src/testing/netjail_exec.sh
+++ b/src/testing/netjail_exec.sh
@@ -13,4 +13,4 @@ NODE=$(netjail_print_name "N" $N $M)
13 13
14 14
15 15
16netjail_node_exec_without_fds $NODE $3 $4 $5 $1 $2 16netjail_node_exec_without_fds_and_sudo $NODE $3 $4 $5 $1 $2
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index 61b3bab7c..4ea3b58c4 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -556,7 +556,7 @@ libgnunet_plugin_transport_https_server_la_CFLAGS = \
556 556
557if HAVE_TESTING 557if HAVE_TESTING
558check_PROGRAMS = \ 558check_PROGRAMS = \
559 test_transport_api_cmd_simple_send \ 559 test_transport_simple_send \
560 test_transport_address_switch_tcp \ 560 test_transport_address_switch_tcp \
561 test_transport_testing_startstop \ 561 test_transport_testing_startstop \
562 test_transport_testing_restart \ 562 test_transport_testing_restart \
@@ -705,7 +705,7 @@ test_transport_api_slow_ats
705endif 705endif
706if HAVE_EXPERIMENTAL 706if HAVE_EXPERIMENTAL
707TESTS += \ 707TESTS += \
708 test_transport_api_cmd_simple_send \ 708 test_transport_simple_send \
709 test_transport_address_switch_udp \ 709 test_transport_address_switch_udp \
710 test_plugin_udp \ 710 test_plugin_udp \
711 test_transport_api_udp \ 711 test_transport_api_udp \
@@ -726,9 +726,9 @@ endif
726check_SCRIPTS= \ 726check_SCRIPTS= \
727 test_transport_simple_send.sh 727 test_transport_simple_send.sh
728 728
729test_transport_api_cmd_simple_send_SOURCES = \ 729test_transport_simple_send_SOURCES = \
730 test_transport_api_cmd_simple_send.c 730 test_transport_simple_send.c
731test_transport_api_cmd_simple_send_LDADD = \ 731test_transport_simple_send_LDADD = \
732 $(top_builddir)/src/testing/libgnunettesting.la \ 732 $(top_builddir)/src/testing/libgnunettesting.la \
733 $(top_builddir)/src/util/libgnunetutil.la \ 733 $(top_builddir)/src/util/libgnunetutil.la \
734 $(top_builddir)/src/testbed/libgnunettestbed.la \ 734 $(top_builddir)/src/testbed/libgnunettestbed.la \
diff --git a/src/transport/test_transport_api_cmd_simple_send.c b/src/transport/test_transport_api_cmd_simple_send.c
deleted file mode 100644
index 27b9f95de..000000000
--- a/src/transport/test_transport_api_cmd_simple_send.c
+++ /dev/null
@@ -1,86 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file transport/test_transport_api_cmd_simple_send.c
23 * @brief Test case executing a script which sends a test message between two peers.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_testing_ng_lib.h"
28#include "gnunet_util_lib.h"
29
30#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120)
31
32/**
33 * Return value of the test.
34 *
35 */
36static unsigned int rv = 0;
37
38
39/**
40 * Main function to run the test cases.
41 *
42 * @param cls not used.
43 *
44 */
45static void
46run (void *cls)
47{
48 struct GNUNET_TESTING_Command commands[] = {
49 GNUNET_TESTING_cmd_netjail_start ("netjail-start",
50 "2",
51 "1"),
52 GNUNET_TESTING_cmd_netjail_start_testing_system ("netjail-start-testbed ",
53 "2",
54 "1",
55 "libgnunet_test_transport_plugin_cmd_simple_send",
56 &rv),
57 GNUNET_TESTING_cmd_stop_testing_system ("stop-testbed",
58 "netjail-start-testbed ",
59 "2",
60 "1"),
61 GNUNET_TESTING_cmd_netjail_stop ("netjail-stop ",
62 "2",
63 "1"),
64 GNUNET_TESTING_cmd_end ()
65 };
66
67 GNUNET_TESTING_run (NULL,
68 commands,
69 TIMEOUT);
70}
71
72
73int
74main (int argc,
75 char *const *argv)
76{
77 GNUNET_log_setup ("test-netjail",
78 "DEBUG",
79 NULL);
80 GNUNET_SCHEDULER_run (&run,
81 NULL);
82
83 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
84 "Test finished!\n");
85 return rv;
86}