summaryrefslogtreecommitdiffstats
path: root/tests/shell/run-tests.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/shell/run-tests.sh')
-rwxr-xr-xtests/shell/run-tests.sh19
1 files changed, 15 insertions, 4 deletions
diff --git a/tests/shell/run-tests.sh b/tests/shell/run-tests.sh
index 26f8f46d..943f8877 100755
--- a/tests/shell/run-tests.sh
+++ b/tests/shell/run-tests.sh
@@ -22,11 +22,22 @@ if [ "$(id -u)" != "0" ] ; then
msg_error "this requires root!"
fi
+if [ "${1}" != "run" ]; then
+ if unshare -f -n true; then
+ unshare -n "${0}" run $@
+ exit $?
+ fi
+ msg_warn "cannot run in own namespace, connectivity might break"
+fi
+shift
+
[ -z "$NFT" ] && NFT=$SRC_NFT
-if [ ! -x "$NFT" ] ; then
- msg_error "no nft binary!"
+${NFT} > /dev/null 2>&1
+ret=$?
+if [ ${ret} -eq 126 ] || [ ${ret} -eq 127 ]; then
+ msg_error "cannot execute nft command: ${NFT}"
else
- msg_info "using nft binary $NFT"
+ msg_info "using nft command: ${NFT}"
fi
if [ ! -d "$TESTDIR" ] ; then
@@ -101,7 +112,7 @@ do
kernel_cleanup
msg_info "[EXECUTING] $testfile"
- test_output=$(NFT=$NFT DIFF=$DIFF ${testfile} 2>&1)
+ test_output=$(NFT="$NFT" DIFF=$DIFF ${testfile} 2>&1)
rc_got=$?
echo -en "\033[1A\033[K" # clean the [EXECUTING] foobar line