FreeBSD modifications: Configure, makefiles and test scripts modification for Freebsd

This commit is contained in:
Olof Hagsand 2019-10-20 09:03:31 -10:00
parent 1fa45067a7
commit d7bb96b9cf
15 changed files with 56 additions and 40 deletions

View file

@ -30,11 +30,16 @@ cat <<EOF > $cfg
</clixon-config>
EOF
# Create a pre-set running, startup and (extra) config.
# The configs are identified by an interface called run, startup, extra.
# Depending on startup mode (init, none, running, or startup)
# expect different output of an initial get-config of running
# Arguments:
# 1: startuser: Start backend as this user
# 2: backend user: Drop to this after initial run as startuser
# 3: expected user: Expected user after drop (or no drop then startuser)
# 4: privileged mode (none, drop_perm, drop_temp)
# 5: expect error: 0 or 1
testrun(){
startuser=$1
beuser=$2
@ -64,7 +69,7 @@ testrun(){
if [ $? -ne 0 ]; then
err
fi
sleep 1 # wait for backend to exit
pid=$(pgrep -f clixon_backend)
if [ $? -ne 0 ]; then
if [ $expecterr -eq 1 ]; then
@ -72,6 +77,7 @@ testrun(){
fi
err
fi
new "waiting"
wait_backend
@ -79,8 +85,8 @@ testrun(){
err "Expected error"
fi
# Get uid now, and compare with expected user
u=$(ps -p $pid -uh | awk '{print $1}')
# Get uid now, and compare with expected user (tail to skip hdr)
u=$(ps -p $pid -u | tail -1 | awk '{print $1}')
if [ $u != $expectuser ]; then
err "$expectuser but user is $u"
fi
@ -116,7 +122,7 @@ testrun root root root drop_perm 0
new "Start as root, set user but dont drop (expect still root)"
testrun root $BUSER root none 0
new "Start as non-privileged, try to drop"
new "Start as non-privileged, try to drop (but fail)"
testrun $(whoami) $BUSER $BUSER drop_perm 1
sudo rm -rf $dir