freebsd test script modifications

This commit is contained in:
Olof Hagsand 2019-10-13 07:04:05 -10:00 committed by Olof Hagsand
parent 0895ac7b0d
commit 734f65e25a
26 changed files with 41 additions and 34 deletions

View file

@ -78,3 +78,9 @@ You may add your site-specific modifications in a `site.sh` file. Example:
IETFRFC=$YANGMODELS/standard/ietf/RFC IETFRFC=$YANGMODELS/standard/ietf/RFC
``` ```
## FreeBSD
To run on freebsd:
```
wwwuser=www clixon_restconf=/usr/local/sbin/clixon_restconf ./all.sh
```

View file

@ -190,7 +190,7 @@ stop_backend(){
# Wait for restconf to stop sending 502 Bad Gateway # Wait for restconf to stop sending 502 Bad Gateway
wait_backend(){ wait_backend(){
reply=$(echo '<rpc message-id="101"><ping xmlns="http://clicon.org/lib"/></rpc>]]>]]>' | clixon_netconf -qef $cfg 2> /dev/null) reply=$(echo '<rpc message-id="101"><ping xmlns="http://clicon.org/lib"/></rpc>]]>]]>' | $clixon_netconf -qef $cfg 2> /dev/null)
let i=0; let i=0;
while [[ $reply != "<rpc-reply"* ]]; do while [[ $reply != "<rpc-reply"* ]]; do
sleep 1 sleep 1
@ -205,14 +205,14 @@ wait_backend(){
start_restconf(){ start_restconf(){
# Start in background # Start in background
sudo su -c "$clixon_restconf $RCLOG -D $DBG $*" -s /bin/sh www-data & sudo -u $wwwuser -s $clixon_restconf $RCLOG -D $DBG $* &
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
err err
fi fi
} }
stop_restconf(){ stop_restconf(){
sudo pkill -u www-data -f "/www-data/clixon_restconf" sudo pkill -u $wwwuser -f "$clixon_restconf"
if [ $valgrindtest -eq 3 ]; then if [ $valgrindtest -eq 3 ]; then
sleep 1 sleep 1
checkvalgrind checkvalgrind
@ -292,7 +292,7 @@ expectfn(){
let i=0; let i=0;
for exp in "$@"; do for exp in "$@"; do
if [ $i -gt 1 ]; then if [ $i -gt 1 ]; then
match=`echo $ret | grep -EZo "$exp"` match=`echo $ret | grep --null -Eo "$exp"`
if [ -z "$match" ]; then if [ -z "$match" ]; then
err "$exp" "$ret" err "$exp" "$ret"
fi fi
@ -357,7 +357,7 @@ expectpart(){
for exp in "$@"; do for exp in "$@"; do
if [ $i -gt 1 ]; then if [ $i -gt 1 ]; then
# echo "exp:$exp" # echo "exp:$exp"
match=`echo $ret | grep -Zo "$exp"` # XXX -EZo: -E cant handle {} match=`echo $ret | grep --null -o "$exp"` # XXX -EZo: -E cant handle {}
if [ -z "$match" ]; then if [ -z "$match" ]; then
err "$exp" "$ret" err "$exp" "$ret"
fi fi
@ -403,12 +403,13 @@ EOF
return return
fi fi
# -G for basic regexp (eg ^$). -E for extended regular expression - differs in \ # -G for basic regexp (eg ^$). -E for extended regular expression - differs in \
# -Z for nul character, -x for implicit ^$ -q for quiet # --null for nul character, -x for implicit ^$ -q for quiet
# -o only matching # -o only matching
# Two variants: -EZo and -Fxq # Two variants: --null -Eo and -Fxq
# match=`echo "$ret" | grep -FZo "$expect"` # match=`echo "$ret" | grep --null -Fo "$expect"`
r=$(echo "$ret" | grep -GZo "$expect") r=$(echo "$ret" | grep --null -Go "$expect")
match=$? match=$?
# echo "r:\"$r\"" # echo "r:\"$r\""
# echo "ret:\"$ret\"" # echo "ret:\"$ret\""
# echo "expect:\"$expect\"" # echo "expect:\"$expect\""
@ -564,7 +565,7 @@ expectmatch(){
err "$expect" "$ret" err "$expect" "$ret"
fi fi
if [ -n "$expect2" ]; then if [ -n "$expect2" ]; then
match=`echo "$ret" | grep -EZo "$expect2"` match=`echo "$ret" | grep --null -Eo "$expect2"`
if [ -z "$match" ]; then if [ -z "$match" ]; then
err $expect "$ret" err $expect "$ret"
fi fi

View file

@ -118,7 +118,7 @@ if [ $BE -ne 0 ]; then
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data clixon_restconf sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon" new "start restconf daemon"
start_restconf -f $cfg start_restconf -f $cfg

View file

@ -153,7 +153,7 @@ if [ $BE -ne 0 ]; then
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data clixon_restconf sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon" new "start restconf daemon"
start_restconf -f $cfg start_restconf -f $cfg

View file

@ -122,7 +122,7 @@ if [ $BE -ne 0 ]; then
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf" sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon (-a is enable basic authentication)" new "start restconf daemon (-a is enable basic authentication)"
start_restconf -f $cfg -- -a start_restconf -f $cfg -- -a

View file

@ -99,7 +99,7 @@ EOF
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf" sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon (-a is enable basic authentication)" new "start restconf daemon (-a is enable basic authentication)"
start_restconf -f $cfg -- -a start_restconf -f $cfg -- -a

View file

@ -143,7 +143,7 @@ if [ $BE -ne 0 ]; then
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf" sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon (-a is enable http basic auth)" new "start restconf daemon (-a is enable http basic auth)"
start_restconf -f $cfg -- -a start_restconf -f $cfg -- -a

View file

@ -137,7 +137,7 @@ if [ $BE -ne 0 ]; then
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf" sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon (-a is enable basic authentication)" new "start restconf daemon (-a is enable basic authentication)"
start_restconf -f $cfg -- -a start_restconf -f $cfg -- -a

View file

@ -145,7 +145,7 @@ if [ $BE -ne 0 ]; then
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf" sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon (-a is enable basic authentication)" new "start restconf daemon (-a is enable basic authentication)"
start_restconf -f $cfg -- -a start_restconf -f $cfg -- -a

View file

@ -146,7 +146,7 @@ if [ $BE -ne 0 ]; then
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf" sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon (-a is enable basic authentication)" new "start restconf daemon (-a is enable basic authentication)"
start_restconf -f $cfg -- -a start_restconf -f $cfg -- -a

View file

@ -80,7 +80,7 @@ if [ $BE -ne 0 ]; then
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf" sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon" new "start restconf daemon"
start_restconf -f $cfg start_restconf -f $cfg

View file

@ -58,7 +58,7 @@ if [ $BE -ne 0 ]; then
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf" sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon" new "start restconf daemon"
start_restconf -f $cfg start_restconf -f $cfg

View file

@ -49,7 +49,7 @@ if [ $BE -ne 0 ]; then
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data clixon_restconf sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon" new "start restconf daemon"
start_restconf -f $cfg start_restconf -f $cfg

View file

@ -80,7 +80,7 @@ if [ $BE -ne 0 ]; then
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf" sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon" new "start restconf daemon"
start_restconf -f $cfg start_restconf -f $cfg

View file

@ -126,7 +126,7 @@ if [ $BE -ne 0 ]; then
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf" sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon" new "start restconf daemon"
start_restconf -f $cfg start_restconf -f $cfg

View file

@ -75,7 +75,7 @@ if [ $BE -ne 0 ]; then
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf" sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon" new "start restconf daemon"
start_restconf -f $cfg start_restconf -f $cfg

View file

@ -78,7 +78,7 @@ if [ $BE -ne 0 ]; then
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf" sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon" new "start restconf daemon"
start_restconf -f $cfg start_restconf -f $cfg

View file

@ -106,7 +106,7 @@ if [ $BE -ne 0 ]; then
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf" sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon (-a is enable basic authentication)" new "start restconf daemon (-a is enable basic authentication)"
start_restconf -f $cfg -- -a start_restconf -f $cfg -- -a

View file

@ -62,7 +62,7 @@ testrun(){
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data clixon_restconf sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon" new "start restconf daemon"
start_restconf -f $cfg -y $fyang $option start_restconf -f $cfg -y $fyang $option

View file

@ -44,7 +44,7 @@ if [ $BE -ne 0 ]; then
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data clixon_restconf sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon" new "start restconf daemon"
start_restconf -f $cfg start_restconf -f $cfg

View file

@ -115,7 +115,7 @@ if [ $BE -ne 0 ]; then
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf" sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon" new "start restconf daemon"
start_restconf -f $cfg start_restconf -f $cfg

View file

@ -160,7 +160,7 @@ if [ $BE -ne 0 ]; then
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data clixon_restconf sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon" new "start restconf daemon"
start_restconf -f $cfg start_restconf -f $cfg

View file

@ -256,7 +256,7 @@ if [ $BE -ne 0 ]; then
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data clixon_restconf sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon" new "start restconf daemon"
start_restconf -f $cfg start_restconf -f $cfg

View file

@ -267,7 +267,7 @@ testrun(){
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data clixon_restconf sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon" new "start restconf daemon"
start_restconf -f $cfg start_restconf -f $cfg

View file

@ -114,7 +114,7 @@ if [ $BE -ne 0 ]; then
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data clixon_restconf sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon" new "start restconf daemon"
start_restconf -f $cfg start_restconf -f $cfg

View file

@ -77,7 +77,7 @@ if [ $BE -ne 0 ]; then
fi fi
new "kill old restconf daemon" new "kill old restconf daemon"
sudo pkill -u www-data clixon_restconf sudo pkill -u $wwwuser clixon_restconf
new "start restconf daemon" new "start restconf daemon"
start_restconf -f $cfg start_restconf -f $cfg