test: sleep 0.5s; vagrant centos: ipv6 enable
This commit is contained in:
parent
8d8a37d18e
commit
ccadd3f9ea
5 changed files with 19 additions and 16 deletions
|
|
@ -45,7 +45,7 @@ You can prefix a test with `BE=0` if you want to run your own backend.
|
||||||
To run with debug flags, use the `DBG=<number>` environment variable.
|
To run with debug flags, use the `DBG=<number>` environment variable.
|
||||||
|
|
||||||
Other variables include:
|
Other variables include:
|
||||||
* RCWAIT Number of seconds to sleep after daemons have started
|
* DEMWAIT Number of seconds to sleep after daemons have started
|
||||||
|
|
||||||
## Run all tests
|
## Run all tests
|
||||||
|
|
||||||
|
|
|
||||||
20
test/lib.sh
20
test/lib.sh
|
|
@ -113,11 +113,15 @@ DEFAULTNS='xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"'
|
||||||
|
|
||||||
# Wait after daemons (backend/restconf) start. See mem.sh for valgrind
|
# Wait after daemons (backend/restconf) start. See mem.sh for valgrind
|
||||||
if [ "$(uname -m)" = "armv7l" ]; then
|
if [ "$(uname -m)" = "armv7l" ]; then
|
||||||
: ${RCWAIT:=8}
|
: ${DEMWAIT:=8}
|
||||||
else
|
else
|
||||||
: ${RCWAIT:=2}
|
: ${DEMWAIT:=2}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Multiplication factor to sleep less than whole seconds
|
||||||
|
DEMSLEEP=.5
|
||||||
|
let DEMWAIT*=2;
|
||||||
|
|
||||||
# RESTCONF protocol, eg http or https
|
# RESTCONF protocol, eg http or https
|
||||||
: ${RCPROTO:=http}
|
: ${RCPROTO:=http}
|
||||||
|
|
||||||
|
|
@ -276,12 +280,12 @@ wait_backend(){
|
||||||
reply=$(echo '<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101"><ping xmlns="http://clicon.org/lib"/></rpc>]]>]]>' | $clixon_netconf -qef $cfg 2> /dev/null)
|
reply=$(echo '<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" 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 $DEMSLEEP
|
||||||
reply=$(echo '<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101" xmlns="http://clicon.org/lib"><ping/></rpc>]]>]]>' | clixon_netconf -qef $cfg 2> /dev/null)
|
reply=$(echo '<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101" xmlns="http://clicon.org/lib"><ping/></rpc>]]>]]>' | clixon_netconf -qef $cfg 2> /dev/null)
|
||||||
let i++;
|
let i++;
|
||||||
# echo "wait_backend $i"
|
# echo "wait_backend $i"
|
||||||
if [ $i -ge $RCWAIT ]; then
|
if [ $i -ge $DEMWAIT ]; then
|
||||||
err "backend timeout $RCWAIT seconds"
|
err "backend timeout $DEMWAIT seconds"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
@ -324,13 +328,13 @@ wait_restconf(){
|
||||||
# echo "hdr:\"$hdr\""
|
# echo "hdr:\"$hdr\""
|
||||||
let i=0;
|
let i=0;
|
||||||
while [[ $hdr != *"200 OK"* ]]; do
|
while [[ $hdr != *"200 OK"* ]]; do
|
||||||
sleep 1
|
sleep $DEMSLEEP
|
||||||
hdr=$(curl $CURLOPTS $* $RCPROTO://localhost/restconf)
|
hdr=$(curl $CURLOPTS $* $RCPROTO://localhost/restconf)
|
||||||
# echo "hdr:\"$hdr\""
|
# echo "hdr:\"$hdr\""
|
||||||
let i++;
|
let i++;
|
||||||
# echo "wait_restconf $i"
|
# echo "wait_restconf $i"
|
||||||
if [ $i -ge $RCWAIT ]; then
|
if [ $i -ge $DEMWAIT ]; then
|
||||||
err "restconf timeout $RCWAIT seconds"
|
err "restconf timeout $DEMWAIT seconds"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ $valgrindtest -eq 3 ]; then
|
if [ $valgrindtest -eq 3 ]; then
|
||||||
|
|
|
||||||
|
|
@ -17,17 +17,17 @@ memonce(){
|
||||||
case "$what" in
|
case "$what" in
|
||||||
'cli')
|
'cli')
|
||||||
valgrindtest=1
|
valgrindtest=1
|
||||||
: ${RCWAIT:=5} # valgrind backend needs some time to get up
|
: ${DEMWAIT:=5} # valgrind backend needs some time to get up
|
||||||
clixon_cli="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile clixon_cli"
|
clixon_cli="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile clixon_cli"
|
||||||
;;
|
;;
|
||||||
'netconf')
|
'netconf')
|
||||||
valgrindtest=1
|
valgrindtest=1
|
||||||
: ${RCWAIT:=5} # valgrind backend needs some time to get up
|
: ${DEMWAIT:=5} # valgrind backend needs some time to get up
|
||||||
clixon_netconf="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile clixon_netconf"
|
clixon_netconf="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile clixon_netconf"
|
||||||
;;
|
;;
|
||||||
'backend')
|
'backend')
|
||||||
valgrindtest=2 # This means backend valgrind test
|
valgrindtest=2 # This means backend valgrind test
|
||||||
: ${RCWAIT:=10} # valgrind backend needs some time to get up
|
: ${DEMWAIT:=10} # valgrind backend needs some time to get up
|
||||||
|
|
||||||
clixon_backend="/usr/bin/valgrind --num-callers=50 --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=yes --log-file=$valgrindfile clixon_backend"
|
clixon_backend="/usr/bin/valgrind --num-callers=50 --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=yes --log-file=$valgrindfile clixon_backend"
|
||||||
;;
|
;;
|
||||||
|
|
@ -35,7 +35,7 @@ memonce(){
|
||||||
valgrindtest=3 # This means backend valgrind test
|
valgrindtest=3 # This means backend valgrind test
|
||||||
sudo chmod 660 $valgrindfile
|
sudo chmod 660 $valgrindfile
|
||||||
sudo chown www-data $valgrindfile
|
sudo chown www-data $valgrindfile
|
||||||
: ${RCWAIT:=15} # valgrind backend needs some time to get up
|
: ${DEMWAIT:=15} # valgrind backend needs some time to get up
|
||||||
clixon_restconf="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile /www-data/clixon_restconf"
|
clixon_restconf="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile /www-data/clixon_restconf"
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
|
|
@ -335,8 +335,7 @@ if $run; then
|
||||||
start_restconf -f $cfg -y $fyang
|
start_restconf -f $cfg -y $fyang
|
||||||
|
|
||||||
new "waiting"
|
new "waiting"
|
||||||
sleep $RCWAIT
|
sleep $DEMWAIT
|
||||||
|
|
||||||
|
|
||||||
to=$to0
|
to=$to0
|
||||||
step=$step0
|
step=$step0
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ case $release in
|
||||||
;;
|
;;
|
||||||
centos)
|
centos)
|
||||||
# enable ipv6
|
# enable ipv6
|
||||||
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
|
$sshcmd sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
|
||||||
# add restconf user: $wwwuser
|
# add restconf user: $wwwuser
|
||||||
if [ ! $($sshcmd id -u $wwwuser) ]; then
|
if [ ! $($sshcmd id -u $wwwuser) ]; then
|
||||||
$sshcmd sudo useradd -M $wwwuser
|
$sshcmd sudo useradd -M $wwwuser
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue