aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2021-08-30 15:04:46 +0200
committert3sserakt <t3ss@posteo.de>2021-08-30 15:04:46 +0200
commitc66295e27c44c3ad4453f0d7ba9ccd905a6decb8 (patch)
tree4df73912ace5e31c9e16ac778edd1d1ee2cfd997 /src/testing
parent744538ba3d388c3befa367c75d9a85126430cf8e (diff)
downloadgnunet-c66295e27c44c3ad4453f0d7ba9ccd905a6decb8.tar.gz
gnunet-c66295e27c44c3ad4453f0d7ba9ccd905a6decb8.zip
- introduced nested namespace in test script to get rid of the permission problem, renamed test file.
Diffstat (limited to 'src/testing')
-rwxr-xr-xsrc/testing/netjail_core.sh11
-rwxr-xr-xsrc/testing/netjail_exec.sh2
2 files changed, 11 insertions, 2 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