aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-05-19 22:23:02 +0200
committerChristian Grothoff <christian@grothoff.org>2024-05-19 22:23:02 +0200
commite21e50a0ca8fa23d6d0c22e539dd398cfe96b1f8 (patch)
treeb00aa79ead52dde8913d2b0074c2b71838257440
parent71c6dc7e732c2d6408c2984f5242fcadac55c343 (diff)
downloadgnunet-e21e50a0ca8fa23d6d0c22e539dd398cfe96b1f8.tar.gz
gnunet-e21e50a0ca8fa23d6d0c22e539dd398cfe96b1f8.zip
simplify wrapper script
-rw-r--r--scripts/Makefile.am12
-rw-r--r--scripts/netjail/netjail_test_master.sh18
-rw-r--r--src/lib/testing/test_testing_api.c6
-rw-r--r--src/lib/testing/testing_api_cmd_netjail_start.c5
-rwxr-xr-xsrc/service/transport/test_transport_simple_send.sh13
5 files changed, 32 insertions, 22 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 01e6e9618..4eb089997 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -5,6 +5,7 @@ dist_pkgdata_DATA = \
5 netjail/netjail_core.sh \ 5 netjail/netjail_core.sh \
6 netjail/netjail_start.sh \ 6 netjail/netjail_start.sh \
7 netjail/netjail_stop.sh \ 7 netjail/netjail_stop.sh \
8 netjail/netjail_test_master.sh \
8 netjail/topo.sh \ 9 netjail/topo.sh \
9 testing-ng/block.sh 10 testing-ng/block.sh
10 11
@@ -19,10 +20,11 @@ EXTRA_DIST = \
19 sphinx_update.sh 20 sphinx_update.sh
20 21
21install-data-hook: 22install-data-hook:
22 chmod o+x '$(DESTDIR)$(pkgdatadir)/netjail_core.sh' 23 chmod +x '$(DESTDIR)$(pkgdatadir)/netjail_core.sh'
23 chmod o+x '$(DESTDIR)$(pkgdatadir)/netjail_start.sh' 24 chmod +x '$(DESTDIR)$(pkgdatadir)/netjail_start.sh'
24 chmod o+x '$(DESTDIR)$(pkgdatadir)/netjail_stop.sh' 25 chmod +x '$(DESTDIR)$(pkgdatadir)/netjail_stop.sh'
25 chmod o+x '$(DESTDIR)$(pkgdatadir)/topo.sh' 26 chmod +x '$(DESTDIR)$(pkgdatadir)/netjail_test_master.sh'
26 chmod o+x '$(DESTDIR)$(pkgdatadir)/block.sh' 27 chmod +x '$(DESTDIR)$(pkgdatadir)/topo.sh'
28 chmod +x '$(DESTDIR)$(pkgdatadir)/block.sh'
27 29
28## EOF 30## EOF
diff --git a/scripts/netjail/netjail_test_master.sh b/scripts/netjail/netjail_test_master.sh
new file mode 100644
index 000000000..4209a235f
--- /dev/null
+++ b/scripts/netjail/netjail_test_master.sh
@@ -0,0 +1,18 @@
1#!/bin/bash
2if ! [ -d "/run/netns" ];
3then
4 echo "You have to create the directory '/run/netns'."
5 exit 77
6fi
7if [ -f /proc/sys/kernel/unprivileged_userns_clone ];
8then
9 if [ "$(cat /proc/sys/kernel/unprivileged_userns_clone)" != 1 ];
10 then
11 echo -e "Error during test setup: The kernel parameter 'kernel.unprivileged_userns_clone' has to be set to 1! One has to execute\n\n sysctl kernel.unprivileged_userns_clone=1\n"
12 exit 77
13 fi
14else
15 echo -e "Error during test setup: The kernel lacks the parameter 'kernel.unprivileged_userns_clone'\n"
16 exit 77
17fi
18exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; $@"
diff --git a/src/lib/testing/test_testing_api.c b/src/lib/testing/test_testing_api.c
index 6684dccb9..2a5b614fd 100644
--- a/src/lib/testing/test_testing_api.c
+++ b/src/lib/testing/test_testing_api.c
@@ -54,11 +54,7 @@ main (int argc,
54 struct GNUNET_TESTING_Command netjail[] = { 54 struct GNUNET_TESTING_Command netjail[] = {
55 GNUNET_TESTING_cmd_load_topology_from_string ( 55 GNUNET_TESTING_cmd_load_topology_from_string (
56 "load-topology", 56 "load-topology",
57 ""), 57 ""), // try "M"
58 GNUNET_TESTING_cmd_netjail_setup (
59 "netjail-setup",
60 GNUNET_TESTING_NETJAIL_START_SCRIPT,
61 "load-topology"),
62 GNUNET_TESTING_cmd_end () 58 GNUNET_TESTING_cmd_end ()
63 }; 59 };
64 struct GNUNET_TESTING_Command commands[] = { 60 struct GNUNET_TESTING_Command commands[] = {
diff --git a/src/lib/testing/testing_api_cmd_netjail_start.c b/src/lib/testing/testing_api_cmd_netjail_start.c
index 6b25f6902..8a84b2769 100644
--- a/src/lib/testing/testing_api_cmd_netjail_start.c
+++ b/src/lib/testing/testing_api_cmd_netjail_start.c
@@ -151,14 +151,15 @@ netjail_start_run (void *cls,
151 ns->script); 151 ns->script);
152 helper_check = GNUNET_OS_check_helper_binary ( 152 helper_check = GNUNET_OS_check_helper_binary (
153 script_name, 153 script_name,
154 GNUNET_YES, 154 true,
155 NULL); 155 NULL);
156 if (GNUNET_NO == helper_check) 156 if (GNUNET_NO == helper_check)
157 { 157 {
158 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 158 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
159 "No SUID for %s!\n", 159 "No SUID for %s!\n",
160 script_name); 160 script_name);
161 GNUNET_TESTING_FAIL (is); 161 GNUNET_TESTING_interpreter_skip (is);
162 return;
162 } 163 }
163 if (GNUNET_SYSERR == helper_check) 164 if (GNUNET_SYSERR == helper_check)
164 { 165 {
diff --git a/src/service/transport/test_transport_simple_send.sh b/src/service/transport/test_transport_simple_send.sh
index 0250070be..af7515753 100755
--- a/src/service/transport/test_transport_simple_send.sh
+++ b/src/service/transport/test_transport_simple_send.sh
@@ -1,11 +1,4 @@
1#!/bin/bash 1#!/bin/bash
2if ! [ -d "/run/netns" ]; then 2exec netjail_test_master.sh ./test_transport_start_with_config test_transport_simple_send_topo.conf
3 echo You have to create the directory /run/netns. 3
4fi 4# exec netjail_test_master.sh gnunet-testing-netjail-launcher test_transport_simple_send_topo.conf
5if [ -f /proc/sys/kernel/unprivileged_userns_clone ]; then
6 if [ "$(cat /proc/sys/kernel/unprivileged_userns_clone)" != 1 ]; then
7 echo -e "Error during test setup: The kernel parameter kernel.unprivileged_userns_clone has to be set to 1! One has to execute\n\n sysctl kernel.unprivileged_userns_clone=1\n"
8 exit 78
9 fi
10fi
11exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; ./test_transport_start_with_config test_transport_simple_send_topo.conf"