From ccadd3f9ea06b17cf2c31d9389ff891a96e4ed3b Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Tue, 24 Nov 2020 18:29:04 +0100 Subject: [PATCH] test: sleep 0.5s; vagrant centos: ipv6 enable --- test/README.md | 2 +- test/lib.sh | 20 ++++++++++++-------- test/mem.sh | 8 ++++---- test/plot_perf.sh | 3 +-- test/vagrant/vagrant.sh | 2 +- 5 files changed, 19 insertions(+), 16 deletions(-) diff --git a/test/README.md b/test/README.md index 7f2ee695..5e1f3e61 100644 --- a/test/README.md +++ b/test/README.md @@ -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=` environment variable. 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 diff --git a/test/lib.sh b/test/lib.sh index 9b7f8308..6912ddcb 100755 --- a/test/lib.sh +++ b/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 if [ "$(uname -m)" = "armv7l" ]; then - : ${RCWAIT:=8} + : ${DEMWAIT:=8} else - : ${RCWAIT:=2} + : ${DEMWAIT:=2} fi +# Multiplication factor to sleep less than whole seconds +DEMSLEEP=.5 +let DEMWAIT*=2; + # RESTCONF protocol, eg http or https : ${RCPROTO:=http} @@ -276,12 +280,12 @@ wait_backend(){ reply=$(echo ']]>]]>' | $clixon_netconf -qef $cfg 2> /dev/null) let i=0; while [[ $reply != "]]>]]>' | clixon_netconf -qef $cfg 2> /dev/null) let i++; # echo "wait_backend $i" - if [ $i -ge $RCWAIT ]; then - err "backend timeout $RCWAIT seconds" + if [ $i -ge $DEMWAIT ]; then + err "backend timeout $DEMWAIT seconds" fi done } @@ -324,13 +328,13 @@ wait_restconf(){ # echo "hdr:\"$hdr\"" let i=0; while [[ $hdr != *"200 OK"* ]]; do - sleep 1 + sleep $DEMSLEEP hdr=$(curl $CURLOPTS $* $RCPROTO://localhost/restconf) # echo "hdr:\"$hdr\"" let i++; # echo "wait_restconf $i" - if [ $i -ge $RCWAIT ]; then - err "restconf timeout $RCWAIT seconds" + if [ $i -ge $DEMWAIT ]; then + err "restconf timeout $DEMWAIT seconds" fi done if [ $valgrindtest -eq 3 ]; then diff --git a/test/mem.sh b/test/mem.sh index 0e9c972a..36660d52 100755 --- a/test/mem.sh +++ b/test/mem.sh @@ -17,17 +17,17 @@ memonce(){ case "$what" in 'cli') 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" ;; 'netconf') 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" ;; 'backend') 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" ;; @@ -35,7 +35,7 @@ memonce(){ valgrindtest=3 # This means backend valgrind test sudo chmod 660 $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" ;; diff --git a/test/plot_perf.sh b/test/plot_perf.sh index 9fbde2f2..18d9a031 100755 --- a/test/plot_perf.sh +++ b/test/plot_perf.sh @@ -335,8 +335,7 @@ if $run; then start_restconf -f $cfg -y $fyang new "waiting" - sleep $RCWAIT - + sleep $DEMWAIT to=$to0 step=$step0 diff --git a/test/vagrant/vagrant.sh b/test/vagrant/vagrant.sh index eb11ca74..7b65471e 100755 --- a/test/vagrant/vagrant.sh +++ b/test/vagrant/vagrant.sh @@ -137,7 +137,7 @@ case $release in ;; centos) # 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 if [ ! $($sshcmd id -u $wwwuser) ]; then $sshcmd sudo useradd -M $wwwuser