Merge branch 'tmp-tests-no-need-root' into 'master'

tests: drain-server-fail: make sure it runs only when root

See merge request openconnect/ocserv!244
This commit is contained in:
Nikos Mavrogiannopoulos
2020-12-06 21:57:56 +00:00
2 changed files with 11 additions and 6 deletions

View File

@@ -40,11 +40,10 @@ if test -z "$NO_NEED_ROOT";then
echo "You need to run this script as root"
exit 77
fi
else
if test "${DISABLE_ASAN_BROKEN_TESTS}" = 1;then
echo "Skipping test requiring ldpreload"
exit 77
fi
# NO_NEED_ROOT implies NEED_SOCKET_WRAPPER
if test "${NEED_SOCKET_WRAPPER}" = 1 || test "${NO_NEED_ROOT}" = 1;then
SOCKDIR="${srcdir}/tmp/sockwrap.$$.tmp"
mkdir -p $SOCKDIR
export SOCKET_WRAPPER_DIR=$SOCKDIR
@@ -53,6 +52,11 @@ else
ADDRESS=127.0.0.$SOCKET_WRAPPER_DEFAULT_IFACE
RAW_OPENCONNECT="${OPENCONNECT}"
OPENCONNECT="eval LD_PRELOAD=libsocket_wrapper.so ${OPENCONNECT}"
if test "${DISABLE_ASAN_BROKEN_TESTS}" = 1;then
echo "Skipping test requiring ldpreload"
exit 77
fi
fi
update_config() {

View File

@@ -20,7 +20,8 @@
SERV="${SERV:-../src/ocserv}"
OCCTL="${OCCTL:-../src/occtl/occtl}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
#we cannot use NO_NEED_ROOT here as occtl commands can only be issued by root
NEED_SOCKET_WRAPPER=1
PIDFILE=ocserv-pid.$$.tmp
OCCTL_SOCKET=./occtl-drain-$$.socket